News for hackers. Stuff that matters.
Re:Enough of These Python Practices by orf on Sunday February 06, 2022 @06:37PM (#30238257)
Some of these are bad. Pathlib is great for a one-liner to read files, and the “.get()” is broken. If it returns None, you’ll get an error about comparing None to an integer.
Re:Enough of These Python Practices by manfre on Sunday February 06, 2022 @07:01PM (#30238447)
The type annotation `Optional[Tuple[int, int]]` is the equivalent to `None | Tuple[int, int]`. `Tuple[Optional[int], Optional[int]]` is what you wanted.
Re:Enough of These Python Practices by inshadows on Sunday February 06, 2022 @06:21PM (#30238126)
> Don't

> text_c = text_a + text_b

Stopped reading there.

Re:Enough of These Python Practices by proposicion47 on Sunday February 06, 2022 @05:53PM (#30237897)
Why is use of print better than the logging module?