list/classmethod problems
bruno at modulix
onurb at xiludom.gro
Tue Mar 14 04:16:17 EST 2006
ahart wrote:
> Diez, Scott, and Bruno,
>
> I thank you all for your help and suggestions. I wasn't aware that
> default values were considered class (static) values.
These are *not* 'default values'. Defining a name in the body of a class
statement bind that name to the *class*. To bind a name to the instance,
you have to do it inside an instance method - usually in the __init__()
method. Understand that there's not way to bind anything to an instance
before you actually *have* an instance !-)
> That seems a
> little odd to me,
Yes, it's very different from languages like Java or C++, but it makes
perfect sens once you understand Python's object model.
(snip)
> Again, I thank you all.
>
You're welcome.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list
mailing list