[Python-checkins] peps: PEP 410: Update for Nick's remarks
victor.stinner
python-checkins at python.org
Fri Feb 3 12:56:25 CET 2012
http://hg.python.org/peps/rev/8339f7714c15
changeset: 4033:8339f7714c15
user: Victor Stinner <vstinner at wyplay.com>
date: Fri Feb 03 12:56:11 2012 +0100
summary:
PEP 410: Update for Nick's remarks
files:
pep-0410.txt | 38 +++++++++++++++++++++++++-------------
1 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/pep-0410.txt b/pep-0410.txt
--- a/pep-0410.txt
+++ b/pep-0410.txt
@@ -42,8 +42,12 @@
Specification
=============
-Add decimal.Decimal as a new type for timestamps. Add a *timestamp* optional
-argument to:
+Add decimal.Decimal as a new type for timestamps. Decimal supports any
+timestamp resolution, support arithmetic operations and is comparable.
+Functions getting float inputs support directly Decimal, Decimal is converted
+implicitly to float, even if the conversion may lose precision.
+
+Add a *timestamp* optional argument to:
* os module: fstat(), fstatat(), lstat() and stat()
* time module: clock(), clock_gettime(), clock_getres(), time() and
@@ -66,6 +70,10 @@
The os.stat_float_times() is deprecated: use timestamp=int argument instead.
+.. note::
+ The decimal module is implemented in Python and is slow, but there is a C
+ reimplementation which is almost ready for inclusion in CPython.
+
Backwards Compatibility
=======================
@@ -124,6 +132,8 @@
duplicate hour of switching from DST to normal time
- time zone support is flaky-to-nonexistent in the datetime module
+datetime.datetime is also more complex than a simple number.
+
datetime.timedelta
------------------
@@ -135,18 +145,7 @@
timestamp inputs.
-decimal.Decimal
----------------
-
-Decimal has an arbitrary precision, support arithmetic operations, is
-comparable. Functions getting float inputs support directly Decimal, Decimal is
-converted implicitly to float, even if the conversion may lose precision.
-
-Using Decimal by default would cause bootstrap issue because the module is
-implemented in Python, but using Decimal by default was not considered.
-
-The decimal module is implemented in Python and is slow, but there is a C
-reimplementation which is almost ready for inclusion in CPython.
+.. _tuple-integers:
Tuple of integers
-----------------
@@ -215,6 +214,14 @@
adding a timezone or the absolution start of the timestamp (e.g. Epoch or
unspecified start for monotonic clocks) would break the API.
+The protocol proposition was as being excessive given the requirements, but
+that the specific syntax proposed (time.time(timestamp=type)) allows this to be
+introduced later if compelling use cases are discovered.
+
+.. note::
+ Other formats can also be used instead of a fraction: see the `Tuple of integers
+ <tuple-integers>`_ section
+
Add new fields to os.stat
-------------------------
@@ -233,6 +240,10 @@
Because we only need one new type, decimal.Decimal, a simple boolean flag
can be added. For example, time.time(decimal=True) or time.time(hires=True).
+The boolean argument API was rejected because it is not "pythonic". Changing
+the return type with a parameter value is preferred over a boolean parameter (a
+flag).
+
Add new functions
-----------------
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list