+ 1
Why python is duck type ?
can any one explain with examples.
3 Antworten
+ 4
https://en.m.wikipedia.org/wiki/Duck_typing
Python is duck typing because it handle dynamic type variables, meaning that a variable can store any data type ( int, string, ... ) at any time:
myVar = 42
print(type(myVar))
myVar = "forty two"
print(type(myVar))
With others language with strong typing, you need to declare the type of a variable, and you cannot change the type stored in it at runtime ^^
+ 2
duck type ?
0
Duck?