Mel wrote:
 wrote:

Steven D'Aprano <st...@pearwood.info> writes:
It is never
correct to avoid using "is" when you need to compare for identity.
When is it ever necessary to compare for identity?

Ho-hum.  MUDD game.

def broadcast (sender, message):
    for p in all_players:
        if p is not sender:
            p.tell (message)    # don't send a message to oneself

Since in a MUD game, a player would always have a unique username, I'd rather compare with that. It doesn't rely on some internals. There is very, very rare case where 'is' is really, really needed.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to