Re: determining fully qualified package class name

2007-10-11 Thread Marc 'BlackJack' Rintsch
On Thu, 11 Oct 2007 11:18:33 -0700, patrimith wrote:

 I am used to the following with Java:
 
 import some.package.MyClass;
 name = MyClass.class.getName();
 
 The value for name will be some.package.MyClass.
 
 For Python, I find:
 
 from some.package.myclass import MyClass
 name = MyClass.__name__
 
 The value for  name will be MyClass
 
 Is there a comparable way to get the fully qualified name (package, module,
 and class name) in Python?

Take a look at the `__module__` attribute of the class.

Ciao,
Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: determining fully qualified package class name

2007-10-11 Thread Goldfish
import myPackage

f = myPackage.foo()

print f.__module__ + . + f.__class__.__name__

That should do it!

-- 
http://mail.python.org/mailman/listinfo/python-list