Question about None

Jean-Michel Pichavant jeanmichel at sequans.com
Fri Jun 12 17:36:37 CEST 2009


>   def setNext(nxt):
>     assert nxt==None or isinstance(nxt, Node), "next must be a Node"
>     self.next = nxt
>
> works ok, but it's uglier than it ought to be.
>
>   
I don't find it that ugly. It's accurate, easy to read and understand. 
"What else ?" would say a famous coffee representative.
If you like perfection, replace nxt==None by nxt is None.

Jean-Michel



More information about the Python-list mailing list