python introspection – speculation+observations

Background — Python’s 2 fundamental features, introspection and polymorphism, appear to be integrated (more than in other languages). You could add to the mix the “module” feature, but I won’t.

The __dict__ thingy seems to be the common theme (heart of everything python), but I found it hard to prove in code. For now, let’s take [[Programming python]] at face value.

Python introspection offers perhaps the best window into python internals. I guess introspection reveals
– polymorphism, inheritance,
– function call resolution (always run time)
– instance-method/class-method
– bound methods
– user defined functions and classes
– modules and namespaces

Here’s a limited sample of the numerous introspection features in python —
– __dict__
– __methods__, __members__
– dir()
– type()
– isinstance()
– __mro__

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s