[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Include rangeobject.h,2.16,2.17

Tim Peters tim.one@home.com
Sun, 8 Jul 2001 22:40:19 -0400


[Tim]
>     class C:
>         pass
>
>     c = C()
>     print len(c)

[Greg Ward]
> Good point -- this is one place where AttributeError is misused and
> confusing.  +1 on changing it to TypeError -- this sounds like a
> definite usability increase.  (IOW, it won't break *my* code.  ;-)

We're not actually *proposing* to change anything; in fact, that specific
example works the same in 2.2a0 (even with the type/class changes) as in
2.1.  The problem is that which of {TypeError, AttributeError} you get when
a specific object doesn't support a specific operation is at least partly an
accident, and changes from time to time whether or not intended.

Since instance objects have always been the flakiest in this respect, and
the instance/class machinery is undergoing radical surgery on descr-branch
(in particular, classes are themselves becoming instances (of metaclasses)),
I think Guido is trying to get a feel for how loudly people will howl if we
don't add reams of obscure code seeking to reproduce old accidents exactly.

it's-not-whether-they'll-howl-it's-the-volume-ly y'rs  - tim