Spelling mistakes!

Heiko Wundram modelnine at bit-bukket.org
Fri Jan 6 16:42:31 CET 2006


KraftDiner wrote:
> Frankly how are you ever to know if this type of error is occuring?

By the traceback:

modelnine at phoenix ~ $ python
Python 2.4.2 (#1, Dec 22 2005, 17:27:39)
[GCC 4.0.2 (Gentoo 4.0.2-r2, pie-8.7.8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class x(object):
...   def __init__(self):
...     self.somename = "hello"
...   def somemethod(self):
...     print self.sumname
...
>>> a = x()
>>> a.somemethod()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 5, in somemethod
AttributeError: 'x' object has no attribute 'sumname'
>>>

AttributeError describes just this. And please don't start the war on how
much better compiled languages are because they catch this kind of error at
compile time. They simply are not.

--- Heiko.



More information about the Python-list mailing list