[issue2690] Precompute range length and enhance range subscript support

2010-12-17 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

Doc change committed to py3k in r87346.  Thanks, SilentGhost!

I also committed r87349 to reverse r87162 (which was in the wrong branch).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-11 Thread SilentGhost

SilentGhost  added the comment:

here is the patch for the py3k docs.

--
Added file: http://bugs.python.org/file20021/stdtypes.rst.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

No, I believe it was added as part of the .index() and .count() implementation.

Checking the source, there's definitely no sq_contains implementation in 3.1 or 
2.7.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-10 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Is the in/not-in fast path in 2.7?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

The other major change for ranges is that "in" and "not in" are no longer 
inefficient for actual instances of int (it does an arithmetic calculation 
instead of a linear search).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-10 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Applied in r87162

--
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-10 Thread SilentGhost

SilentGhost  added the comment:

Not sure this worth a patch, to me it looks like a removal of a single word. 
But here it goes anyway.

--
nosy: +SilentGhost
Added file: http://bugs.python.org/file20003/stdtypes.rst.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-03 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

The descriptions of range's limitations in the docs still needs an update.

--
assignee: georg.brandl -> ncoghlan
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-03 Thread Georg Brandl

Georg Brandl  added the comment:

I'm fine with it: as with the other changes for .count and .index, consistency 
with the protocols/ABCs the types are members of is not exclusively a new 
feature.

--
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-03 Thread Nick Coghlan

Nick Coghlan  added the comment:

(Oops, didn't mean to reclose this yet)

I want to wait for Georg's verdict on including the functionality in 3.2 before 
stressing too much about correct documentation of it :)

--
assignee:  -> georg.brandl
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-03 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

> The descriptions of range's limitations there is no longer accurate
> (slicing is supported following this patch and containment testing is
> now efficient)

Want to open a new issue for that?  (or is there one already?)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-03 Thread Nick Coghlan

Nick Coghlan  added the comment:

Daniel Stutzbach pointed out that range() is also mentioned under:
http://docs.python.org/dev/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range

The descriptions of range's limitations there is no longer accurate (slicing is 
supported following this patch and containment testing is now efficient)

--
assignee: georg.brandl -> 
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-03 Thread Nick Coghlan

Nick Coghlan  added the comment:

On Sat, Dec 4, 2010 at 2:26 AM, Daniel Stutzbach  wrote:
>
> Daniel Stutzbach  added the comment:
>
>> (I also noticed that the new methods from issue #9213 are not mentioned
>> in the range() docs
>
> Wasn't that fixed in Issue9746?

Ah, I see what you mean. I was more referring to the lack of a
versionchanged note on the range() documentation itself, rather than
the mentioning of range() under the sequence types documentation.

Some of my new additions to the range documentation could probably be
deleted and replaced with a reference to that part of the docs.

Cheers,
Nick.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-03 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

> (I also noticed that the new methods from issue #9213 are not mentioned
> in the range() docs

Wasn't that fixed in Issue9746?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2690] Precompute range length and enhance range subscript support

2010-12-03 Thread Nick Coghlan

Nick Coghlan  added the comment:

I brought the patch up to date for the Py3k branch, but realised just before 
checking it in that it may run afoul of the language moratorium (since it 
alters the behaviour of builtin range objects).

However, the .count() and .index() methods (along with the Sequence ABC 
registration) as well as the O(1) containment testing for integers were already 
put in place. (I also noticed that the new methods from issue #9213 are not 
mentioned in the range() docs, unlike the O(1) optimisation)

I've gone ahead and checked it in as r86970, as I see this patch as filling out 
the promise of the Sequence ABC registration by adding support for slicing and 
negative indices (with the length caching as more of an implementation detail).

However, I'm also leaving the tracker issue open and assigning to Georg in case 
he wants to revert it before the beta goes out.

Note that I also fixed the patch so that OverflowError occurs only when 
encountering an affected operation (primarily indexing and retrieval of the 
length). If you don't do any of those things, you can make your ranges as large 
as you like. (The indexing could fairly easily be fixed to eliminate the 
overflow errors - I just didn't do it in this patch, since it is a separate 
problem).

--
assignee:  -> georg.brandl
nosy: +georg.brandl
resolution:  -> accepted
stage: patch review -> committed/rejected
title: Precompute range length -> Precompute range length and enhance range 
subscript support
Added file: http://bugs.python.org/file19926/issue2690_lazy_overflow_check.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com