Creating a top-level main() function
In Chapter 13, Configuration Files and Persistence, we suggested two application configuration design patterns:
- The global property map: In the previous examples, we implemented the global property map with a
Namespace
object created byArgumentParser
. - Object construction: The idea behind object construction was to build the required object instances from the configuration parameters, effectively demoting the global property map to a local property map inside the
main()
function and not saving the properties.
What we showed you in the previous section was the use of a local Namespace
object to collect all of the parameters. From this, we can build the necessary application objects that will do the real work of ...
Get Mastering Object-oriented Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.