Style question - defining immutable class data members

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sat Mar 14 13:57:12 EDT 2009


Maxim Khitrov:
> When the types are immutable, there is no difference.

But you may want different instances to have different immutable data.

Generally if the data (immutable or not) is the same for all the
instances, use class attributes, otherwise use instance attributes.

Bye,
bearophile



More information about the Python-list mailing list