Data attributes...

Mark McEahern marklists at mceahern.com
Thu Jan 24 13:22:26 EST 2002


Lawrence Oluyede wrote:
> but the question is...why?? With this feature i could make my sources
> hard to read and so confused i think...

When asking questions of the sort, "Why does Python let me do apparently
stupid things like X?", it's best to consider, "Used intelligently, what
does the flexibility provided by X allow me to do easily that I wouldn't
otherwise be able to do in a more bondage-oriented language?"

The answer to your specific question, I think, is that being able to
dynamically add attributes to a class instance at runtime is powerful.

By the way, the best way not to make your sources hard to read and confused
is to be explicit and intentional in your approach.  Python allows you to do
that.

I would guess you can use any language to make a mess--it should be no
surprise to you that Python is no exception in that respect.

Where's the problem?

<wink>

// mark





More information about the Python-list mailing list