Re: Get name of class without instance

2009-06-24 Thread Christian Heimes
Terry Reedy wrote: > Bryan wrote: > >> How come dir(Foo) does not show __name__? That is how I was >> investigating the possibilities. > > Interesting question. Seems like an oversight. dir(some_module) and > dir(some_function) include '__name__'. I suggest you search the tracker > for existing

Re: Get name of class without instance

2009-06-24 Thread Terry Reedy
Bryan wrote: How come dir(Foo) does not show __name__? That is how I was investigating the possibilities. Interesting question. Seems like an oversight. dir(some_module) and dir(some_function) include '__name__'. I suggest you search the tracker for existing issues on this subject and add a

Re: Get name of class without instance

2009-06-24 Thread David Stanek
Try Foo.__name__ if Foo is a class object. On 6/24/09, Bryan wrote: > Given a class: > > class Foo(object): > pass > > How can I get the name "Foo" without having an instance of the class? > > str(Foo) gives me more than just the name Foo. "__main__.Account" > Foo.__class__.__name__ gives m

Re: Get name of class without instance

2009-06-24 Thread J. Cliff Dyer
On Wed, 2009-06-24 at 09:17 -0700, Bryan wrote: > Given a class: > > class Foo(object): > pass > > How can I get the name "Foo" without having an instance of the class? > > str(Foo) gives me more than just the name Foo. "__main__.Account" > Foo.__class__.__name__ gives me "type" > > I don

Re: Get name of class without instance

2009-06-24 Thread Bryan
On Jun 24, 9:25 am, Tim Golden wrote: > Bryan wrote: > > Given a class: > > > class Foo(object): > >     pass > > > How can I get the name "Foo" without having an instance of the class? > > > str(Foo) gives me more than just the name Foo.   "__main__.Account" > > Foo.__class__.__name__ gives me "t

Re: Get name of class without instance

2009-06-24 Thread Tim Golden
Bryan wrote: Given a class: class Foo(object): pass How can I get the name "Foo" without having an instance of the class? str(Foo) gives me more than just the name Foo. "__main__.Account" Foo.__class__.__name__ gives me "type" I don't want to do: Foo().__class__.__name__ if possible. I

Re: Get name of class without instance

2009-06-24 Thread Jean-Michel Pichavant
Bryan wrote: Given a class: class Foo(object): pass How can I get the name "Foo" without having an instance of the class? str(Foo) gives me more than just the name Foo. "__main__.Account" Foo.__class__.__name__ gives me "type" I don't want to do: Foo().__class__.__name__ if possible. I

Get name of class without instance

2009-06-24 Thread Bryan
Given a class: class Foo(object): pass How can I get the name "Foo" without having an instance of the class? str(Foo) gives me more than just the name Foo. "__main__.Account" Foo.__class__.__name__ gives me "type" I don't want to do: Foo().__class__.__name__ if possible. I would rather a