Comment on draft PEP for deprecating six builtins

Bernhard Herzog bh at intevation.de
Tue Apr 30 06:04:08 EDT 2002


Roman Neuhauser <neuhauser at mail.cz> writes:

> > >> The problem with int.chr() is that a lot of people are going to get
> > >> confused when they find that "42.chr()" doesn't work (although "42
> > >> .chr()" does).
[Alex explains that 42. is a float]
>     Right, I didn't realize 42. was a valid float. The space would be a
>     reasonable (beit tedious) solution. As long as this is highlighted
>     in the docs, I don't see a problem.

Why should chr be an int method in the first place? It's not tied to
ints all that much[1]. IMO it sits somewhere between ints (including
int-like objects !) and strings so it shouldn't be a method of either
class. Leaving it a function is perfectly fine, therefore, although
putting it into the string module might be a good idea. The same would
apply to ord, IMO.

   Bernhard


[1] In fact, chr today accepts any object that can be converted
successfully to an int, so that chr(42.5) does work, but that's not
always desirable.


-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
MapIt!                                           http://www.mapit.de/



More information about the Python-list mailing list