Zachary Ware added the comment:

Serhiy: functools.partial is a somewhat less than ideal comparison.  The 
pure-Python version is not picklable, the Python and C versions return 
different things (the Python version is a function returning a function, the C 
version is a regular class and returns an instance).  Also, both versions make 
their necessary attributes public anyway, unlike methodcaller.

Raymond: Not necessarily the usual approach, no.  However, I think my 
reimplementations of the pure-Python itemgetter and attrgetter have a few 
benefits, namely:
- they're somewhat less complex and thus a bit easier to understand
- they're slightly faster
- they don't require extra pickling methods, which to me just seem like clutter 
when it's so simple to not need them

Note that I have no intention of reimplementing the C versions: those are much 
more mature than the Python versions, and would likely require pickling methods 
anyway.

All that said, I'm not going to fight about it; if I'm overruled, I'm overruled.

Josh: Serhiy's points about needing more tests stand; would you like to add 
them?  You can use your patch or mine as a base, depending on how you feel 
about reimplementing the pure-Python (item|attr}getter.  If you use yours, 
please remember to look through my comments on it.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22955>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to