documentation / reference help
Peter Otten
__peter__ at web.de
Mon Jan 24 03:32:33 EST 2011
Scott Meup wrote:
> I'm trying tolearn Python. The documentation tells syntax, and other
> things
> about a command. But for too many commands, it doesn't tell what it does.
> for instance, in VB the 'return' command tells the program what line to
> execute after some event (usually an error). In Python it appears to
> return
> a value. Where does it return it to? I couldn't find anywhere on the
> Python website to find out or to ask Python to upgrade their
> documentation. Can somebody please recommend a source.
Python's return has nothing to do with with gosub ... return in Basic. I
believe the analog to Python's
return <some-value>
in VB is
<function-name> = <some-value>
exit function
I. e.
Function f(a, b)
If a > b Then
f = 42
Exit Function
End If
f = a + b
End Function
translates to
def f(a, b):
if a > b:
return 42
return a + b
in Python.
More information about the Python-list
mailing list