While the idea behind PEP 424 is sound, the text of the PEP is rather vague and 
missing a lot of details.
There was extended discussion on the details, but none of that has appeared in 
the PEP yet.

So Alex, how about adding those details?

Also the rationale is rather poor.
Given that CPython is the reference implementation, PyPy should be compared to 
CPython, not vice-versa.
Reversing PyPy and CPython in the rationale gives:

'''
Being able to pre-allocate lists based on the expected size, as estimated by 
__length_hint__,
can be a significant optimization.
PyPy has been observed to run some code slower than CPython, purely because 
this optimization is absent.
'''

Which is a PyPy bug report, not a rationale for a PEP ;)

Perhaps a better rationale would something along the lines of:

'''
Adding a __length_hint__ method to the iterator protocol allows sequences, 
notably lists,
to be initialised from iterators with only a single resize operation.
This allows sequences to be intialised quickly, yet have a small growth factor, 
reducing memory use.
'''

Cheers,
Mark.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to