Comparison
nameof vs varname
Maintenance, adoption and momentum side by side, from PyPI, GitHub and deps.dev data refreshed every day.
Get the name of a variable or attribute, as in C#
Archived. The repository is read-only: no more fixes or releases will come.
$
pip install nameofDark magics about variable names in python.
Low maintenance activity. Last release 8 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and contributor spread.
$
pip install varnameIn short
- nameof is archived: avoid it for new projects.
- varname is the most used: 272.9K downloads a month, 1.6× more than nameof.
- varname also has the best Pythie’s Index (39).