Module State and Passed Configuration

A module can hold shared values. Passing configuration explicitly provides a separate way to control which values a call observes.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace a captured setting
  2. Use a consistent snapshot

Trace a captured setting

One caller imports a numeric limit directly and another looks it up on the module. Later reassignment may affect only the qualified reader. Import bindings describe the exact difference.

Use a consistent snapshot

Read external configuration at the entry boundary and pass its relevant fields into each job. Testing two jobs with different limits then needs no global resets. See dependency arguments for choosing a narrow interface.[1]

References

  1. Python Software Foundation, Python Tutorial: Classes ↩