Reply to comment

Python is weakly-typed

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)
print differentReturns("one")
#:~

Submitted by Anonymous (not verified) on Tue, 29/08/2006 - 12:09.

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
4 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Google ads

(You can disable these if you log in)