[issue44109] missing dataclass decorator in match-statement example

Brandt Bucher report at bugs.python.org
Thu May 13 17:21:44 EDT 2021


Brandt Bucher <brandtbucher at gmail.com> added the comment:

I don't really think there is anything wrong with the documentation. I can copy-and-paste all of the code from the PEP 634 section of the 3.10 What's New into the REPL without any issues (provided that named subjects like point/points/test_variable/color are actually defined).

Note that none of the example snippets actually *create* Point instances. Rather, some of the patterns *match* Point instances... which is sort of the opposite of instantiation.

As the Point class is currently written, instantiation would probably look like:

>>> p = Point()
>>> p.x = 0
>>> p.y = 0

Sure, it would help to have an __init__ defined in real code, but I sort of feel like adding it to this example would just distract (especially since the example doesn't actually *need* it).

Thoughts from others?

----------

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


More information about the Python-bugs-list mailing list