Misconceptions

Here are a couple of misconceptions. Many more to come...

Misconception Count Does Not Imply Language Difficulty

The is no connection between the number of misconceptions listed here and the difficulty of the corresponding programming language. The effort we spent on collecting misconceptions is very different for different languages. It would be inappropriate to reason about the quality of languages based on the number of misconceptions in this collection.

Python
AssignCompares
= compares two values
Python
AssignmentCopiesObject
Assignment copies the object
Python
CannotChainAttributeToObjectInstantiation
Method calls, and attribute accesses in general, cannot be chained to a constructor invocation.
Python
ComparisonWithBoolLiteral
To test whether an expression is True or False, one must compare it to True or to False
Python
ConditionalIsSequence
If-else is equivalent to sequence of two ifs
Python
DeferredReturn
A return statement in the middle of a function doesn't return immediately
Python
IfIsLoop
The body of an if-statement executes repeatedly, as long as the condition holds
Python
InitCreates
__init__ must create a new object
Python
InitReturnsObject
__init__ needs to return an object
Python
MapToBooleanWithIf
To map a boolean expression to a bool, an if statement is necessary
Python
MapToBooleanWithTernaryOperator
To map a boolean expression to a bool, a ternary conditional operator is necessary
Python
MultipleValuesReturn
Functions can return multiple values
Python
NoAtomicExpression
Expressions must consist of more than one piece
Python
NoEmptyInit
__init__ must do something
Python
NoReservedWords
Every sequence of letters and digits starting with a letter or an underscore can be used as an identifier
Python
NoShortCircuit
and/or always evaluate both operands
Python
ObjectsMustBeNamed
A variable is needed to instantiate an object
Python
OutsideInFunctionNesting
Nested function calls are invoked outside in
Python
ParenthesesOnlyIfArgument
() are optional for function calls without arguments
Python
RecursiveFunctionNeedsIfElse
A recursive function needs to contain an if-else statement
Python
ReturnCall
Return statements need () around the return value
Python
ReturnUnwindsMultipleFrames
A return statement can unwind multiple call stack frames
Python
RightToLeftChaining
Chained accesses are invoked from right to left
Python
SelfNoExpression
The name self is not an expression
Python
VariablesHoldExpressions
= stores an expression: it stores a reference to the expression in a variable
Python
VariablesHoldObjects
A variable contains a whole object

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.