Lists in classes

Bart Ogryczak B.Ogryczak at gmail.com
Thu Jul 12 11:33:34 EDT 2007


On 12 jul, 17:23, Jeremy  Lynch <jeremy.ly... at gmail.com> wrote:
> Hello,
>
> Learning python from a c++ background. Very confused about this:
>
> ============
> class jeremy:
>         list=[]

You've defined list (very bad choice of a name, BTW), as a class
variable. To declare is as instance variable you have to prepend it
with "self."




More information about the Python-list mailing list