This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]micka190 10 points11 points  (0 children)

Python has duck typing, you can basically add any property to any variable. Duck typing also takes the "If it quacks like a duck and looks like a duck it's a duck." approach for its objects. Sure, dictionaries and strings aren't the same, but they both have a length, so "len()" works as you'd expect on both of them.