[Patches] [ python-Patches-662433 ] Fill arraymodule's tp_iter and sq_contains slots
SourceForge.net
noreply@sourceforge.net
Mon, 06 Jan 2003 16:47:32 -0800
Patches item #662433, was opened at 2003-01-05 02:54
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=662433&group_id=5470
Category: Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Christian Tismer (tismer)
Summary: Fill arraymodule's tp_iter and sq_contains slots
Initial Comment:
Small speedup no change in API.
----------------------------------------------------------------------
>Comment By: Christian Tismer (tismer)
Date: 2003-01-07 01:47
Message:
Logged In: YES
user_id=105700
On Raymond's request, I reviewed this patch thorougly.
The patch correctly implements the iterator protocol for
array objects.
I did a line-by-line comparison to the according code in the
listobject.c file, after actualizing my CVS snapshot.
The implementation looks *very* clean and accurate to me.
Just two tiny comments:
- There is a space/tab glitch in array_iter at
it = PyObject_GC_New(arrayiterobject,
&PyArrayIter_Type);
- comparison of similar iterator implementations across
modules would be further simplified, if the methods were
always written in the same order.
- if the C language had templates, this patch would be
*very* short. We shoukd consider to write a tiny template
system in Python, which creates code like this.
Conclusion:
Objectively, this patch has no obvious errors.
Subjectively, this patch obviously has no errors.
I am +1 on applying it now, and I will help if I was wrong
about its correctness.
sincerely -- chris
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2003-01-06 16:03
Message:
Logged In: YES
user_id=6380
I have no time to review this code, but I'm +1 on doing this.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2003-01-05 21:59
Message:
Logged In: YES
user_id=80475
New patch has test code and fills both the tp_iter and
sq_contains slots.
Matches what we've already done for listobjec,
tupleobject, and rangeobject to improve their performance.
----------------------------------------------------------------------
Comment By: Brett Cannon (bcannon)
Date: 2003-01-05 03:43
Message:
Logged In: YES
user_id=357491
Code looks sound to me. The only thing I think it is
missing is tests for the testing suite.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=662433&group_id=5470