On Thu, Sep 17, 2020, 4:04 PM Chris Angelico > > >>> my_string = "It might be 11:45 PM" > > >>> # ... many lines later ... > > >>> f"It is {hh}:{mm} {am_or_pm}" = my_string > > > > What are hh, mm, and am_or_pm now? Do we raise an exception? Do we run > the line having no real idea whether they have been assigned at all? How do > we even check whether an assignment took place? > > You can get this with ANY unpacking form. I don't see how this is any > different. In fact, this kind of usage - where the template is in the > source code but the data comes from a variable - would be the normal >
So are you saying this would be a Value error like unsuccessful tuple unpacking? That's not obvious from OP.
_______________________________________________ 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/V3KSHPBXMFV7GOTV3KAYSZ3NG3OKXBLP/ Code of Conduct: http://python.org/psf/codeofconduct/