I'm not a Python programmer, however, I found this in Bruce Eckel's "Thinking in Python" online book:
Python is a weakly-typed language, which means it puts the minimum possible requirements on typing. For example, you could pass and return different types from the same function.
#: c01:differentReturns.py
def differentReturns(arg):
if arg == 1:
return "one"
if arg == "one":
return 1
I'm not a Python programmer, however, I found this in Bruce Eckel's "Thinking in Python" online book:
Python is a weakly-typed language, which means it puts the minimum possible requirements on typing. For example, you could pass and return different types from the same function.
#: c01:differentReturns.py
def differentReturns(arg):
if arg == 1:
return "one"
if arg == "one":
return 1
print differentReturns(1)
Submitted by Anonymous (not verified) on Tue, 29/08/2006 - 12:09.print differentReturns("one")
#:~