diff options
author | Georg Brandl <georg@python.org> | 2008-02-23 23:02:23 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-02-23 23:02:23 (GMT) |
commit | e2065c65d345866f2f88f55e68c1135a167b2077 (patch) | |
tree | 5faf4eeb488e0ee807a86ff702692a41e5fb36d4 /Doc | |
parent | b0b0317ba2d46ba38973a4c4cf24f6dec054ca38 (diff) | |
download | cpython-e2065c65d345866f2f88f55e68c1135a167b2077.zip cpython-e2065c65d345866f2f88f55e68c1135a167b2077.tar.gz cpython-e2065c65d345866f2f88f55e68c1135a167b2077.tar.bz2 |
#1826: allow dotted attribute paths in operator.attrgetter.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/operator.rst | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst index ea4d328..5527dc2 100644 --- a/Doc/library/operator.rst +++ b/Doc/library/operator.rst @@ -499,15 +499,21 @@ expect a function argument. Return a callable object that fetches *attr* from its operand. If more than one attribute is requested, returns a tuple of attributes. After, - ``f=attrgetter('name')``, the call ``f(b)`` returns ``b.name``. After, - ``f=attrgetter('name', 'date')``, the call ``f(b)`` returns ``(b.name, + ``f = attrgetter('name')``, the call ``f(b)`` returns ``b.name``. After, + ``f = attrgetter('name', 'date')``, the call ``f(b)`` returns ``(b.name, b.date)``. + The attribute names can also contain dots; after ``f = attrgetter('date.month')``, + the call ``f(b)`` returns ``b.date.month``. + .. versionadded:: 2.4 .. versionchanged:: 2.5 Added support for multiple attributes. + .. versionchanged:: 2.6 + Added support for dotted attributes. + .. function:: itemgetter(item[, args...]) |