osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] PEP 572 and assert


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>