[Patches] [ python-Patches-559833 ] Expose xrange type in builtins
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 05 Jun 2002 16:16:24 -0700
Patches item #559833, was opened at 2002-05-23 15:52
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=559833&group_id=5470
Category: Core (C code)
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Raymond Hettinger (rhettinger)
Summary: Expose xrange type in builtins
Initial Comment:
The attached patch to rangeobject.c and bltinmodule.c exposes the
xrange type in te builtins module instead of a function. The test suite
passes. The one obvious problem I'm aware of is that I simply copied
get_len_of_range from bltinmodule.c, so it's now duplicated (it's used
by range_new() as well). I didn't want to create another _Py_*
symbol just to share this little bit of code. I'll be happy to resolve this
problem however seems best.
Skip
----------------------------------------------------------------------
>Comment By: Raymond Hettinger (rhettinger)
Date: 2002-06-05 18:16
Message:
Logged In: YES
user_id=80475
Done.
Committed as:
rangeobject.c 2.39
bltinmodule.c 2.258
types.py 1.28
test_b2.py 1.35
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2002-06-05 15:20
Message:
Logged In: YES
user_id=6380
Raymond, I now approve of this patch. Can you integrate it
with the rest of your xrange work?
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2002-05-24 14:09
Message:
Logged In: NO
The xrange type should be as minimalistic as possible,
so making it subclassable is not high on my list.
--Guido (not logged in)
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2002-05-24 05:55
Message:
Logged In: YES
user_id=80475
Looks good. Compiles okay on Win32. Regression tests
(personal testfarm and python standard) run fine.
Consider changing the line in types.py (even if it is going to
be deprecated) from, XRangeType = type(xrange(0)), to
XRangeType=xrange.
Also, do you want to go all the way with this one and
make the type subclassable like we did with enumerate()?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=559833&group_id=5470