On 08/06/2010 17:55, Steven D'Aprano wrote:
On Tue, 08 Jun 2010 17:24:55 +0100, Mark Lawrence wrote:

On 08/06/2010 17:04, Ross Williamson wrote:
Hi Everyone,

Just a quick question - Is it possible to assign class variables in the
__init__() - i.e. somthing like:

They're instance variables, not class variables.

In the usual Python terminology, they're instance *attributes*. If a
float variable is a variable storing a float, and a string variable is a
variable storing a string, then in a language like Python where classes
are first-class objects a class variable is a variable storing a class.

That's why Python has functions getattr, setattr and delattr, and special
methods __getattr__ etc., rather than "getvar" etc.

I realise that other languages use "class variable" and "instance
variable" to mean something completely different, but we don't have to
emulate their mistakes... *wink*

Yes alright bloody Aussies ** n * sodit * *wink*. Not sure if this is a syntax error, but too lazy too test at an interactive prompt.

Kindest regards.

Mark Lawrence.

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

Reply via email to