On 11/07/2020 20:13, Eric Nieuwland wrote:
Just after I hit ‘send’ it dawned on me it might be preferable to make that

        match poly:
                p0 = Point(x0, y0)
                p1 = Point(x1, y1)
                p2 = Point(x2, y2)
        case Polygon(p0, p1, p2):
                        …

so the part preceded by ‘match’ is the preparation phase for matching.

Are you intending p0, p1 and p2 to be subpatterns rather than object instantiations? That makes me a little twitchy; the difference between what you wrote and:

    match poly:
        p0 = Point(x0, y0)
        p1 = Point(x1, y1)
    case Polygon(p0, p1, p2):
        ...

is very easy to miss.

--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/VOKSUVYJTFKTES6Z7SSEZAVKOW6FT4UQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to