Tuple assignment and generators?

Mel Wilson mwilson-to at sympatico.ca
Fri May 5 22:18:11 CEST 2006


vdrab wrote:
> I guess the take-away lesson is to steer clear from any reliance on
> object identity checks, if at all possible.  Are there any other such
> "optimizations" one should like to know about?

Object identity checks are just the thing/numero uno/ichiban 
for checking object identity.  A code snipped like

     def broadcast (self, message):
         "Broadcast a message to all the other game players."
         for p in all_players:
             if p is not self:
                 p.send (message)

does just what I want and expect it to.

         Mel.



More information about the Python-list mailing list