Starting python 2.6 you can use special attribute __self__
:
>>> a.some.__self__ is a
True
im_self
is phased out in py3k.
For details, see the inspect
module in the Python Standard Library.
More Related Contents:
- Python: Bind an Unbound Method?
- Is it possible to overload Python assignment?
- How do I access Class member variables in Python?
- Difference between methods and attributes in python
- What are the parentheses for at the end of Python method names? [duplicate]
- How do I access instance variables in Python?
- Define a method outside of class definition?
- How do I access Class member variables?
- class method generates “TypeError: … got multiple values for keyword argument …”
- How to get all methods of a Python class with given decorator?
- How do I set and access attributes of a class? [duplicate]
- Python calling method in class
- Calling one method from another within same class in Python
- Python using methods from other classes
- Are functions objects in Python?
- How to bind an unbound method without calling it?
- What is the purpose of the word ‘self’?
- How to print instances of a class using print()?
- python class attribute
- Which classes cannot be subclassed?
- How to read class attributes in the same order as declared?
- unbound method f() must be called with fibo_ instance as first argument (got classobj instance instead)
- Why do I get a TypeError that says “takes no arguments (1 given)”? [duplicate]
- Python: how to “kill” a class instance/object?
- How can I create an object and add attributes to it?
- @classmethod vs @staticmethod in Python
- List as a member of a python class, why is its contents being shared across all instances of the class?
- Correctly extend a tkinter widget using inheritance
- Is it possible to do partial inheritance with Python?
- How would I cross-reference a function generated by autodoc in Sphinx?