[Python-bugs-list] [ python-Bugs-807771 ] Max and min are incorrect
with one argument
SourceForge.net
noreply at sourceforge.net
Wed Sep 17 07:49:10 EDT 2003
Bugs item #807771, was opened at 2003-09-17 11:49
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=807771&group_id=5470
Category: Python Library
Group: Python 2.2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Greg Kochanski (gpk)
Assigned to: Nobody/Anonymous (nobody)
Summary: Max and min are incorrect with one argument
Initial Comment:
max(1)
raises 'TypeError: iteration over non-sequence',
when it should simply return 1
Min has the same problem.
If there is one person in a room, and you ask for the
tallest person, there is a well-defined answer.
The tallest person is the only person.
So is the shortest person.
I ran across this when I was doing
apply(max, list) / apply(min, list)
to find out the ratio of maximum to minimum entries
in a list. With a single-element list, I expected
it to return 1, instead of raising an exception.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=807771&group_id=5470
More information about the Python-bugs-list
mailing list