Re: Underscores in Python numbers
- From: Mike Meyer <mwm@xxxxxxxxx>
- Date: Sat, 19 Nov 2005 23:08:38 -0500
Steven D'Aprano <steve@xxxxxxxxxxxxxxxxxxxxxx> writes:
> On Sat, 19 Nov 2005 13:08:57 -0500, Peter Hansen wrote:
>> Umm... in other words, "the underscore is under-used so let's assign
>> some arbitrary meaning to it" (to make the language more like Perl
>> perhaps?).
>
> +1
>
> I *really* don't like the idea of allowing underscores in numeric
> literals. Firstly, for aesthetic reasons: I think 123_456 is seriously
> ugly. Secondly, for pragmatic reasons, I think it is too easy to mistype
> as 123-456. I know that Python can't protect you from typing 9-1 instead
> of 901, but why add special syntax that makes that sort of error MORE
> common?)
I've seen at least one language (forget which one) that allowed such
separators, but only for groups of three. So 123_456 would be valid,
but 9_1 would be a syntax error. This kind of thing might help with
the detecting typos issue, and probably won't be noticed by most
users.
<mike
--
Mike Meyer <mwm@xxxxxxxxx> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
.
- Follow-Ups:
- Re: Underscores in Python numbers
- From: Eric Jacoboni
- Re: Underscores in Python numbers
- From: Roy Smith
- Re: Underscores in Python numbers
- References:
- Re: Underscores in Python numbers
- From: bonono@xxxxxxxxx
- Re: Underscores in Python numbers
- From: Steven D'Aprano
- Re: Underscores in Python numbers
- From: bearophileHUGS
- Re: Underscores in Python numbers
- From: Peter Hansen
- Re: Underscores in Python numbers
- From: Steven D'Aprano
- Re: Underscores in Python numbers
- Prev by Date: Re: what happens when the file begin read is too big for all lines to be read with "readlines()"
- Next by Date: Delays getting data on sys.stdin.readline() ?
- Previous by thread: Re: Underscores in Python numbers
- Next by thread: Re: Underscores in Python numbers
- Index(es):
Relevant Pages
|