Speaking honestly though, I've had issues with duck typing when trying to read standard library code and such-like, and have found in my own coding that arguments to methods and functions tend to be of the same type anyway.
He has a good point about the constructor he encountered, but that's not Python's fault (although it doesn't help), that's a bad API - I've met a fair few classes with multiple constructors that take a bunch of reading to figure out. I tend to prefer static factory methods with descriptive names over a gazillion slightly different constructors.
I'm sure you could do the same in Python if it was really a problem.
0
u/[deleted] Dec 08 '08
I can see Python 3K's new annotations easily expanding to fill the compile-time checking and IDE hinting role: http://www.python.org/dev/peps/pep-3107/
Speaking honestly though, I've had issues with duck typing when trying to read standard library code and such-like, and have found in my own coding that arguments to methods and functions tend to be of the same type anyway.
He has a good point about the constructor he encountered, but that's not Python's fault (although it doesn't help), that's a bad API - I've met a fair few classes with multiple constructors that take a bunch of reading to figure out. I tend to prefer static factory methods with descriptive names over a gazillion slightly different constructors.
I'm sure you could do the same in Python if it was really a problem.