PEP 622 (Structural Pattern Matching) questions
Hi, I have two questions about PEP 622, as it stands. 1. Is the current version the final version? 2. Is the difference in semantics between the Django example and the proposed replacement deliberate or accidental? (The difference being the change in behaviour for sequences other than list or tuple). Cheers, Mark.
Hi Mark, As the specific author of that example (and the author of the big it had on a previous version) let me clarify: The change in semantics is intentional. I could be more explicit, and preserve semantics, but I actually find very likely that the original code does not support other sequences because it would make their code more complicated (so it's a matter of opinion but for me it's a feature, not a bug) As for the previous fixed bug, of like to mentioned that I misread the original code (I tend to use >= rather than > for those comparisons) so I read "at least one element" rather than "more than one". Again, it may be subjective taste but I find our version more readable in that respect and less likely to be misinterpreted (making the bug easier to spot there) Best, Daniel On Thu, 6 Aug 2020, 12:32 Mark Shannon, <mark@hotpy.org> wrote:
Hi,
I have two questions about PEP 622, as it stands.
1. Is the current version the final version?
2. Is the difference in semantics between the Django example and the proposed replacement deliberate or accidental? (The difference being the change in behaviour for sequences other than list or tuple).
Cheers, Mark. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@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/NQBL4S6W... Code of Conduct: http://python.org/psf/codeofconduct/
Hi Daniel, On 06/08/2020 1:11 pm, Daniel Moisset wrote:
Hi Mark,
As the specific author of that example (and the author of the big it had on a previous version) let me clarify:
The change in semantics is intentional. I could be more explicit, and preserve semantics, but I actually find very likely that the original code does not support other sequences because it would make their code more complicated (so it's a matter of opinion but for me it's a feature, not a bug)
Are you going to mention in the PEP that the two pieces of code are not equivalent, or show an equivalent version? I don't know whether the original author intended to accept `array.array("u", "hi")` as a legal value, but I suspect that they did not. Cheers, Mark.
As for the previous fixed bug, of like to mentioned that I misread the original code (I tend to use >= rather than > for those comparisons) so I read "at least one element" rather than "more than one". Again, it may be subjective taste but I find our version more readable in that respect and less likely to be misinterpreted (making the bug easier to spot there)
Best,
Daniel
On Thu, 6 Aug 2020, 12:32 Mark Shannon, <mark@hotpy.org <mailto:mark@hotpy.org>> wrote:
Hi,
I have two questions about PEP 622, as it stands.
1. Is the current version the final version?
2. Is the difference in semantics between the Django example and the proposed replacement deliberate or accidental? (The difference being the change in behaviour for sequences other than list or tuple).
Cheers, Mark. _______________________________________________ Python-Dev mailing list -- python-dev@python.org <mailto:python-dev@python.org> To unsubscribe send an email to python-dev-leave@python.org <mailto:python-dev-leave@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/NQBL4S6W... Code of Conduct: http://python.org/psf/codeofconduct/
On Thu, Aug 6, 2020 at 04:31 Mark Shannon <mark@hotpy.org> wrote:
Hi,
I have two questions about PEP 622, as it stands.
1. Is the current version the final version?
That is up to the Steering Council.
2. Is the difference in semantics between the Django example and the proposed replacement deliberate or accidental? (The difference being the change in behaviour for sequences other than list or tuple).
Cheers, Mark. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@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/NQBL4S6W... Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido (mobile)
participants (3)
-
Daniel Moisset
-
Guido van Rossum
-
Mark Shannon