Misusing the Assignment Operator
There are several cases in Python where you’re not able to make assignments to objects. Some examples are assigning to literals and function calls. In the following code, you’re going to see a few examples that attempt to do this, and the resulting
00:19 So, throughout this course, all of the Python examples that you see in a REPL will be done in bpython, rather than the standard Python REPL. It’s functionally identical, but it provides some nice code highlighting by using color.
01:15 One thing to note here is that these examples in the REPL are missing the repeated code line and caret pointing to the problem in the traceback. The exceptions and trackbacks you see in a REPL are different to when you execute the code from a file.
01:29 If this code was in a file, you’d get the repeated code line and caret pointing to the problem, as you saw previously. So, this kind of misuse of the assignment operator is the kind of thing, certainly, I can say I do more than I should admit to.
Become a Member to join the conversation.