Hi, > What if we had a class, say time.time_base. The user could specify the base > units (such as "s", "ns", 1e-7, etc) and the data type ('float', 'int', > 'decimal', etc.) when the class is initialized. (...)
It's easy to invent various funny new types for arbitrary precision. But I prefer reusing the standard Python int type since it's very well known and very easy to manipulate. There is not need to modify the whole stdlib to support a new type. Moreover, we don't have to "implement a new type". > The other advantage is that third-party module could potentially subclass > this with additional options, such as an astronomy module providing an > option to choose between sidereal time vs. solar time, without having to > duplicate the entire API. Using nanoseconds as int doesn't prevent you to convert it to your own nice class. Victor _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/