On Fri, Sep 18, 2020, 8:34 AM Chris Angelico <ros...@gmail.com> wrote:

> On Fri, Sep 18, 2020 at 10:26 PM Ricky Teachey <ri...@teachey.org> wrote:
> >
> > On Fri, Sep 18, 2020, 8:17 AM Ricky Teachey <ri...@teachey.org> wrote:
> >>
> >>
> >> Why not just grow a parse method on str that returns a dict and do it
> this way?
> >>
> >>
> >> q = "{a} {b}"
> >> p = "1 2"
> >> (a, b) = q.parse(p)
> >
> >
> > Sorry that should have been:
> >
> > (a, b) = q.parse(p).values()
> >
>
> You're using a dictionary as if it were a tuple. That's going to cause
> a LOT of pain when someone does something like:
>
> a, b = "{b} {a}".parse(p).values()
>
> and they come out in the wrong order. Bad bad bad idea. Don't have
> names if they're going to be pure lies.
>
> ChrisA
>

I'm not sure I understand the point you are making here since dictionaries
have preserved order since python 3.6...?

The same problem exists here:

a, b  = 2, 1
assert a == 1. # whoops got the order wrong
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/5YC4I2M4W6ZHXVFIV2XAHKRWX7OGUZ6D/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to