From D

Eric_Dexter at msn.com Eric_Dexter at msn.com
Tue Jul 24 19:26:35 EDT 2007


On Jul 24, 5:19 am, bearophileH... at lycos.com 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.
>
> 2) Base 2 number literals, and base 2 "%b" printing with the writefln.
> Base-2 numbers are less common in Python code, but once in a while I
> use them. For example:
> import std.stdio;
> void main() {
>   auto x = 0b0100_0011;
>   writefln("%b", x);
>   writefln("%.8b", x);
>   writefln(x);}
>
> Prints:
> 1000011
> 01000011
> 67
>
> 3) All string literals are multi line. So you can write:
> a = "how are
> you";
> There's no need for """ """.
>
> 4) With D I have created an xsplit() generator, and from my tests it's
> quite faster than the split(), expecially if the string/lines you want
> to split are few hundred chars long or more (it's not faster if you
> want to split very little strings). So I think Python can enjoy such
> string method too (you can probably simulate an xsplit with a regular
> expression, but the same is true for some other string methods too).
>
> Bye,
> bearophile


I think there is a language bridge so that you can compile d for
python..  looks realy easy but I have python 2.5 and panda and it
try's to go for the panda instalation.  It looks much easier than c to
use with python in fact..  I don't know if that would change the speed
of it
though to be in a library.

https://sourceforge.net/projects/dex-tracker




More information about the Python-list mailing list