design question: no new attributes

Alan Isaac aisaac at american.edu
Thu Mar 1 22:59:30 CET 2007


The security application seems to call for roles.
I'll have to think about the schema example.
But in any case, my question was poorly stated.
I started out wanting to trap was the dynamic
addition of attributes to class instances after
initialization. While you responded to my later question
as asked, the response does not I think take this context
into account.

"Bruno Desthuilliers" <bdesth.quelquechose at free.quelquepart.fr> wrote in
message news:45e7438f$0$29410$426a74cc at news.free.fr...
> As a side note :  in Python, *all* attributes are "dynamically created".
> ... Writing methods
> within the class statement body makes things clearer, but is by no mean
> mandatory:

Point taken.  And I understand it means that my talk of
"after initialization" above contains some ambiguity.

One last point. While I remain interested in examples of how
"late" addition of attributes to class instances is useful,
I must note that everyone who responded agreed that it
has been a source of bugs.  This seems to argue against a
general ban on "locking" objects in some way, in some
circumstances.

Thanks!
Alan





More information about the Python-list mailing list