attribute access and comparisons of two different objects

Larry Bates lbates at swamisoft.com
Tue Jun 15 09:26:41 EDT 2004


1) In Python 2.3 there is a new __slots__ methodology that
does what you want with class attributes.  One must wonder
how everyone got by without it for so many years.  I'm not
sure I understand the "overhead" issue.  Some code must be
executed to determine if an attribute exists or not, why
shouldn't it be up to the programmer to write it by
overriding __setattr__ method?

2) Why don't these programming languages do what I mean
instead of what I tell them to do? ;-)

HTH,
Larry Bates
Syscon, Inc.

"Chris..." <chris.schaller at web.de> wrote in message
news:2418de8e.0406150420.1c1bde76 at posting.google.com...
> 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