Comment on draft PEP for deprecating six builtins

Roman Neuhauser neuhauser at mail.cz
Tue Apr 30 06:42:12 EDT 2002


> From: Bernhard Herzog <bh at intevation.de>
> Subject: Re: Comment on draft PEP for deprecating six builtins
> To: python-list at python.org
> Date: 30 Apr 2002 12:04:08 +0200
> 
> 
> 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.

    Ugh, that looks to me as appropriate as join() being a string
    method / module function.

> [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.

    Any object that can be converted to a character should have a chr()
    method.

-- 
FreeBSD 4.4-STABLE
12:40PM up 1 day, 3:05, 11 users, load averages: 0.00, 0.04, 0.06





More information about the Python-list mailing list