On Jul 17, 2018, at 12:18, MRAB <python at mrabarnett.plus.com> wrote: > Why use len(...) == 0 instead of not(...)? > > assert not(subdirs := list(path.iterdir())), subdirs Off-topic, but it’s a style thing. Some style guides (and my personal preference) require to be more explicit when checking for empty sequences. I’ll use a boolean test (e.g. `not` or false-iness) when the subject could be empty, None, or the empty string, and `len() == 0` when the subject is supposed to be a sequence. -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/ee5a6c64/attachment.sig>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4