Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] Rich comparison confusion

Tim Peterstim.one@home.com
Sun, 21 Jan 2001 20:23:27 -0500


[Michael Hudson]> ...> if you meant min(a,b), then I then think the programmer who> thinks "min(a,b)" is spelt "a<b" has problems we can't be expected to> deal with (if min has a symbol it's /\, but never mind that).Curiously, in the Icon language, if a is less than b then   a < breturns b while   b > areturns a.In this way they get the same effect as Python's chained comparisons   a < b < c < dvia purely binary operators (if a is *not* less than b, a < b in Icon"fails", which is a silent event that causes the expression's context tobacktrack -- but we won't go into that here <wink>).Anyway, that accounts for this curious Icon idiom:   a <:= bwhich is short for   a := a < band binds a to max(a, b) (if a is smaller, a < b returns b and theassignment proceeds; but if a is not smaller, a < b fails and thatpropagates into its context, which here has no other possibilities tobacktrack into, so the stmt just ends leaving a alone)."<"-and-">"-are-just-bags-of-pixels-ly y'rs  - tim


[8]ページ先頭

©2009-2025 Movatter.jp