OT: why do people use python when it is slow?

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 15 16:07:38 PDT 2015


On Wednesday, 14 October 2015 at 15:25:22 UTC, David DeWitt wrote:
> On Wednesday, 14 October 2015 at 14:48:22 UTC, John Colvin 
> wrote:
>> On Wednesday, 14 October 2015 at 14:32:00 UTC, jmh530 wrote:
>>> On Tuesday, 13 October 2015 at 23:26:14 UTC, Laeeth Isharc 
>>> wrote:
>>>> https://www.quora.com/Why-is-Python-so-popular-despite-being-so-slow
>>>> Andrei suggested posting more widely.
>>>
>>> I was just writing some R code yesterday after playing around 
>>> with D for a couple weeks. I accomplished more in an 
>>> afternoon of R coding than I think I had in like a month's 
>>> worth of playing around with D. The same is true for python.
>>
>> As someone who uses both D and Python every day, I find that - 
>> once you are proficient in both - initial productivity is 
>> higher in Python and then D starts to overtake as a project 
>> gets larger and/or has stricter requirements. I hope never to 
>> have to write anything longer than a thousand lines in Python 
>> ever again.
>
> That's true until you need to connect to other systems.  There 
> are countless clients built for other systems thats are used in 
> real world applications.  With web development the Python code 
> really just becomes glue nowadays and api's.  I understand D is 
> faster until you have to build the clients for systems to 
> connect.  We have an application that uses Postgres, 
> ElasticSearch, Kafka, Redis, etc. This is plenty fast and the 
> productivity of Python is more than D as the clients for 
> Elasticsearch, Postgres and various other systems are 
> unavailable or incomplete.  Sure D is faster but when you have 
> other real world systems to connect to and time constraints on 
> projects how can D be more productive or faster?  Our python 
> code essentially becomes the API and usage of clients to other 
> systems which handle a majority of the hardcore processing.  
> Once D gets established with those clients and they are battle 
> tested then I will agree.  To me productivity is more than the 
> language itself but also building real world applications in a 
> reasonable time-frame.  D will get there but is nowhere near 
> where Python is.

Few thoughts:

1. It's easy to embed Python in your D applications.  I do this 
for things like web scraping and when I want to write something 
quick to read simple XML (I just convert to JSON).

2. Of course there is a Redis client.  Elasticsearch is an 
amazing product, but hardly requires much work to have a complete 
API.  I made a start on this, and if I use Elasticsearch more 
then I'll have one done and will release it.  I don't know the 
finer aspects of Postgres to know what is involved.

3. That raises a broader point, which is that it depends on the 
ultimate aim of your project and what it is about the right 
tradeoff between different things.  It will ultimately be much 
more productive for me to do things in D for the reasons John 
alludes to.  A little work to get started is neither here nor 
there in the major scheme of things.  Adam Ruppe made the same 
point - it's not all that much work to put a foundation that 
suits you in place.  You do it once (and maybe add things when 
something like Elasticsearch comes out), and that's it, apart 
from minor updates.  The dollar expenditure on building these 
things is not enormous given the stakes involved for me.  But 
that doesn't mean that you should get to the same answer, as it 
depends.

4. I am not sure that all web development is just glue, or will 
be going forward given what might be on the horizon, but time 
will tell.


Laeeth.




More information about the Digitalmars-d-learn mailing list