It's all been said, but a couple notes:
I also teach beginners Python -- and I absolutely teach them to use "is
None" (I'd have to look at my notes, but I think around lesson 3),
In fact, I also teach about what ``is`` means, and how it is very different
from ``==``.
I have seen all too many instances of code like:
if c is 0:
...
Which actually DOES work, for small integers, on cPython -- but it is a
very bad idea. (though I think it raises a Warning now)
And your students are almost guaranteed to encounter an occasion where
using == None causes problems at some point in their programming careers --
much better to be aware of it early on!
As others have said, there is no such thing as "mandatory" for PEP 8. It is
a "style" guide. Though interestingly, the recommendation of using is with
None is not just one of style, there is a real semantic difference.
In fact, of all the things in PEP 8, this might actually be one of the more
important!
I encourage you NOT to turn it off in your students' linter.
-CHB
--
Christopher Barker, PhD (Chris)
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/4SCCVR5MAMZ6HZU22WEOHDT3YH3BVE33/
Code of Conduct: http://python.org/psf/codeofconduct/