Skip to main content

Resolver for Python dotted names.

Project description

Dotted Name Resolution

Overview

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.

Detailed Documentation———————-

Resolution of dotted names

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'

CHANGES

3.4.1 (2007-10-02)

  • Updated package meta-data.

3.4.0 (2007-07-19)

  • Initial Zope-independent release.

Project details


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.1.tar.gz (3.9 kB view hashes)

Uploaded Source

Supported by

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