Python and the need for speed

Steven D'Aprano steve at pearwood.info
Thu Apr 13 02:32:22 EDT 2017


On Wed, 12 Apr 2017 14:38:52 +0100, Ben Bacarisse wrote:

> Steve D'Aprano <steve+python at pearwood.info> writes:
> 
>> On Wed, 12 Apr 2017 03:39 am, Paul Rubin wrote:
>>
>>> I still do my everyday stuff in Python and I'd like to get more
>>> conversant with stuff like numpy, but it feels like an old-fashioned
>>> language these days.
>>
>> "Old fashioned"? With await/async just added to the language, and type
>> annotations? And comprehensions and iterators?
>>
>> Admittedly type annotations are mostly of interest to large projects
>> with many developers and a huge code base. But the rest?
>>
>> Comprehensions may have been around for a decade or two in Haskell, but
>> most older languages don't have them. I'm pretty sure Java doesn't.
>> Does Javascript? Comprehensions feel like a fancy new language feature
>> to me.
> 
> They've been in in Haskell for nearly three decades, but they were
> around before that.  Miranda had them, as did Miranda's immediate
> predecessor, KRC.  KRC dates from about 1980, so if you've been using
> that lineage of languages, list comprehensions have been a standard
> feature for 37 years.  I've been using them almost my entire programming
> life.


Indeed, and this is a very common phenomenon: features which "ordinary" 
programmers imagine are "trendy" and new end up having their roots in 
some functional language dating back to the 1980s, or 70s, or in extreme 
cases the 1950s and Lisp.

That's what I meant: even though Haskell has had comprehensions for 
decades, they haven't hit "mainstream" procedural languages (Java, 
Javascript, C) at all or until recently. Python's had them for a decade 
or more (how time flies...) but they still to this day get reactions from 
many Python programmers like

"I don't get these fancy new list comprehensions, what's wrong with an 
old-fashioned for-loop?"


(not quoting anyone in particular, although Bart did specifically mention 
he didn't grok comprehensions).


> It seems odd that ECMAScript (the JavaScript standard) does not have
> them, but then JS seems to hide its function nature under an imperative
> bushel.
> 
> Just another perspective...


Thanks. I knew comprehensions have been around for a while, I didn't 
realise they went back to Miranda and even older.



-- 
Steve


More information about the Python-list mailing list