Inefficiency of __getattr__

jay.krell at cornell.edu jay.krell at cornell.edu
Tue Oct 3 02:08:04 EDT 2000


>Every time I've argued static versus dynamic typing with a
>static-typing fan, they've ended up concluding that what they really
>hate is not dynamic typing but silent coercions.

You haven't argued with me. :)
C++ allows silent coercions in a few places that make sense -- cast to base
class, call of user defined "operator T()" and call of user defined
constructor, besides the "usual" numeric conversions and conversion of 0 to
any pointer type (this can actually be a problem, like where stuff is
defined to operate on integers and pointers, the language would be much
better off with magic like
#define NULL __null
than #define NULL 0 where "_null" is compiler magic for the null pointer of
any type and 0 favors being an integer before being a pointer..
std::vector<int>'s constructor runs into this problem).

To keep things from a exploding combinatorially in the compiler, the
language only allows one level of silent conversion.

 - Jay

-----Original Message-----
From: Kragen Sitaker <kragen at dnaco.net>
Newsgroups: comp.lang.python
To: python-list at python.org <python-list at python.org>
Date: Monday, October 02, 2000 10:56 AM
Subject: Re: Inefficiency of __getattr__
...





More information about the Python-list mailing list