Georg Brandl ge...@python.org added the comment:
I am -1 on adding new methods to builtins in bugfix releases.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9213
___
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment:
Sounds reasonable to me. I'll close this and the related 9212 (both fixes are
already committed to the py3k branch).
--
stage: patch review - committed/rejected
status: open - closed
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment:
Committed as r84791.
Question: should this bugfix be backported to Python 3.1 and to xrange objects
in Python 2.7? Since it's a bugfix that adds new methods, it's a gray-area.
(same question applies to the closely related
Georg Brandl ge...@python.org added the comment:
I'd like to have this in 3.2.
--
nosy: +georg.brandl
priority: high - critical
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9213
___
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment:
Thanks, Georg, for prodding. As a new committer, I have possibly been erring a
little too far on the side of having my patches thoroughly reviewed before
committing.
I'll commit the patch on Monday if no one raises
Daniel Urban urban.dani...@gmail.com added the comment:
Attached is a greatly revised patch, with two significant changes:
- Adds support for !PyLong_CheckExact (using _PySequence_IterSearch)
Thanks, indeed, we should support that.
Any strong feelings on whether range.index should support
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment:
Thank you for the patch.
The patch doesn't handle the case where the object being searched for is
!PyLong_CheckExact. For example, the user might pass in a sub-type of int.
The existing range_contains supports that case, so
Éric Araujo mer...@netwok.org added the comment:
I can’t comment on C code, but the tests look good to me.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9213
___
Changes by Guido van Rossum gu...@python.org:
--
nosy: -gvanrossum
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9213
___
___
Python-bugs-list
Raymond Hettinger rhettin...@users.sourceforge.net added the comment:
I support adding index() and count() to range objects.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9213
___
Daniel Urban urban.dani...@gmail.com added the comment:
Sorry, the previous patch has a reference leak. I'm attaching the fixed patch
as issue9213a.diff (I also added a few tests with really big ranges).
--
Added file: http://bugs.python.org/file18128/issue9213a.diff
Daniel Urban urban.dani...@gmail.com added the comment:
The attached patch adds the range.count and range.index methods.
Pseudocode for the two method:
def count(self, ob):
if ob in self:
return 1
else:
return 0
def index(self, ob, start=0, stop=len(self)):
if ob in
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +gvanrossum, mark.dickinson, rhettinger
stage: unit test needed - patch review
versions: -Python 2.6, Python 2.7, Python 3.1
___
Python tracker rep...@bugs.python.org
Changes by Éric Araujo mer...@netwok.org:
--
nosy: +merwok
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9213
___
___
Python-bugs-list mailing
Changes by Raymond Hettinger rhettin...@users.sourceforge.net:
--
priority: normal - high
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9213
___
New submission from Daniel Stutzbach dan...@stutzbachenterprises.com:
isinstance(range, collections.Sequence)
True
[method for method in set(dir(collections.Sequence)) - set(dir(range(1)))
if not method.startswith('_')]
['index', 'count']
--
assignee: stutzbach
components:
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment:
In Python 2.6 and 2.7, the same problem applies to xrange objects.
--
versions: +Python 2.6, Python 2.7
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9213
17 matches
Mail list logo