Moved from the educational wikis at http://coedit.net/ to here:
Common Problems Beginners Have
The Alice 3D project developed a 3D programming environment for beginners. They used Python as the programming language originally (now switched to something else). There were two Python-specific issues that were problematic for beginners: the case-sensitivity of the language ("variable1" is not the same as "Variable1"), and integer division (a carryover from C, 3/4 = 0, not 0.75 because 0 is an integer and 0.75 is a float). The latter issue has been fixed, but the former has not and very likely never will. See this interview in Linux Journal and this dissertation for more details.
This article (Common Mistakes of Python Programmers) lists other common errors seen in Python training classes. Many result from the use of Python's interactive prompt and the IDLE text-based python development environment. Some of these problems might be solved by using IPython instead, but in general I never used (nor currently use) python's interactive prompt to develop applications.
- Another common error mentioned in the above article is forgetting to add a colon (:) at the end of if statements, class declarations, etc.
Subtle errors which may cause some fairly difficult to follow messages happens when built-in type and function names are "shadowed" (ie. redefined). For example, using str as a variable name in a scope (ie. a function or class) will prevent the built-in function of the same name from being usable, producing an error like this: TypeError: 'str' object is not callable
Even for advanced users there are features of the Python language that can cause difficulties. See PythonWarts for resources and observations on such matters. These observations have in part been used to suggest refinements in future Python versions, notably Python 3000.
Some Intermediate Conundrums have been noted with regard to the behaviour of some Python features, although these may be outside the scope of beginner problems.
Comments, Potential Solutions
- Are students learning python to "learn programming" or to develop real applications? Does the IDLE interactive prompt help or hinder either?