"Experience is the name every one gives to their mistakes."
- Oscar Wilde
NameError
- You forgot to import a module
- You made a typo
AttributeError: 'NoneType' object has no attribute ...
- You forgot a return in your function
AttributeError
- Typo on dot lookup (obj.foo)
- Object is different type from what you think (str vs int)
- Object does not implement a dunder method (e.g. __len__)
There's also the 3'rd party didyoumean module, which might be interesting for beginners. It changes the default stack trace to add a hint about what might be the problem.
No comments:
Post a Comment