Language change and code breaks

Paul Boddie paul at boddie.net
Wed Jul 25 11:07:53 EDT 2001


Duncan Booth <duncan at NOSPAMrcp.co.uk> wrote in message news:<Xns90E975194FDD5duncanrcpcouk at 127.0.0.1>...
> 
> It might be an idea though to change some of the error messages when a 
> NameError or AttributeError is uncaught if a name could have matched with 
> different case (although I'm not sure how much overhead this might cause).
> 
> NameError: name 'x' is not defined
> could become:
> NameError: name 'x' is not defined, nearest match was 'X'
> 
> or
> AttributeError: C instance has no attribute 'Foo'
> could become:
> AttributeError: C instance has no attribute 'Foo', did you mean 'foo'?

A patch to do exactly this was once distributed by someone, but I
don't remember it ever getting into Python itself. That possibly means
that I don't make capitalisation errors myself, though, since it could
have been introduced as long ago as the 2.0 release.

Paul



More information about the Python-list mailing list