On 2007-07-24, Alex Popescu <[EMAIL PROTECTED]> wrote:
> Bruno Desthuilliers <[EMAIL PROTECTED]> wrote 
> in news:[EMAIL PROTECTED]:
>
>
>>
>> [snip...]
>>
>> 
>> Not necessarily - you can access class attributes from within an 
>> instance method (but obviously a classmethod cannot access instance 
>> attributes).
>>
>
> What I am doing wrong here then:
>
> class MyClass(object):
>   class_list = ['a', 'b']
>
>   def instance_method(self):
>     print "instance_method with class list %s" % class_list

There's no implicit self or class for Python identifiers.

The name class_list must be quailified: self.class_list or
MyClass.class_list.

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

Reply via email to