classmethod & staticmethod

Neil Cerutti horpner at yahoo.com
Wed Jul 25 07:26:32 EDT 2007


On 2007-07-25, Alex Popescu <nospam.themindstorm at gmail.com> wrote:
> Neil Cerutti <horpner at yahoo.com> wrote in news:eRwpi.36813$G23.28496
> @newsreading01.news.tds.net:
>
>> On 2007-07-25, Alex Popescu <nospam.themindstorm at gmail.com> wrote:
>>> As a matter of style, how do you figure out that class_list is
>>> a class attribute and not an instance attribute? (I don't
>>> remember seeing anything in the PEP describing the coding
>>> style).
>> 
>> Check out dir(MyClass) and dir(MyClass()) for some insight, if it
>> turns out that it matters. 
>
> I must confess that I am a bit confused by this advise, as both
> are returning exactly the same thing.

Oops! I misthought myself.

I was thinking of MyClass.__dict__.keys() and
MyClass().__dict__.keys().

-- 
Neil Cerutti
To succeed in the world it is not enough to be stupid, you must also be well-
mannered. --Voltaire



More information about the Python-list mailing list