newbie seeks advise.

dwelch dwelch91 at nospam.attbi.com
Sat Sep 21 01:31:53 EDT 2002


Erik Max Francis wrote:
> dwelch wrote:
> 
> 
>>Simple way, probably not optimal:
>>
>> >>> max_element = max(list(data))
>> >>> max_element
>>74
>>
> 
> max works on any sequence, there's no need to preconvert the tuple to a
> list.
> 
> 

Yes, of course you are correct (that would be inconceivably inconsistent 
for Python). However, when I first looked at using max() with a tuple on 
2.2.1 on WinXP, it didn't work. I got a TypeError stating that max() 
requires a sequence type. Now, I am trying it on Mandrake 8.2 with 
2.2.1, it and it works. Hmmmm.. not sure what is going on here, I will 
have to double check when I am on my XP box again.

Don




More information about the Python-list mailing list