The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

Chris Angelico rosuav at gmail.com
Thu Mar 24 10:01:43 EDT 2016


On Fri, Mar 25, 2016 at 12:50 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Thu, 24 Mar 2016 02:24 pm, Chris Angelico wrote:
>
>
>> This is how you're currently evaluating Python. Instead of starting
>> with the most simple and obvious code
>
> One problem is that what counts as "simple and obvious" depends on what you
> are used to. Coming from a background of Pascal, iterating over a list like
> this:
>
> for i in range(len(mylist)):
>     print mylist[i]
>
> was both simple and obvious. It took me years to break myself of that habit.
>
> Likewise clearing a list:
>
> for i in range(len(mylist)-1, -1, 0):
>     del mylist[i]
>
>
> Fortunately I didn't need to do that very often.
>
> The point is that you, like most of the prominent posters here, have many
> years of experience in programming in Python. How do you expect Bart to
> come up with the same "simple and obvious" code as you?

I don't, until it's pointed out. At that point, someone who respects
the language will at least pay *some* heed to the changed
recommendations; what we're seeing here is that he continues to use C
idioms and then complain that Python is slow. I don't expect him to
magically know what Python idioms are, but when the thread has gone on
this long and he's still showing the same style of code, that's when I
start to agree with Ben that he's not paying heed to Pythonic vs
non-Pythonic.

ChrisA



More information about the Python-list mailing list