Conditional operator in Python?

Neelakantan Krishnaswami neelk at alum.mit.edu
Wed Apr 4 08:16:06 EDT 2001


On Wed, 4 Apr 2001 09:33:07 +0200, Alex Martelli <aleaxit at yahoo.com> wrote:
>
> I suspect spaces (or underscores?) within _numeric literals_ might
> prove more popular -- I'd LOVE to be able to write, e.g.:
>
>    a = 1 000 000 000
>
> to make the number "one billion" more legible -- but maybe it's not
> as good an idea as it seems at first glance: if the number of digits
> between separating spaces was not checked, it might be misleading;
> if it WAS checked, then I'm not sure that "three by three" is OK in
> all locales (but maybe non-US locales need not be supported here,
> just as they aren't, for example, for decimal-point).

I agree about commans, but I don't like using spaces; Ada's solution
of permitting underscores '_' inside numeric literals is a nice
compromise between the limitations of ASCII and the limitations of
human readers.

So the above might be written

  a = 1_000_000_000

which is fairly readable and culture non-specific. (Though using
commas as decimal-points is even more brain-damaged than using
periods, which just shocks me -- what's that about fine European
design again? ;)


Neel



More information about the Python-list mailing list