[docs] some example code uses a parameter called "next", resulting in a name conflict

Winston C. Yang winston at cs.wisc.edu
Fri Feb 10 18:17:31 CET 2012


The code below has an issue: the __init__ method has a parameter called 
"next", which conflicts with the built-in "next" in Python.

In the link, the "next" parameter is syntax-colored green instead of 
black, showing its special status.

Winston



http://docs.python.org/py3k/tutorial/errors.html
8.5 User-defined Exceptions

class  TransitionError(Error):
     """Raised when an operation attempts a state transition that's not
     allowed.

     Attributes:
         previous -- state at beginning of transition
         next -- attempted new state
         message -- explanation of why the specific transition is not allowed
     """

     def  __init__(self,  previous,  next,  message):
         self.previous  =  previous
         self.next  =  next
         self.message  =  message




More information about the docs mailing list