Python Introspection: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 8: Line 8:
=<tt>getattr()</tt>=
=<tt>getattr()</tt>=
<code>[[Python Language Functions#getattr|getattr()]]</code> is a built-in function that returns the value of the specified attribute from the specified object.
<code>[[Python Language Functions#getattr|getattr()]]</code> is a built-in function that returns the value of the specified attribute from the specified object.
=The <tt>inspect</tt> Package=


=Module Introspection=
=Module Introspection=

Revision as of 18:33, 8 July 2022

Internal

TODO

https://www.geeksforgeeks.org/code-introspection-in-python/

Overview

Introspection is Python's equivalent for Java reflection. It is the ability to determine the type of an object at runtime and to dynamically examine Python objects.

getattr()

getattr() is a built-in function that returns the value of the specified attribute from the specified object.

The inspect Package

Module Introspection

Also see:

Python Language Modularization

Class Instance Introspection

Invoking a Static Method Dynamically