14.10.20 23:25, Batuhan Taskaya пише:
I've indexed a vast majority of the files from top 4K pypi packages to this system, and here are the results about __version__ usage on argparse, cgi, csv, decimal, imaplib, ipaddress, optparse, pickle, platform, re, smtpd, socketserver, tabnanny (result of an quick grep)
rawdata/clean/argparse/setup.py
|argparse.__version__|
rawdata/pypi/junitparser-1.4.1/bin/junitparser
|argparse.__version__|
rawdata/pypi/interpret_community-0.15.1/interpret_community/mlflow/mlflow.py
As for argparse, it was perhaps the last third-party module added to the stdlib without changing name and significant rewriting. It was added in Python 2.7/3.2, and older Python versions are not maintained for long time. There is a third-party module argparse on PyPI for older Python versions, its version 1.4 is higher that the version in the stdlib (1.1), but I think that the stdlib version has more features. The version of the module is just not informative.
|pickle.__version__|
The pickle in the last example looks like a result of import cloudpickle as pickle, so we are safe to eliminate that.
Here is the query if you want to try by yourself on different parameters: https://search.tree.science/?query=Attribute%28Name%28%27argparse%27%7C%27cg...
Thank you Batuhan. It will help to decide what to do with __version__ attributes: keep them ,upgrade to sys.version or sys.version_info, remove.