[issue45323] unexpected behavior on first match case _
Joël Bourgault
report at bugs.python.org
Thu Sep 30 04:34:30 EDT 2021
Joël Bourgault <joel.bourgault at gmail.com> added the comment:
I obtain the reported behaviour using `python -m doctests <presentation>.md` in a Gitlab pipeline, so it is likely that the execution is similar to the Python interpreter.
Therefore, I am satisfied by your answer, so I close this 'bug'; thanks a lot!
Now, about the fact that `x` is assigned when matched even if "guarded-out" afterwards: this is exposed in the tutorial, so I consider this to be the expected behavior; see last sentence of https://www.python.org/dev/peps/pep-0636/#adding-conditions-to-patterns.
Note: I discovered the observed behavior while writing a presentation, sourced in a markdown file and then rendered as a RevealJS presentation, visible here (French): https://poles.pages.forge.kaizen-solutions.net/pole-python/pr-sentations/python-structural-pattern-matching.
----------
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45323>
_______________________________________
More information about the Python-bugs-list
mailing list