Force anything to be a string.

Patrick Phalen python-list at teleo.net
Sun Sep 19 14:22:57 EDT 1999


On Sun, 19 Sep 1999, Tim Peters wrote:
> [jonathon, finds that "str" has been rebound]

> I'd like to see a warning msg, though
> (it can't be made an error, at least not by default).

I remember once inadvertently tromping on 'str' too. Aggravating -- I
doubt I'll do that again. :)

Yet I don't keep a list of builtin names taped to my monitor, nor could
I rattle off all their names from memory.

A warning message *would* appear to be an apt solution, since this tends
to be a source of subtle bugs. Yet when I dir(__builtins__), I don't
see too many other obvious "references-at-risk-of-being-hosed"
(hmmm ... actually, David Ascher chronicles several others in _Learning
Python_).

How *hard* would it be to implement a warning message for this and is
it worth it? What marks the difference between a warning and
an error message?




More information about the Python-list mailing list