tuples, index method, Python's design

Paul Rubin http
Wed Apr 11 00:23:28 EDT 2007


Carsten Haese <carsten at uniqsys.com> writes:
> You have a point. Here is my revised solution:
> 
> assert current_player in p
> opponents = tuple(x for x in p if x is not current_player)

Still wrong on two counts.  First, assert is a no-op if optimization
is turned on.  Second, your version returns a different result from
the original if current_player occurs in p more than once.



More information about the Python-list mailing list