User talk:JimD: Difference between revisions

(Maximal Value calculations and the first value.)
 
Line 9:
== Maximal Value ==
I see what you are getting at, but you want to set a flag for first value then set the minimum or maximum to be the first value rather than some sentinel value which could change over time. on reading subsequent values you do the comparison to update the minimal/maximal value appropriately. Unfortunately I am away from Python at the moment so cannot update your addition. --[[User:Paddy3118|Paddy3118]] 15:57, 26 November 2008 (UTC)
 
Thinking a bit more,
max(stream, key=int)
Might do for your case too (assuming the stream returns character representations of integers). If you want error handling on the conversion to ints then you could write a custom key function --[[User:Paddy3118|Paddy3118]] 16:09, 26 November 2008 (UTC)
Anonymous user