[Patches] From comp.lang.python: A compromise on case-sensitivity

Guido van Rossum guido@python.org
Thu, 25 May 2000 11:43:35 -0500


> So I wanted to see how hard it would be to make Python's error
> messages friendlier to case-insensitive newbies, without breaking
> existing programs that rely on 'Guido', and 'GUIdo' being different
> names.  I decided the best way to do this was to patch the code that
> raises NameError and AttrError.

This is a nice idea, although one could argue that you have it
backwards: you're helping case-careless people to use a case-sensitive
language, while what we really need now for forward compatibility is a
warning when case-sensitive people use names in the same namespace
that only differ by case.  That one is best done through a
source-analysis check though -- I expect that we'll provide tools for
this with Python 1.7 at the earliest.

Anyway, without having read your patch in detail, I see one potential
problem, which I'll leave for others in this forum to investigate
futher (I'm in desperate need to shed some load).  Recently, we
discovered that there was a significant slowdown in class instance
creation compared to 1.5.2, which (after considerable investigation)
turned out to be due to code that made the AttributeError message a
bit nicer.  What happened was that when a class has no __init__, an
AttributeError was raised for that name, which was subsequently
caught.  The code that raised the exception was changed to do a whole
lot more work, which ended up being more work than the instance
creation in the first place!

We managed to work around that one, but I'd like to make sure that
there isn't a hidden situation like it with the proposed patch.

--Guido van Rossum (home page: http://www.python.org/~guido/)