A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/080153.html below:

"chicken and egg" problem with modules and global vars

"chicken and egg" problem with modules and global varsRoman Suzi rnd at onego.ru
Sun Apr 29 16:01:14 EDT 2001
On Sun, 29 Apr 2001, Graham Guttocks wrote:

>Greetings,
>
>I'm running into a sort of "chicken and egg" problem involving
>modules, global variables and getopt command-line arguments and would
>appreciate some direction.

>Any ideas?

1- you can use getopt earlier: command line params usually have
more priority than config-file ones.
2- global vars are bad idea. You can use os.environ to put
configuration (environment) parameters, such as config file, there.
This way globalisms will belong to the environment, not your program ;-)
(its half-joke)

*

I remember one of my programs where I had similar problem:
config file was written relative to argv[0].
So, I needed to determine it first. Thus I conclude you
need to get commandline options before any other config-specific
things. What if they contain only --help ;-)

>Regards,
>Graham
>

Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Sunday, April 29, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "Macho does not prove Mucho." _/




More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4