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
Status: Draft
Type: Standards Track
Content-Type: text
2012/7/14 Alex Gaynor :
>
> 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 value that is
On Sat, Jul 14, 2012 at 4:18 PM, Benjamin Peterson wrote:
> 2012/7/14 Alex Gaynor :
> >
> > Proposal
> >
> >
> > This PEP proposes formally documenting ``__length_hint__`` for other
> > interpreter and non-standard library Python to implement.
> >
> > ``__length_hint__`` must return an in
On Sat, Jul 14, 2012 at 4:21 PM, Alex Gaynor wrote:
>
>
> On Sat, Jul 14, 2012 at 4:18 PM, Benjamin Peterson
> wrote:
>>
>> 2012/7/14 Alex Gaynor :
>> >
>> > Proposal
>> >
>> >
>> > This PEP proposes formally documenting ``__length_hint__`` for other
>> > interpreter and non-standard lib
2012/7/14 Alex Gaynor :
>
>
> On Sat, Jul 14, 2012 at 4:18 PM, Benjamin Peterson
> wrote:
>>
>> 2012/7/14 Alex Gaynor :
>> >
>> > Proposal
>> >
>> >
>> > This PEP proposes formally documenting ``__length_hint__`` for other
>> > interpreter and non-standard library Python to implement.
>>
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
On Sun, Jul 15, 2012 at 9:18 AM, Benjamin Peterson 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 some
On Sat, Jul 14, 2012 at 10:16 PM, Nick Coghlan wrote:
> On Sun, Jul 15, 2012 at 9:18 AM, Benjamin Peterson
> wrote:
> >> Open questions
> >> ==
> >>
> >> There are two open questions for this PEP:
> >>
> >> * Should ``list`` expose a kwarg in it's constructor for supplying a
> length