From D

Leo Petr leons.petrazickis at gmail.com
Thu Jul 26 11:39:21 EDT 2007


On Jul 24, 10:10 am, Stargaming <stargam... at gmail.com> wrote:
> On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote:
> > There are various things I like about the D language that I think Python
> > too may enjoy. Here are few bits (mostly syntactical ones):
>
> > 1) (we have discussed part of this in the past) You can put underscores
> > inside number literals, like 1_000_000, the compiler doesn't enforce the
> > position of such underscores, so you can also put them like this:
> > 1_00_000. You can put them in literals of decimals, binary, hex, etc. I
> > think it's quite useful, because when in Python code I have a line like:
> > for i in xrange(1000000):
> > I need some time to count the zeros, because the lower levels of my
> > visual systems can't count/group them quickly (perceptually). While in a
> > syntax like:
> > for i in xrange(1_000_000):
> > my eyes help me group them at once.
>
> Sounds like a good thing to be but the arbitrary positioning doesnt make
> any sense. Additionally, I'd suggest 10**n in such cases (eg. 10**6).
>

http://blogs.msdn.com/oldnewthing/archive/2006/04/17/577483.aspx

Digits are grouped in 2s in India and in 4s in China and Japan.

Regards,

Leons Petrazickis
http://lpetr.org/blog/




More information about the Python-list mailing list