Unpacking extension (Re: A small inconsistency in syntax?)
Rainer Deyke
root at rainerdeyke.com
Tue Oct 30 23:34:44 EST 2001
"Greg Ewing" <greg at cosc.canterbury.ac.nz> wrote in message
news:3BDF7571.5D8CB310 at cosc.canterbury.ac.nz...
> case foo:
> Nothing():
> print "We got nada"
> Pair(Furble(p, q), Furble(r, s)):
> print "We got a pair of furbles"
> Pair(a, b):
> print "We got a pair of something else"
> x:
> print "We got something else"
Ambiguous to the point of uselessness.
a, b = 7, 13
case foo:
Pair(a, b):
print 'Got Pair(7, 13)'
Pair(a, b):
print 'Got Pair(%s, %s)' % (a, b)
Pair(a, b):
print 'Got object of class %s' % Pair
--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games - http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
More information about the Python-list
mailing list