[issue16694] Add pure Python operator module

Zachary Ware report at bugs.python.org
Thu Dec 20 02:25:22 CET 2012


Zachary Ware added the comment:

Sorry to have disappeared on this, other things took priority...

Thank you for the comments, Serhiy.  v2 of the patch renames Modules/operator.c to Modules/_operator.c, and changes that name every place I could find it.

I also tried to tidy up some of the error message mismatches.  I didn't bother with the ones regarding missing arguments, as that would mean checking args and throwing an exception in each and every function.

I do like the functional attrgetter better than the object version I wrote.  The main reason I went with an object version in the first place was because that's what the C implementation used.  Is there any reason not to break with the C implementation and use a function instead?  The updated patch takes a rather ugly hack to try to use the functional version in an object.

length_hint() was horrible and has been rewritten.  It should be less horrible now :).  It should also follow the C implementation quite a bit better.

----------
Added file: http://bugs.python.org/file28373/py_operator.v2.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16694>
_______________________________________


More information about the Python-bugs-list mailing list