B
Bruno Desthuilliers
Dan Stromberg a écrit :
Neither useless complexity nor tryig to apply inappropriate idioms are
good practices.
(snip)
Please remember that Python has support for computed attributes (you do
know what's a computed attribute, don't you ?), so you can turn a plain
attribute into a computed one at any time without breakink the API. IOW,
you don't need getters/setter a priori.
Python's current performance characteristics have no bearing on what is
good software engineering practice in general,
Neither useless complexity nor tryig to apply inappropriate idioms are
good practices.
(snip)
I'm not omniscient, and neither is anyone else; when one initially codes a
class, one doesn't know to what purposes it will need to be bent in the
future; using accessor methods instead of exposed attributes is
significantly more flexible for the future of your class.
Please remember that Python has support for computed attributes (you do
know what's a computed attribute, don't you ?), so you can turn a plain
attribute into a computed one at any time without breakink the API. IOW,
you don't need getters/setter a priori.