Skip to content Skip to sidebar Skip to footer
Showing posts with the label Introspection

Looping Over A Python / Ironpython Object Methods

What is the proper way to loop over a Python object's methods and call them? Given the object: … Read more Looping Over A Python / Ironpython Object Methods

Getting The Class Path Or Name Space Of A Class In Python Even If It Is Nested

I'm currently writing a serialization module in Python that can serialize user defined classes.… Read more Getting The Class Path Or Name Space Of A Class In Python Even If It Is Nested

Detecting Bound Method In Classes (not Instances) In Python 3

Given a class C with a function or method f, I use inspect.ismethod(obj.f) (where obj is an instanc… Read more Detecting Bound Method In Classes (not Instances) In Python 3

Get Package Of Python Object

Given an object or type I can get the object's module using the inspect package Example Here, g… Read more Get Package Of Python Object

Creating Python Classes With Arbitrarily Substituted Attribute Name

I apologize for not giving this question a better title; the reason that I am posting it is that I … Read more Creating Python Classes With Arbitrarily Substituted Attribute Name

Find Module Name Of The Originating Exception In Python

Example: >>> try: ... myapp.foo.doSomething() ... except Exception, e: ... print … Read more Find Module Name Of The Originating Exception In Python

How To Find The Name Of A Property From A Python Class

I'm trying to get a property to print the name that it's assigned to in the owner class in … Read more How To Find The Name Of A Property From A Python Class

Python: Why Can't I Modify The Current Scope Within A Function Using Locals()?

Why does creating/modifying a member of locals() not work within a function? Python 2.5 (release25-… Read more Python: Why Can't I Modify The Current Scope Within A Function Using Locals()?