s the sort key
> will make sort do what you want:
>
> def SortNoneFirstAndNanLast(x):
> if x is None:
>return (1, x)
> if isnan(x):
>return (3, x)
> return (2, x)
>
> No need to modify either sort() or <.
>
> On Thu, Nov 13, 2008 at 11:15 AM, Bruce Leban <[EMAIL PR
I think the behavior of NaN in comparisons is more confusing:
>>> sorted([1,nan,2])
[1, nan, 2]
>>> sorted([2,nan,1])
[2, nan, 1]
>>> sorted([2,None,1])
Traceback (most recent call last):
File "", line 1, in
sorted([2,None,1])
TypeError: unorderable types: NoneType() < int()
At least the th
On Tue, Nov 11, 2008 at 2:00 PM, Greg Ewing <[EMAIL PROTECTED]>wrote:
> M.-A. Lemburg wrote:
>
>> On 2008-11-11 14:28, Antoine Pitrou wrote:
>>
>> But why should "n/a" (or "missing", or "undefined") imply "smaller than
>>> everything else"?
>>>
>>
>> It's just a convention based on viewing None a
On Tue, Aug 26, 2008 at 9:23 PM, James Y Knight <[EMAIL PROTECTED]> wrote:
> On Aug 27, 2008, at 12:14 AM, Chris Monson wrote:
>
>>
>> And I think that metaphor is easy to read. Chains of else operators can be
>> useful:
>>
>> x = f() else g() else h() else 0
>>
>> Not a bad idea. Looks like th
There are two issues** here:
(1) def foo(L=[]):
the [] is a single list, not a new list created every time the function is
called.
(2) def foo(L=list()):
the list() is evaluated once when the function is declared.
I think (1) is easy to explain; I find (2) confusing. (**Yes, I realize that
these
It seems somewhat illogical to require [#][sign] in that order when the
parts inserted by them go in the opposite order.
So if a specific order is required, then I think it should be reversed.
'=' padding goes in the wrong order too: perhaps -#0=20d makes more sense
than 0=-#20d. I don't find tha