[python-users] Fiese Falle
Christopher Arndt
chris.arndt at web.de
So Jun 12 23:23:37 CEST 2016
Am 12.06.2016 um 23:14 schrieb Michael Kesper:
> Erwartet hätte ich eigentlich eine TypeError Exception.
Wieso gehst du davon aus, dass min/max nur nur Zahlentypen akzeptieren?
"""
min(iterable, *[, key, default])
min(arg1, arg2, *args[, key])
Return the smallest item in an iterable or the smallest of two or more
arguments.
"""
Für mich heißt das, dass min/max alle Objekte akzeptieren, die
sortierbar sind.
Siehe auch:
https://docs.python.org/3/reference/expressions.html#value-comparisons
https://docs.python.org/3/reference/datamodel.html#object.__lt__
Chris
Mehr Informationen über die Mailingliste python-users