Style question - defining immutable class data members

Torsten Bronger bronger at physik.rwth-aachen.de
Sat Mar 14 22:49:54 CET 2009


Hallöchen!

Maxim Khitrov writes:

> [...]
>
> The advantage of doing this is that the assignments are evaluated
> once and thus the creation of that class is a bit faster. Access
> is still performed through self.some_value and
> self.another_value. Is there a reason to prefer the first style
> over the second?

I think that tools like epydoc can generate more accurate API
documentation if you write them as instance attributes.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                   Jabber ID: torsten.bronger at jabber.rwth-aachen.de



More information about the Python-list mailing list