Global variables from a class

Javier Collado javier.collado at gmail.com
Fri May 29 12:04:53 CEST 2009


Hello,

First thing is a class variable (one for every instance) and second
one an instance variable (one per instance).

For further information, please take a look at:
http://diveintopython.org/object_oriented_framework/class_attributes.html

Best regards,
   Javier

2009/5/29 Kless <jonas.esp at googlemail.com>:
> I usually use a class to access to global variables. So, which would
> be the correct way to set them --since the following classes--:
>
> --------------------
> class Foo:
>   var = 'lala'
>
> class Bar:
>   def __init__(self):
>      self.var = 'lele'
> --------------------
>
> Or is it the same?
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list