serhii.net

In the middle of the desert you can say anything you want

20 Dec 2021

First use of python 3.8 walrus operator!

Wooho!

files = list(input_dir.glob("*.md"))[: cs.limit]
if output_path.is_file() and ((l := len(files)) != 1):
    raise ValueError(f"Can't write {l} files to single file {output_dir}")

Had to use additional parentheses around the actual assignment. Without that, black fails in an interesting way:

error: cannot format smw_to_hugo/yaml_converter.py: cannot use --safe with this file; failed to parse source file.
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus