Skip to main content

Resolver for Python dotted names.

Project description

The zope.dottedname.resolve module provides a function for resolving dotted names. Dotted names are resolved by importing modules and by getting attributes from imported modules. Names with leading dots are relative.

To illustrate, we’ll use the dotted name resolver to access objects in the os module:

>>> from zope.dottedname.resolve import resolve
>>> resolve('os.path.split').__name__
'split'

Here, we used an absolute name. We can also using a relative name:

>>> resolve('.split').__name__
Traceback (most recent call last):
...
ValueError: relative name without base module

But we need to provide the module the name is relative to:

>>> resolve('.split', 'os.path').__name__
'split'

>>> resolve('..system', 'os.path').__name__
'system'

>>> resolve('...datetime', 'os.path').__name__
'datetime'

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zope.dottedname-3.4.0.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file zope.dottedname-3.4.0.tar.gz.

File metadata

File hashes

Hashes for zope.dottedname-3.4.0.tar.gz
Algorithm Hash digest
SHA256 3a34b0a64cafb476daf5b21057bc6252f89c57214d3842ce176643a7edcea2e5
MD5 8f93e3b279195f77e7e0d200e306cda0
BLAKE2b-256 32c832a46cb44ddf1275e9ae7b31f58870038ed6ec5550dc13abbabaec581a19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page