No, I don't think you

No, I don't think you understand. You're talking about "Static typing" but you are using the phrase "Strong typing" to describe it. Static typing is about determining type errors at compile-time, because a variable or function can only hold or return a single, explicit type. A variable or function is defined as an "int", and it can only ever hold an int or return an int. If you try to put a string into that variable, you will get a compile error. Python is not static-typed, it is dynamic-typed.

Strong typing has nothing to do with static/dynamic typing. Strong typing involves how strict conversions between types are. In a strongly typed language, like Python, you cannot simply do:

var = 123
sys.stdout.write(var)

Because you will get an error. sys.stdout.write expects a string. Even though WE know the integer 123 can easily be converted into the string "123" without losing it's meaning, Python will not do this for you automatically, because it is strongly typed. If you gave a weakly typed language the same code, it would happily convert it into "123" and print that to the screen.

Reply

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

More information about formatting options

Ads (you can disable these if you log in)