Options for a long term fix of the special case for float/int/complex

Is the process linked in the post you responded to not sufficient? If not, what policy states that it isn’t?

Right now there’s another change to the behavior of this special case being considered which changes the meaning of pep 484. This change has not received the same backlash from the same people. Some people are phrasing it as only a clarification, but it changes the behavior and the thread has examples of it being or enabling a behavioral change in the very first post.

It was also determined that TypeGuard wasn’t incorrectly specified; Users just wanted a something with other behavior.The better parallel was already shared by someone else, where things were broken on implicit optional with function parameter defaults, being changed to match what the user wrote rather than infer something beyond what they wrote in a way they could not opt out of.

The float special case on the other hand is just wrong. Int isn’t a suitable replacement when expecting a float, and the shortcut that exists in the type system is unsound.


Unfortunately, due to the slowmode still here, I need to post all ideas, even unrelated ones at once:

I did find a place where we can choose to be more lax:

Some type checkers early bind on inference

x = 1
x = x / 2

With the changes suggested in 1 here, any type checker early binding on inference of numeric types might have type checkers wanting to change how their inference works to either not early bind, or early bind in a permissive form, but allow specifying a more specific form that would be respected.

2 Likes