Scott David Daniels wrote:
> Kent Johnson wrote:
>> In Python 2.5 you can do this with operator.attrgetter():
>> L.sort(key=operator.attrgetter('whatever', 'someother', 'anotherkey'))
>
> Note: this is also available in Python 2.4
No, the ability to specify more than one attribute name, making a getter
that returns a tuple, is a Python 2.5 enhancement. In 2.4:
In [1]: import operator
In [2]: operator.attrgetter('whatever', 'someother', 'anotherkey')
------------------------------------------------------------
Traceback (most recent call last):
File "<ipython console>", line 1, in ?
TypeError: attrgetter expected 1 arguments, got 3
Kent
--
http://mail.python.org/mailman/listinfo/python-list