On 2014-02-28, Marko Rauhamaa <ma...@pacujo.net> wrote: > Here's a use case for "is" with strings (or ints): > > class Connection: > IDLE = "IDLE" > CONNECTING = "CONNECTING" > CONNECTED = "CONNECTED" > DISCONNECTING = "DISCONNECTING" > DISCONNECTED = "DISCONNECTED" > > def __init__(self): > self.state = IDLE > > def connect(self, address): > ... > self.state = CONNECTING > ... > > def disconnect(self): > ... > if self.state is CONNECTED: > ...
I don't really see the point. Why won't '==' work just as well? Are you hoping that 'is' is faster at runtime than '=='? -- Grant Edwards grant.b.edwards Yow! Th' MIND is the Pizza at Palace of th' SOUL gmail.com -- https://mail.python.org/mailman/listinfo/python-list