String literals without assignment have no side effect, that is why you think of them as comments. They are however, not comments. They are parsed and interpreted just like any other string.
You might be familiar with the concept in Javascript, if you have ever put 'use strict' at the top of a JS file.
I am not Dutch, the handle is thewhitetulip because of a TV show called Fringe, where in the protagonist asks God for a sign of forgiveness, a white tulip.
Yes, indeed. Triple quoted strings are just a way to write strings, but isn't that also a suitable way to write multiple line comments? The reason behind it is that otherwise you'll have to add `#` to every file and it becomes tedious! I have been using triple quoted strings as comments for a long time. But you are right, that's not the exact usecase for triple quoted strings, so I'll state that clearly.
Please no. Most editors have a comment/uncomment function which you can use on multiple lines at once. Abusing triple quoted strings for commenting is bad practice. I'd avoid it out of principle, because it's semantically the same as proper strings and looks the same with code highlighting, so it increases cognitive load. But also because they might be interpreted as docstrings mistakenly, either by other programmers, or the documentation tool itself.
A good rule, especially for beginners, is that triple quotes are primarily for docstrings, and the occasional multi line string. (Too many multi line strings, and it's probably a good idea to put them in a separate file)
Edit: There's also other errors with this "anti-book", including basic stuff like operators. For example, the major operator list at the top is missing "or", the Boolean part probably needs a bit more info on truthiness as "not" works on non-Boolean types also, and the membership test operator ("in") works on many other data types, not just lists. And of course, "!=" == "xor".
True, I am updating the multi line comment as doc strings and will include your comments, thank you!
Also 'or' is not missing from my "anti-textbook", or is present, I am not sure why you think so. I am yet to reciew thr tutorial once so hopefully mistakes like the in operator would be rectified soon!
The tone of the writing in the "anti-textbook" suggests carefully researched facts, at least in some parts. It seems misleading to merely guess. I suggest you put some effort into giving citations for the various assertions. Links to relevant PEPs or sections of the official tutorial would be good.
It's clear that this represents a lot of work and it's wonderful that you've done this. My instinctive reaction is to correct minor issues, but please don't take negative comments as a lack of respect for what you've done... this is a tough audience, maybe the toughest. Keep up the great work!
I have just started learning Python and I'm referring "Problem Solving with Algorithms and Data Structures using Python". Should I continue with that or refer something else?
"Problem Solving" is a good reference for understanding algorithms and data structures. It uses Python but Python language is not its main focus.
However, "Problem Solving" is one of the best places where I've learnt programming.
Depends, are you a kickass Java dev looking to learn Python, or are looking to learn to code with Python as your first language? If the second what do you want to do with it? Automate some boring task or become a professional developer?
https://github.com/thewhitetulip/build-app-with-python-antit...