About 206 results
Open links in new tab
  1. WHAT TO DO WITH EXCEPTIONS? what to do when encounter an error? what value to choose? WHERE TO USE ASSERTIONS? For information about citing these materials or our Terms of Use, …

  2. Python developers may encounter the “AttributeError: module ‘collections’ has no attribute” message when trying to access a non-existent attribute in the collections module. This article addresses fixes …

  3. Explanation: The __setitem__() method in a Python class is used to enable setting of individual elements of the object. This method is called when you attempt to assign a value to an element of …

  4. To cause an error, you simply raise the name of a class that is derived from BaseException. In the next section on iterators, we’ll see how the built-in StopIteration class is used to signal the end of iteration. …

  5. StandardError AssertionError AttributeError Argument has wrong type (e.g. float([1])) Argument has wrong value

  6. # 7.py # AttributeError exception: incorrect use of methods of a class or data type. # In this example the class Car has only defined the method move, but the # program tries execute the method stop() that …

  7. If self is an instance of cls, raises an AttributeError, to avoid a double lookup. This function is intended to be called from __getattr__, and so should not be called if name is an attribute of self.