@@ -320,7 +320,8 @@ PEP 562: Customization of Access to Module Attributes
320
320
-----------------------------------------------------
321
321
322
322
Python 3.7 allows defining :meth: `__getattr__ ` on modules and will call
323
- it whenever a module attribute is otherwise not found.
323
+ it whenever a module attribute is otherwise not found. Defining
324
+ :meth: `__dir__ ` on modules is now also allowed.
324
325
325
326
A typical example of where this may be useful is module attribute deprecation
326
327
and lazy loading.
@@ -336,8 +337,11 @@ and lazy loading.
336
337
PEP 564: New Time Functions With Nanosecond Resolution
337
338
------------------------------------------------------
338
339
339
- :pep: `564 ` adds six new "nanosecond" variants of existing functions
340
- to the :mod: `time ` module:
340
+ The resolution of clocks in modern systems can exceed the limited precision
341
+ of a floating point number returned by the :func: `time.time ` function
342
+ and its variants. To avoid loss of precision, :pep: `564 ` adds six new
343
+ "nanosecond" variants of the existing timer functions to the :mod: `time `
344
+ module:
341
345
342
346
* :func: `time.clock_gettime_ns `
343
347
* :func: `time.clock_settime_ns `
@@ -346,12 +350,11 @@ to the :mod:`time` module:
346
350
* :func: `time.process_time_ns `
347
351
* :func: `time.time_ns `
348
352
349
- The new functions are similar in function to the existing functions
350
- without the ``_ns `` suffix. They differ by returning nanoseconds as
351
- integers instead of fractional seconds.
353
+ The new functions return the number of nanoseconds as an integer value.
352
354
353
- On Linux and Windows the resolution of :func: `time.time_ns ` is 3 times
354
- better than that of :func: `time.time `.
355
+ `Measurements <https://www.python.org/dev/peps/pep-0564/#annex-clocks-resolution-in-python >`_
356
+ show that on Linux and Windows the resolution of :func: `time.time_ns ` is
357
+ approximately 3 times better than that of :func: `time.time `.
355
358
356
359
.. seealso ::
357
360
@@ -418,19 +421,6 @@ fixed.
418
421
PEP written and implemented by Ivan Levkivskyi
419
422
420
423
421
- .. _whatsnew37-devmode :
422
-
423
- Development Runtime Mode: -X dev
424
- --------------------------------
425
-
426
- The new :option: `-X ` ``dev `` command line option or the new
427
- :envvar: `PYTHONDEVMODE ` environment variable can be used to enable
428
- CPython's *development mode *. When in development mode, CPython performs
429
- additional runtime checks which are too expensive to be enabled by default.
430
- See :option: `-X ` ``dev `` documentation for the full description of the effects
431
- of this mode.
432
-
433
-
434
424
.. _whatsnew37-pep552 :
435
425
436
426
PEP 552: Hash-based .pyc Files
@@ -460,6 +450,11 @@ keeping ``.pyc`` files up-to-date.
460
450
461
451
See :ref: `pyc-invalidation ` for more information.
462
452
453
+ .. seealso ::
454
+
455
+ :pep: `552 ` -- Deterministic pycs
456
+ PEP written and implemented by Benjamin Peterson
457
+
463
458
464
459
.. _whatsnew37-pep545 :
465
460
@@ -482,6 +477,19 @@ Three new translations have been added:
482
477
Victor Stinner.
483
478
484
479
480
+ .. _whatsnew37-devmode :
481
+
482
+ Development Runtime Mode: -X dev
483
+ --------------------------------
484
+
485
+ The new :option: `-X ` ``dev `` command line option or the new
486
+ :envvar: `PYTHONDEVMODE ` environment variable can be used to enable
487
+ CPython's *development mode *. When in development mode, CPython performs
488
+ additional runtime checks that are too expensive to be enabled by default.
489
+ See :option: `-X ` ``dev `` documentation for the full description of the effects
490
+ of this mode.
491
+
492
+
485
493
Other Language Changes
486
494
======================
487
495
0 commit comments