python vs d

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 28 02:27:32 PDT 2014


On Monday, 28 April 2014 at 09:10:53 UTC, Chris wrote:
> On Thursday, 24 April 2014 at 06:38:42 UTC, Suliman wrote:
>> I am following discussions about GC and some other 'critical' 
>> improves in D language for a long time. I see a lot of 
>> arguments and heaps of code, that often hard to understand 
>> (for example Templates) even more complicated to use it.
>>
>> I like D, but more and more I am playing with Python, and 
>> understanding it's philosophy. And I like it because it's do 
>> not have any overhead like C++. It's clean any easy to 
>> understanding. As result it's harder to write bad code in it.
>>
>> Does anybody make tests of speed most common algorithm in D 
>> and Python. I am trying to understand which project better to 
>> start in Python and which in D.
>
> In my experience, it is better to start a new project with D, 
> not only because of speed. As a project grows, the restrictions 
> of Python become more apparent (and annoying). If copyright is 
> an issue, D is the better option, too. Python can be decompiled 
> easily. I don't know what kind of projects you have in mind, 
> but in our projects Python is always the bottleneck and has to 
> be rewritten in a different language anyway, sooner or later.

My experience mirrors this exactly. I find Python quite quickly 
becomes unwieldy for large projects, even if the performance is 
not an issue.

As with all these things, YMMV; there are many large, successful 
Python projects.


It is pretty good for interactive work, especially if you can 
leverage the large body of work that the scientific community has 
produced in python.


Choosing between D and Python:

Pretty much anything written in pure Python can be easily 
demolished by D in terms of performance.

D doesn't have much provision for interactive work (work in 
progress).

You can do 2-way communication between D and Python 
(https://bitbucket.org/ariovistus/pyd)

Fast algorithms that you use in Python are often implemented in C 
as extensions. D can call C code directly. C vs D is very much 
splitting hairs when it comes to performance.

D has a steeper learning curve, but it will teach you widely 
applicable knowledge and skills.


More information about the Digitalmars-d mailing list