I noticed a fun post by Ned Batchelder called Testing some tidbits.
The post looks at different ways to see if a string has only 0 or 1 in it.
He posted a few ways on Bluesky/Mastodon and got a bunch of replies with more ways. And then wrote a small script to check to see if they worked.
It’s a fun post, and from it I learned about:
cleandoc - a way to strip leading blank space and maintain code block indentation partition - splitting strings based on a substring Using | to pass imports to eval() - I don’t use eval much.
↧