:PROPERTIES: :ID: 487f57f5-e9fc-4df7-ae14-b41f9c1fa186 :mtime: 20220528184039 :ctime: 20220528183301 :END: #+title: Fonction vars * Introduction Fonction /built-in/ retournant l'attribut ~__dict__~ d'un module, d'une classe, d'une instance ou de n'importe quel objet avec un attribut ~__dict__~. * Howto #+BEGIN_SRC python :results output class Person: def __init__(self, name): self.name = name print(f'{vars(Person("me")) = }') import math print(f'{vars(math) = }') #+END_SRC #+RESULTS: : vars(Person("me")) = {'name': 'me'} : vars(math) = {'__name__': 'math', '__doc__': 'This module provides access to the mathematical functions\ndefined by the C standard.', '__package__': '', '__loader__': , '__spec__': ModuleSpec(name='math', loader=, origin='built-in'), 'acos': , 'acosh': , 'asin': , 'asinh': , 'atan': , 'atan2': , 'atanh': , 'ceil': , 'copysign': , 'cos': , 'cosh': , 'degrees': , 'dist': , 'erf': , 'erfc': , 'exp': , 'expm1': , 'fabs': , 'factorial': , 'floor': , 'fmod': , 'frexp': , 'fsum': , 'gamma': , 'gcd': , 'hypot': , 'isclose': , 'isfinite': , 'isinf': , 'isnan': , 'isqrt': , 'ldexp': , 'lgamma': , 'log': , 'log1p': , 'log10': , 'log2': , 'modf': , 'pow': , 'radians': , 'remainder': , 'sin': , 'sinh': , 'sqrt': , 'tan': , 'tanh': , 'trunc': , 'prod': , 'perm': , 'comb': , 'pi': 3.141592653589793, 'e': 2.718281828459045, 'tau': 6.283185307179586, 'inf': inf, 'nan': nan} * Références * [[https://mathspp.com/blog/til/009][Vars - mathspp]]