[issue44370] Inconsistent results for min() and max() with math.nan as argument

2021-06-09 Thread Joël Larose
Joël Larose added the comment: The same problem occurs if the argument is a `list`. The same inconsistency happens depending on the position in the list that `nan` happens to be. >>> max([5, nan, 3, 0, 8, -10]) 8 >>> min([5, nan, 3, 0, 8, -10]) -10 >>> min(

[issue44370] Inconsistent results for min() and max() with math.nan as argument

2021-06-09 Thread Joël Larose
Joël Larose added the comment: Forgot to mention the environment: Python version: 3.9.0 OS: Windows 10 I have not tested this on any other version of python. -- ___ Python tracker <https://bugs.python.org/issue44

[issue44370] Inconsistent results for min() and max() with math.nan as argument

2021-06-09 Thread Joël Larose
New submission from Joël Larose : If `math.nan` is the first argument for either max() or min(), the result is always `nan`, regardless of the other values in the results. However, if `nan` is in any other position in the arguments list, the result is always what you would expect if `nan

[issue43746] Weird typing annotation closure behavior

2021-04-09 Thread Joël Larose
Joël Larose added the comment: An easy workaround would be to alias your import or to import your class directly. ``` from ... import losses as l class A: losses: l.Losses = l.Losses() ``` or ``` from ...losses import Losses class A: losses: Losses = Losses() ``` -- nosy

[issue43685] __call__ not being called on metaclass

2021-03-31 Thread Joël Larose
Joël Larose added the comment: OMG! Ok, thanks guys! Switching to super().__new__ made all the difference! I can't believe I didn't think to try to change this line. Regarding the call to cast, I know it's only for type checking. Trying to write code that works checks with mypy. I

[issue43685] __call__ not being called on metaclass

2021-03-31 Thread Joël Larose
New submission from Joël Larose : Hi, I'm trying to implement a metaclass for the singleton pattern, with the intent of creating type-appropriate sentinels. After trying several approaches, I've come up with what I thought would be an elegant solution. However, I've run into a bit