Stupid string formatting question

Michael S. Fischer michael+usenet at dynamine.net
Thu May 16 21:19:59 EDT 2002


Why can't I do this?

    def foo(x):
      # Do some operations on x yielding a and b
      return a, b

    print "a = %s, b = %s" % (foo(x))

It seems counter-intuitive that although foo is defined to return a 2-item
tuple, the interpreter just doesn't get it.

-- 
Michael S. Fischer / michael at dynamine.net / +1 650-533-4684
Lead Hacketeer, Dynamine Consulting, Silicon Valley, CA



More information about the Python-list mailing list