On 11/22/20 5:00 PM, Jim J. Jewett wrote:
I think your changed constructor:
class Car:
def __init__(self, manufacturer, variant):
self.brand = manufacturer
self.model = variant
is a particularly good example, and the PEP should specify whether:
Car("Chrysler", "PT Cruiser")
is matched by:
Car(brand="Chrysler", mod:=model)
or:
Car(manufacturer="Chrysler", mod:=variant)
or both, or possibly even Frankenstein combinations like:
Car(brand="Chrysler", mod:=variant)
It could be a good example to include to emphasize that pattern matching is based on attributes, not function headers --
so `brand` and `model` would work, whilst `manufacturer` and `variant` would not.
--
~Ethan~
_______________________________________________
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/EO2XDZT52MCLNNJUV3PC2HFNC5BWJMUW/
Code of Conduct: http://python.org/psf/codeofconduct/