2018-07-17 10:50 GMT+02:00 Serhiy Storchaka <storchaka at gmail.com>: > assert len(subdirs := list(path.iterdir())) == 0, subdirs > > Does PEP 572 encourages writing such code, discourages this, or completely > forbids? If I understood correctly Guido, Python the language must not prevent developers to experiment various usage of assignement expressions. The f-string has a similar design: anything even f'{__import__("os").system("rm -rf /")}' is allowed. It's more the role of linters like flake8 to warn against "bad practices". I don't think that PEPs like f-string and assignment expressions must include *coding styles*. Sure, f-string and assignment expressions allow to write surprising and bad code. But you don't them them to write crappy code :-) I was strongly against f-string at the beginning because I immediately predicted that people will start to call functions (with side effects) in f-string... but I didn't see that happen. In fact, developers are reasonable and use f-string when it's appropriate and safe. Victor
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