Browse Source

Introspection

pull/27/head
Jure Šorn 5 years ago
parent
commit
40c4567c03
1 changed files with 5 additions and 9 deletions
  1. 14
      README.md

14
README.md

@ -1373,15 +1373,8 @@ Hashlib
``` ```
Introspection and Metaprograming
--------------------------------
**Inspecting code at runtime and code that generates code. You can:**
* **Look at the attributes**
* **Set new attributes**
* **Create functions dynamically**
* **Traverse the parent classes**
* **Change values in the class**
Introspection
-------------
### Variables ### Variables
```python ```python
<list> = dir() # Names of in-scope variables. <list> = dir() # Names of in-scope variables.
@ -1405,6 +1398,9 @@ no_of_params = len(sig.parameters)
param_names = list(sig.parameters.keys()) param_names = list(sig.parameters.keys())
``` ```
Metaprograming
--------------
### Type ### Type
**Type is the root class. If only passed the object it returns it's type (class). Otherwise it creates a new class (and not an instance!).** **Type is the root class. If only passed the object it returns it's type (class). Otherwise it creates a new class (and not an instance!).**

Loading…
Cancel
Save