Any other Python flaws?

Toby Dickenson tdickenson at devmail.geminidataloggers.co.uk
Fri Jun 15 08:04:56 EDT 2001


Andrew Kuchling <akuchlin at mems-exchange.org> wrote:

>Are there any other flaws that
>should be added?

I have two:

Firstly, the root namespace for 'import' is too big.

What does a simple 'import foo' load...
1. a module from the standard library?
2. a module from the current directory?
3. a module from the current package?
4. a module from site-packages?

And naturally the answer changes depending on what packages are
installed, what files are in the current directory, and what new
modules have recently been added to the standard library :-(


Secondly, the irregularity when making comparisons between objects of
very different types. Sometimes it is consistent but arbitrary, and
sometimes it raises an exception.

Is (u'a'>'\x80') really more deserving of an exception than ('a'>1)?

Personally, I like the C++ solution: comparison operators only work
when the order is sensible, and a separate function (in c++ the cmp
template) provides a total (but possibly arbitrary) ordering suitable
for indexing purposes.


Toby Dickenson
tdickenson at geminidataloggers.com



More information about the Python-list mailing list