Bug or feature?
Christian Tismer
tismer at appliedbiometrics.com
Fri May 14 13:36:32 EDT 1999
Fredrik Lundh wrote:
...
> could anyone tell me which beginner's document that says
> that Python has class variables, and that using them is a good
> idea? especially for mutable data types?
>From the standard tutorial which I think is addressed to
beginners, we find
GvR_says="""
9.3.2 Class Objects
<snip>
class MyClass:
"A simple example class"
i = 12345
def f(x):
return 'hello world'
then MyClass.i and MyClass.f are valid attribute references,
returning an integer and a function object, respectively.
Class attributes can also be assigned to, so you can change
the value of MyClass.i by assignment. __doc__ is also a
valid attribute that's read-only, returning the docstring
belonging to the class: "A simple example class").
"""
I think this is not an invitation and not a warning.
Althpough I cannot find anything wrong with class variables
if one knows what she does.
ciao - chris
--
Christian Tismer :^) <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101 : *Starship* http://starship.python.net
10553 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
we're tired of banana software - shipped green, ripens at home
More information about the Python-list
mailing list