design question: no new attributes
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Wed Feb 28 21:39:09 EST 2007
En Wed, 28 Feb 2007 09:41:47 -0300, Alan Isaac <aisaac at american.edu>
escribió:
> However I will observe that
> - entire languages are structured on the premise that dynamic
> attribute creation can be hazardous
That's why we have so many languages to choose from. What is highly
important for someone is irrelevant for others. [PL/1 was destined to be
The Programming Language...]
If you actually dislike the concept of dynamic attribute creation, you're
using the wrong language.
> - debuggers watch out for dynamic attribute creation, which
> tells us it is a common source of bugs
Which debugger, please? Might be interesting. (As a debugging tool, not as
a design technique).
> - I sincerely doubt that anyone who has written more than
> a couple scripts in Python has never accidentally created an
> attribute dynamically while intending to assign to an existing
> attribute.
That *might* happen, but not so frequently as to fight against the dynamic
nature of Python.
> I know the response: write good unit tests. OK, but right now
> I am writing code where this restriction will serve as a reasonable
> error check, and the design I offered allows very easy removal
> of the restriction in the future. Say, once I have written adequate
> unit tests.
If it suits your needs, fine! But you'll find that most Python programmers
won't agree with your approach.
--
Gabriel Genellina
More information about the Python-list
mailing list