gentlestone a écrit :
(snip)
one more question - __class__ is the way for getting the classname
from the class instance -
obj.__class__ is a reference to the class object itself, not it's name.
how can I get the module name?
module_obj.__name__
And while we're at it: obj.__class__.__modu
Steven D'Aprano schrieb:
On Mon, 05 Oct 2009 23:32:27 -0700, gentlestone wrote:
Suppose I've saved the class name and (don't know how) I've also saved
the Class's module (package path or I don't know what's the name for XYZ
"from X.Y.Z import ...). How can I construct a new class according to
s
On Tue, 06 Oct 2009 00:09:08 -0700, gentlestone wrote:
> one more question - __class__ is the way for getting the classname from
> the class instance -
Not quite. __class__ returns the class object, not the name. Given the
class object, you ask for __name__ to get the name it was defined as[1].
On Tue, Oct 6, 2009 at 12:09 AM, gentlestone wrote:
> On 6. Okt, 08:55 h., Steven D'Aprano
> wrote:
>> On Mon, 05 Oct 2009 23:32:27 -0700, gentlestone wrote:
>> > Suppose I've saved the class name and (don't know how) I've also saved
>> > the Class's module (package path or I don't know what's th
On 6. Okt, 08:55 h., Steven D'Aprano
wrote:
> On Mon, 05 Oct 2009 23:32:27 -0700, gentlestone wrote:
> > Suppose I've saved the class name and (don't know how) I've also saved
> > the Class's module (package path or I don't know what's the name for XYZ
> > "from X.Y.Z import ...). How can I constr
On Mon, 05 Oct 2009 23:32:27 -0700, gentlestone wrote:
> Suppose I've saved the class name and (don't know how) I've also saved
> the Class's module (package path or I don't know what's the name for XYZ
> "from X.Y.Z import ...). How can I construct a new class according to
> saved informations? I
Suppose I've saved the class name and (don't know how) I've also saved
the Class's module (package path or I don't know what's the name for
XYZ "from X.Y.Z import ...). How can I construct a new class according
to saved informations? If I don't know what Class it could be, only I
have the saved Cla