Beta

[Code Golf] The final countdown?

Description
Loading description...
Fundamentals
Restricted
  • Please sign in or sign up to leave a comment.
  • dfhwze Avatar

    This comment has been hidden.

  • dfhwze Avatar

    Are they planning a breaking change?

    For compatibility with future versions of python, the code should not contain numeric literals immediately followed by keywords.

    • mauro-1 Avatar

      This "feature" is deprecated since 3.10 and will be removed in a future release. In python 3.11 it generates a syntax warning.

      At some point in the future all solutions with glued number-keyword will be invalidated.

      https://docs.python.org/3.13/whatsnew/3.13.html#pending-removal-in-future-versions

      Currently Python accepts numeric literals immediately followed by keywords, for example 0in x, 1or x, 0if 1else 2. It allows confusing and ambiguous expressions like [0x1for x in y] (which can be interpreted as [0x1 for x in y] or [0x1f or x in y]). A syntax warning is raised if the numeric literal is immediately followed by one of keywords and, else, for, if, in, is and or. In a future release it will be changed to a syntax error. (gh-87999)

      P.S. In python3.11 0x1for -> 0x1f or.

  • dfhwze Avatar

    Nice one