Backticks: What up?
Steve Holden
sholden at holdenweb.com
Wed Apr 28 11:40:31 EDT 2004
Steven Brent wrote:
> Thanks! I didn't know you could use printf type syntax with return....
The "return" statement allows an arbitratu expression as its target,
even complex objects like sequences, classes and instances. For example:
>>> def tuplify(a, b):
... return a, b
...
>>> tuplify([1, 2], [3, 4])
([1, 2], [3, 4])
>>> thing, thong = tuplify("sing", (1, 2, 3))
>>> thing
'sing'
>>> thong
(1, 2, 3)
>>>
regards
Steve
More information about the Python-list
mailing list