On 2011-12-20, at 11:08 , Antoine Pitrou wrote: > But that's basically the only reason to invoke the > `operator.attrgetter("foo")` ugliness, instead of writing the explicit > and obvious `lambda x: x.foo`. I don't agree with this, an attrgetter in the current namespace can be clearer than an explicit lambda in place, and more importantly when trying to fetch more than one attribute attrgetter is far superior to lambdas as far as I'm concerned.
I don't think I've ever seen `attrgetter` (or any of the other `operator` functions) advocated on basis of speed. This mention does not even exist in the Python 2 docs, which does not prevent people from using `operator`. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com