Looping [was Re: Python and the need for speed]

bartc bc at freeuk.com
Sun Apr 16 09:57:38 EDT 2017


On 16/04/2017 13:22, Rustom Mody wrote:
> On Sunday, April 16, 2017 at 5:36:28 PM UTC+5:30, bartc wrote:
>> On 16/04/2017 03:51, Steve D'Aprano wrote:
>>> On Sat, 15 Apr 2017 10:17 pm, bartc wrote:
>>
>>>> Yes, I'm constantly surprised at this, as such syntax has a very low
>>>> cost (in my last compiler, supporting 'while' for example only added 30
>>>> lines to the project).
>>>
>>> That's the advantage of writing your own private language and having no
>>> users except for yourself. You get to cut corners. Python has tens of
>>> thousands of users, and doesn't have that luxury.
>>
>> Here are the lines of code in my C compiler which are necessary to
>> support 'while': https://pastebin.com/BYFV7EWr
>>
>> (45 lines shown, but there are exactly 30 Loc if blanks are excluded.)
>>
>> I'd be interested in knowing why implementing While in Python would need
>> significantly more. (The 30 Loc figure is with support for loops /in
>> general/ already in place, and is for /adding/ a new loop statement, in
>> this case 'while')
>
> You walk down a mountain path (trail in US-ese?) stopping here and there to
> smell a flower or spy a butterfly.
> Change to driving down a mountain road — quiet for the most part — is it ok
> to drive on the wrong side?
> Change to an expressway is it ok to change lanes randomly, not maintain speeds
> within upper (and lower!) limits?
>
> As others have tried to point out maintaining your own 1-man-language is one thing
> Maintaining a language
> - used by industry and academia
> - Used by FLOSS teams and commercial
> - by kids and old-hands
> - 1-man projects and large multiperson projects
>
> is quite another
>
> Dont get me wrong: I dont agree with everything about python.  And the current(est)
> mess around async (and f-strings?) is (IMHO) going to cost more dearly than people expect...
> And we will have to wait another 10 years for that decision...
>
> My point is that you dont seem to have any estimate of the difference in
> momentum between your 'its-just-another-30-lines' language and a million
> user base language

Yet countless other, far more elaborate features /are/ added all the time.

Technically, adding this one feature to Python /is/ trivial, for 
example, allowing while: as a synonym for while True:, but preferably 
using a new keyword such as loop. Nothing else needs to be touched. And 
it could have been done right at the start when the politics was simpler.

But people just don't want it.

/That/ is what surprises me, when people reject things that to me are 
no-brainers.

-- 
bartc



More information about the Python-list mailing list