[Python-Dev] Re: PEP 622: Structural Pattern Matching -- followup

2020年7月08日 01:12:49 -0700

Since this is very new system, can we have some restriction
to allow aggressive optimization than regular Python code?
# Class Pattern
Example:
 match val:
 case Point(0, y): ...
 case Point(x, 0): ...
 case Point(x, y): ...
* Can VM lookup "Point" only once per executing `match`, instead three times?
* Can VM cache the "Point" at first execution, and never lookup in
next time? (e.g. function executed many times)
# Constant value pattern
Example:
 match val:
 case Sides.SPAM: ...
 case Sides.EGGS: ...
* Can VM lookup "Sides" only once, instead of two?
* Can VM cache the value of "Sides.SPAM" and "Sides.EGGS" for next execution?
Regards,
-- 
Inada Naoki <[email protected]>
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/GUFY4MNHTF2F75X5YI574LVP6QAZQ5KI/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to