New submission from Vivek Vashist <vivekvash...@gmail.com>:

Possible Typo in match statement example. 
https://docs.python.org/3/tutorial/controlflow.html#match-statements


BROKEN:
> python
Python 3.10.0b4 (default, Nov 15 2021, 18:26:05) [Clang 12.0.0 
(clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from enum import Enum
>>> class Color(Enum):
...     RED = 0
...     GREEN = 1
...     BLUE = 2
...
>>> match color:
...     case Color.RED:
...         print("I see red!")
...     case Color.GREEN:
...         print("Grass is green")
...     case Color.BLUE:
...         print("I'm feeling the blues :(")
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'color' is not defined. Did you mean: 'Color'?


WORKING:

> python
Python 3.10.0b4 (default, Nov 15 2021, 18:26:05) [Clang 12.0.0 
(clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>>
>>> from enum import Enum
>>> class Color(Enum):
...     RED = 0
...     GREEN = 1
...     BLUE = 2
...
>>> match Color:
...     case Color.RED:
...         print("I see red!")
...     case Color.GREEN:
...         print("Grass is green")
...     case Color.BLUE:
...         print("I'm feeling the blues :(")

----------
assignee: docs@python
components: Documentation
messages: 408415
nosy: docs@python, vivekvashist
priority: normal
severity: normal
status: open
title: Typo in match Statement example
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46059>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to