[Python-Dev] PEP 0424: A method for exposing a length hint

2012-07-14 Thread Alex Gaynor
Hi all, I've just submitted a PEP proposing making __length_hint__ a public API for users to define and other VMs to implement: PEP: 424 Title: A method for exposing a length hint Version: $Revision$ Last-Modified: $Date Author: Alex Gaynor alex.gay...@gmail.com Status: Draft Type: Standards

Re: [Python-Dev] PEP 0424: A method for exposing a length hint

2012-07-14 Thread Benjamin Peterson
2012/7/14 Alex Gaynor alex.gay...@gmail.com: Proposal This PEP proposes formally documenting ``__length_hint__`` for other interpreter and non-standard library Python to implement. ``__length_hint__`` must return an integer, and is not required to be accurate. It may return a

Re: [Python-Dev] PEP 0424: A method for exposing a length hint

2012-07-14 Thread Alex Gaynor
On Sat, Jul 14, 2012 at 4:18 PM, Benjamin Peterson benja...@python.orgwrote: 2012/7/14 Alex Gaynor alex.gay...@gmail.com: Proposal This PEP proposes formally documenting ``__length_hint__`` for other interpreter and non-standard library Python to implement.

Re: [Python-Dev] PEP 0424: A method for exposing a length hint

2012-07-14 Thread Alexandre Zani
On Sat, Jul 14, 2012 at 4:21 PM, Alex Gaynor alex.gay...@gmail.com wrote: On Sat, Jul 14, 2012 at 4:18 PM, Benjamin Peterson benja...@python.org wrote: 2012/7/14 Alex Gaynor alex.gay...@gmail.com: Proposal This PEP proposes formally documenting ``__length_hint__`` for

Re: [Python-Dev] PEP 0424: A method for exposing a length hint

2012-07-14 Thread Benjamin Peterson
2012/7/14 Alex Gaynor alex.gay...@gmail.com: On Sat, Jul 14, 2012 at 4:18 PM, Benjamin Peterson benja...@python.org wrote: 2012/7/14 Alex Gaynor alex.gay...@gmail.com: Proposal This PEP proposes formally documenting ``__length_hint__`` for other interpreter and

Re: [Python-Dev] PEP 0424: A method for exposing a length hint

2012-07-14 Thread Terry Reedy
On 7/14/2012 6:11 PM, Alex Gaynor wrote: ... Various thoughts: This method is then used by various other functions (such +as ``map``) to presize lists -- map no longer produces lists. This only makes sense in 3.x if you mean that map can pass along the value of its inputs. Types can then

Re: [Python-Dev] PEP 0424: A method for exposing a length hint

2012-07-14 Thread Nick Coghlan
On Sun, Jul 15, 2012 at 9:18 AM, Benjamin Peterson benja...@python.org wrote: Open questions == There are two open questions for this PEP: * Should ``list`` expose a kwarg in it's constructor for supplying a length hint. * Should a function be added either to ``builtins`` or

Re: [Python-Dev] PEP 0424: A method for exposing a length hint

2012-07-14 Thread Alex Gaynor
On Sat, Jul 14, 2012 at 10:16 PM, Nick Coghlan ncogh...@gmail.com wrote: On Sun, Jul 15, 2012 at 9:18 AM, Benjamin Peterson benja...@python.org wrote: Open questions == There are two open questions for this PEP: * Should ``list`` expose a kwarg in it's constructor for