On Wed, Apr 6, 2011 at 1:51 PM, Paul Rubin <no.email@nospam.invalid> wrote: > In Haskell or ML, you can use patterns that contain wild > cards that play a role in the pattern-matching but don't establish any > binding. Can that be done in Python? > > Not as much. You could say something like > > sorted(enumerate(p), key=lambda(_,j): j) > > which gets the meaning across (it binds the symbol "_" though this > doesn't escape the lambda).
That will just give you a SyntaxError. Implicit tuple unpacking was removed in Python 3. It has to be done with an explicit assignment statement now. -- http://mail.python.org/mailman/listinfo/python-list