Re: classmethod and instance method

2006-02-03 Thread Xavier Morel
[EMAIL PROTECTED] wrote: > Yes that's better. Didn't know about the __class__ attribute. I > thought there must be a way to access this but couldn't find it in the > docs. > > Thanks, > > Andy > dir(), help() and the interactive interpreter (IDLE or CLI) are your best friends. Any time you w

Re: classmethod and instance method

2006-02-02 Thread andychambers2002
Yes that's better. Didn't know about the __class__ attribute. I thought there must be a way to access this but couldn't find it in the docs. Thanks, Andy -- http://mail.python.org/mailman/listinfo/python-list

Re: classmethod and instance method

2006-02-02 Thread Jean-Paul Calderone
On 2 Feb 2006 12:08:43 -0800, [EMAIL PROTECTED] wrote: >Hi, > >I'm trying to write a method that needs to know both the class name and >the instance details > >class A: > >@classmethod >def meth(cls, self): >print cls >print self > >a = A() >a.meth(a) > >The above code seem

Re: classmethod and instance method

2006-02-02 Thread Xavier Morel
[EMAIL PROTECTED] wrote: > Hi, > > I'm trying to write a method that needs to know both the class name and > the instance details > > Any suggestions? > What's the point of using a classmethod and an explicit cls argument when you can get the class object from the instance itself? >>> class