Q: attribute access and comparisons of two different objects

Chris... chris.schaller at web.de
Tue Jun 15 14:20:34 CEST 2004

Two simple questions regarding future of Python:

1) Is there already a "fix" to avoid writing to an attribute that
isn't defined yet?  I remember this being an often discussed problem,
but didn't see any changes.  The only way I can think of is overriding
__setattr__, but this is huge overhead.  While I like the idea of
being able to add new attributes on the fly, in great projects I'd
like to restrict some classes not to do so.

2) This is driving me nuts: I do not want to compare apples and peas. 
I can say that they are not equal, but I cannot say that one is great
than the other (speaking not of greater taste ;-).  Just ran into a
problem caused by comparing a string with a number ("1" > 10) -- I
simply forgot to convert the string to an integer.  Since I cannot add
"1" + 10 which makes sense, I do not want to compare them.  Any
development regarding this?  Any """from __future__ import"""?

- Chris

More information about the Python-list mailing list