[issue16694] Add pure Python operator module

Zachary Ware report at bugs.python.org
Fri Dec 21 22:05:46 CET 2012


Zachary Ware added the comment:

Here's another new version.  Changes include:

- Address Serhiy's Rietveld comments
- Fix length_hint() the way it was meant to be fixed last time.
- Remove __getitem__ check on 'b' in concat and iconcat.  More notes on this below.
- Fix methodcaller as Serhiy suggested
- Add test case for methodcaller for 'name' and 'self' keyword arguments
- Add comments to 'subdivide' the module into the rough sections the docs are divided into.  Move length_hint() with other sequence operations to also match the doc order.

On concat and iconcat: Looking at the glossary, a sequence should actually have both __getitem__ and __len__.  The test class in the test case for iconcat only defines __getitem__, though.  Should we check only for __getitem__ on the first argument, or check for both __getitem__ and __len__, and add __len__ to the test class?  Requiring __len__ may cause breakage for anyone using the Python implementation with a class they defined and used with the C implementation with only __getitem__, so I'm leaning towards only checking for __getitem__.  I can't really tell what the C implementation really looks for as I don't speak C, but it almost looks to me like it may be only checking for __getitem__.  Latest patch only checks argument 'a' for __getitem__.

----------
Added file: http://bugs.python.org/file28388/py_operator.v5.diff

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


More information about the Python-bugs-list mailing list