Does Python really follow its philosophy of "Readability counts"?

Bruno Desthuilliers bdesth.quelquechose at
Wed Jan 14 20:33:01 CET 2009

Paul Rubin a écrit :
> Bruno Desthuilliers <bruno.42.desthuilliers at websiteburo.invalid> writes:
>>> I haven't anywhere in this thread as far as I know suggested
>>> eliminating dynamism from Python,
>> Nope, but your suggestion would have the same practical result as far
>> as I'm concerned.
> Sorry, I don't comprehend that.

IIRC, your suggestion was that one should have to explicitely allow 
"dynamic binding" (ie: outside the initializer) of new attributes, and 
that the default vould be to disallow them. That's at least what I 
understood from :

There are cases where this is useful but they're not terribly common.
I think it would be an improvement if creating new object attributes
was by default not allowed outside the __init__ method.  In the cases
where you really do want to create new attributes elsewhere, you'd
have to explicitly enable this at instance creation time, for example
by inheriting from a special superclass:

    class Foo (DynamicAttributes, object): pass


> Python already had such a change when it deprecated and later got rid
> of string exceptions.

I really don't get how this would be comparable with the above 
suggestion. I can well understand your concerns wrt/ Python's 
performances (even if I don't agree on your proposed solutions), but 
this one "argument" really looks like a straw man.

More information about the Python-list mailing list