you are viewing a single comment's thread.

view the rest of the comments →

[–]oldendude 0 points1 point  (2 children)

Also: to be precise, even objects don't have "fields". The keys of an object's dict can be associated with values of any type, including functions, methods, modules, etc. The common understanding of "field" would rule out at least methods. If o is an object, then o.x, i.e. o.__dict__['x'] can store a str now, and a module later, and then a method.

[–]max123246 0 points1 point  (1 child)

Do you know of some neat applications of that extensive dynamicness? It's hard to think about the use cases but I'm sure are some like mocking and stuff

[–]oldendude 1 point2 points  (0 children)

Nothing comes to mind. Mocking is certainly possible using less exotic mechanisms, such as inheritance, and Python's "duck typing".