[issue43378] Pattern Matching section in tutorial refers to | as or

Luciano Ramalho report at bugs.python.org
Tue Mar 2 16:29:27 EST 2021


New submission from Luciano Ramalho <luciano at ramalho.org>:

Section 4.6. "match Statements" of the Python 3.10 tutorial says:

"""
You can combine several literals in a single pattern using | (“or”):
"""

For someone just learning Python, this may suggest that | is always "or", when in fact it is a bitwise operator (that may be overloaded), but inside a match clause has this special meaning without any overloading. 

I believe this exception should be made explicit in section 4.6, otherwise it may lead readers of the tutorial to a misconception.

----------
assignee:  -> docs at python
components: +Documentation
nosy: +docs at python
title: Pattern Matching section in tutorial refers to | as -> Pattern Matching section in tutorial refers to | as or
type:  -> enhancement
versions: +Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43378>
_______________________________________


More information about the Python-bugs-list mailing list