This satisfies all criteria:
>>> max(1.0, float("nan"))
1.0
>>> max(float("nan"), 1.0)
nan
This is because any comparisons other than != or is with float("nan") always return false.
More generally, we can have max(a, b) != max(b, a) when the type(s) of a, b do not provide a total order. As Daniel Mesejo points out, sets have this property as well. For sets < means 'strict subset', but with {1, 2} and {3, 4} neither is a strict subset of the other, so:
>>> max({1, 2}, {3, 4})
{1, 2}
>>> max({3, 4}, {1, 2})
{3, 4}
This one technically doesn't have max(a, b) != max(b, a) because 1 == True, but there's still an observable difference:
>>> max(True, 1)
True
>>> max(1, True)
1
maxis a built-in function that takes an iterable object as input. So,a,bis the same asb,ahencemax(a,b)must equalmax(b,a)float('nan')is not a built-in type. I would assume "built-in type" would mean anything you can create without having to create a newclass.float('nan'), then why? To be clear, you're allowed to ask a question in which you exclude something likefloat('nan')if you want; that's not the problem. The problem's just that no one's sure what you're trying to ask.