accept @pure @nothrow @return attributes

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 28 05:58:18 PST 2015


Ola Fosheim Grøstad:

> [0.1*x for x in range(10)]
>
> map(operator.mul,range(10),[0.1]*10)
>
> numpy.arange(0.,0.95,0.1)
>
> numpy.linspace(0,0.9,num=10)
>
> list(itertools.islice(itertools.count(0.0, 0.1), 10))

The first one (the list comp) is Pythonic, and it's obviously the 
obvious one :-)

If you want/need to use numpy, the fourth is good.

No problems :-)

Bye,
bearophile


More information about the Digitalmars-d mailing list