[issue1826] operator.attrgetter() should accept dotted attribute paths
report at bugs.python.org
Mon Jan 14 23:25:45 CET 2008
Scott Dial added the comment:
I want to clarify that the proposed change would break:
operator.attrgetter(foo)(bar) == getattr(bar, foo)
Which is the documented intent of the operator module: "This module
exports a set of functions implemented in C corresponding to the
intrinsic operators of Python."
Unless, you are proposing getattr grow this functionality as well. IOW,
should PyObject_GetAttr* perform this recursion? If so, should
PyObject_HasAttr*, PyObject_DelAttr*, PyObject_SetAttr* do this as well?
At the moment, it is possible to have foo's (as in above) that contain
dots despite the inability to spell that in python's dereferencing
syntax. However, I don't know that anybody does that.
Tracker <report at bugs.python.org>
More information about the Python-bugs-list