But you actually want to return twice the value. I don't see
how to do that.


Ah, I think I see...returning more than once is done with the "yield" keyword:

  def f(param):
    yield param
    yield param

That returns twice the integer parameter... :-D

However, the OP was instructed to "Write the definition of a function twice" which means I'd have to copy & paste the final function definition a second time to make sure it was done twice (as Carl suggested).

Then again as David notices, the subject lines asks how to double a variable, in which case one might want

  import struct
  def f(param):
    return struct.pack('f', param)

which doubles the parameter... :-S

-tkc




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to