Powered by Tachyonic Project Luxon Framework v1.2.1

Luxon Framework for rapid application development. (luxon)



Modified itemgetter

luxon.utils.sort.Itemgetter(item, *items)[source]

itemgetter that caters for items that are ‘None’

Return a callable object that fetches the given item(s) from its operand. After f = itemgetter(2), the call f(r) returns r[2]. After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])

When using itemgetter as the key when sorting, Python3 can not compare values to NoneTypes. This version of itemgetter returns “” whenever a value of None is present.