homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients eric.araujo, ezio.melotti, terry.reedy
Date 2011年09月09日.18:57:42
SpamBayes Score 1.9391044e-11
Marked as misclassified No
Message-id <1315594663.92.0.0878989522122.issue12913@psf.upfronthosting.co.za>
In-reply-to
Content
If you write 'How to debug Python code' rather than just "How to use pdb", I would start with the use of print statements and binary search. Have short sections on using trace and profile. Very useful would be a list of error messages and possible un-obvious to beginners but common causes. The following example comes up regularly on python-list.
TypeError: 'int' object is not callable
 Look in the previous line to see what you called. If it is a builtin name, perhaps you re-assigned the name to something else. Example:
list = 3
<many lines later>
list(1,2,3)
Traceback (most recent call last):
 File "<pyshell#7>", line 1, in <module>
 list(1,2,3)
TypeError: 'int' object is not callable 
Another one we see occasionally ("Is module x broken?") is something like: user runs script.py
import random
x = random.random()
Traceback...
NameError: name 'random.random' is not defined
Solution: user has a file random.py in the same directory
History
Date User Action Args
2011年09月09日 18:57:43terry.reedysetrecipients: + terry.reedy, ezio.melotti, eric.araujo
2011年09月09日 18:57:43terry.reedysetmessageid: <1315594663.92.0.0878989522122.issue12913@psf.upfronthosting.co.za>
2011年09月09日 18:57:43terry.reedylinkissue12913 messages
2011年09月09日 18:57:42terry.reedycreate

AltStyle によって変換されたページ (->オリジナル) /