Il modulo permette di indagare al volo su classi, oggetti, moduli, …
inspect.getmembers(x) | Restituisce un elenco … |
… | … |
Esempio
import inspect
x = True
for m in inspect.getmembers(x):
print(m)
Produce un elenco di tutti gli operatori, attributi, metodi, … di un valore booleano.
True si comporta come complesso, frazione, intero!
+, -, *, /, >=, >, ==, <, <=, !=, and, or, not, ...
denominator, numerator, real, ...
abs(), bit_count(), bit_length(), bool(), ceil(), conjugate(), floor(), from_bytes(), int(), pow(), round(), str(), ...