Message232512
| Author |
zach.ware |
| Recipients |
Antony.Lee, josh.r, pitrou, rhettinger, serhiy.storchaka, zach.ware |
| Date |
2014年12月12日.06:36:08 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1418366169.5.0.39187198415.issue22955@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|