Skip to content

Commit 2f44acd

Browse files
committed
'import datetime as dt' is preferred, so use another example
1 parent 38ff17b commit 2f44acd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Doc/whatsnew/3.15.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ name:
123123
.. code-block:: python
124124
125125
lazy import json
126-
lazy from datetime import datetime
126+
lazy from pathlib import Path
127127
128-
print("Starting up...") # json and datetime not loaded yet
128+
print("Starting up...") # json and pathlib not loaded yet
129129
130-
data = json.loads('{"key": "value"}') # json gets loads here
131-
now = datetime() # datetime loads here
130+
data = json.loads('{"key": "value"}') # json loads here
131+
p = Path(".") # pathlib loads here
132132
133133
This mechanism is particularly useful for applications that import many
134134
modules at the top level but may only use a subset of them in any given run.

0 commit comments

Comments
 (0)