However for the first time, I don't agree with you when you say, we should compare None using "==". I have always read code using "is" and I'm sure many linters will stop you with this syntax.
I have several series in mind, one on oop, one on testing, and one on data science. But they need to be several articles, so I have to batch them when I know I can be consistent in my writring.
I also really need a better platform, substack is showing limits.
The thing about using is for checking equality is that linters actively encourage it. I forget if it is Pylance or Ruff, but one of the linters I use day-to-day Will give me a linter error if I use == to check for None, and tell me to use is
Excellent article as always.
However for the first time, I don't agree with you when you say, we should compare None using "==". I have always read code using "is" and I'm sure many linters will stop you with this syntax.
Indeed and I like is None better but it's too confusing just for getting a tad prettier.
I'm a backend dev who has an aversion to trying to learn pandas and other data tools. I would love to see a tutorial on that since you make them fun.
I have several series in mind, one on oop, one on testing, and one on data science. But they need to be several articles, so I have to batch them when I know I can be consistent in my writring.
I also really need a better platform, substack is showing limits.
Great, thanks! I think you do a great job. I really liked your HTMX series. Btw, did you see htmz on HN? https://news.ycombinator.com/item?id=39429370
I also follow a site called celery.school, which is on hash node. I wonder if that is a better platform for technical content.
Thanks. I knew those. But it's still good to have them quite present in your mind and it also feels good to know something at all that is not obvious.
Btw: Did you mean "trailing comma" here:
"But a leading parenthesis can create a tuple of one element:"
Best!
Christian
Yes, thanks.
The thing about using is for checking equality is that linters actively encourage it. I forget if it is Pylance or Ruff, but one of the linters I use day-to-day Will give me a linter error if I use == to check for None, and tell me to use is
Ah, good point.
I would add that PEP 8 specifically recommends the use of `is None`:
"Comparisons to singletons like None should always be done with is or is not, never the equality operators."
peps.python.org/pep-0008/#programming-recommendations