Skip to content

Commit bfffc49

Browse files
authored
PEP 810: rename get() to resolve() (#4653)
1 parent 5a1000a commit bfffc49

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

peps/pep-0810.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ Lazy modules, as well as names lazy imported from modules, are represented
368368
by :class:`!types.LazyImportType` instances, which are resolved to the real
369369
object (reified) before they can be used. This reification is usually done
370370
automatically (see below), but can also be done by calling the lazy object's
371-
``get`` method.
371+
``resolve`` method.
372372

373373
Lazy import mechanism
374374
---------------------
@@ -493,8 +493,8 @@ Example using ``__dict__`` from external code:
493493
However, calling ``globals()`` does **not** trigger reification -- it returns
494494
the module's dictionary, and accessing lazy objects through that dictionary
495495
still returns lazy proxy objects that need to be manually reified upon use. A
496-
lazy object can be resolved explicitly by calling the ``get`` method. Other,
497-
more indirect ways of accessing arbitrary globals (e.g. inspecting
496+
lazy object can be resolved explicitly by calling the ``resolve`` method.
497+
Other, more indirect ways of accessing arbitrary globals (e.g. inspecting
498498
``frame.f_globals``) also do **not** reify all the objects.
499499

500500
Example using ``globals()``:
@@ -510,8 +510,8 @@ Example using ``globals()``:
510510
print('json' in sys.modules) # False - still lazy
511511
print(type(g['json'])) # <class 'LazyImport'>
512512
513-
# Explicitly reify using the get() method
514-
resolved = g['json'].get()
513+
# Explicitly reify using the resolve() method
514+
resolved = g['json'].resolve()
515515
516516
print(type(resolved)) # <class 'module'>
517517
print('json' in sys.modules) # True - now loaded
@@ -1252,7 +1252,7 @@ Can I force reification of a lazy import without using it?
12521252
----------------------------------------------------------
12531253

12541254
Yes, accessing a module's ``__dict__`` will reify all lazy objects in that
1255-
module. Individual lazy objects can be resolved by calling their ``get()``
1255+
module. Individual lazy objects can be resolved by calling their ``resolve()``
12561256
method.
12571257

12581258
What's the difference between ``globals()`` and ``mod.__dict__`` for lazy imports?

0 commit comments

Comments
 (0)