[Python-Dev] PEP 572 and assert
Barry Warsaw
barry at python.org
Tue Jul 17 14:48:54 EDT 2018
On Jul 17, 2018, at 11:34, Tim Peters <tim.peters at gmail.com> wrote:
> Assuming the result of list(path.iterdir()) can change over time (seems very likely),
>
> assert len(list(path.iterdir())) == 0, list(path.iterdir())
>
> _could_ end up both triggering and displaying an empty list in the exception detail. The assignment-expression version cannot.
Tim, you’re dangerously tempting me into +1 territory. :)
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180717/acef19ce/attachment.sig>
More information about the Python-Dev
mailing list