Message232512
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. |
|
Date |
User |
Action |
Args |
2014-12-12 06:36:09 | zach.ware | set | recipients:
+ zach.ware, rhettinger, pitrou, serhiy.storchaka, Antony.Lee, josh.r |
2014-12-12 06:36:09 | zach.ware | set | messageid: <1418366169.5.0.39187198415.issue22955@psf.upfronthosting.co.za> |
2014-12-12 06:36:09 | zach.ware | link | issue22955 messages |
2014-12-12 06:36:08 | zach.ware | create | |
|