Robocop wrote:

UH OH GUYS!

line 110, in sorter
    timesheets.sort(key=attrgetter("department", "engagement",
"date","start"))
TypeError: attrgetter expected 1 arguments, got 4

Um... what version of Python are you running? Alway specify. (Too many people do not). In 3.0

from operator import attrgetter
f=attrgetter("department", "engagement","date","start")

runs fine as per the doc.

operator.attrgetter(attr[, args...])
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, b.date).

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to