Re: Application-global "switches"?

2009-09-18 Thread kj
In <579a15bf-83c0-4228-9079-bbaac1222...@o13g2000vbl.googlegroups.com> Marius Gedminas writes: >On Sep 4, 9:29=A0pm, kj wrote: >> The only solution I can come up with is to define a "dummy module", >> say _config.py, which contains only upper-case variables representing >> these global switches

Re: Application-global "switches"?

2009-09-17 Thread Marius Gedminas
On Sep 4, 9:29 pm, kj wrote: > The only solution I can come up with is to define a "dummy module", > say _config.py, which contains only upper-case variables representing > these global switches, and is imported by all the other modules in > the application with the line "from _config import *".  

Re: Application-global "switches"?

2009-09-07 Thread Nick Craig-Wood
kj wrote: > I'm looking for the "best-practice" way to define application-global > read-only switches, settable from the command line. The best > example I can think of of such global switch is the built-in variable > __debug__. This variable is visible everywhere in a program, and > broadl

Re: Application-global "switches"?

2009-09-05 Thread kj
In Ethan Furman writes: >I've seen a couple cool recipes implementing WORM* attributes if you >wanted to ensure that your settings were not re-set. >Steven D'Aprano wrote one with a class name of ConstantNamespace, you >can search on that if you're interested. I'd include the code, but I

Re: Application-global "switches"?

2009-09-04 Thread Ethan Furman
but I wonder if there is a more Pythonic way to do this sort of thing. Is there a best practice for setting such application-global switches? TIA! kynn I've seen a couple cool recipes implementing WORM* attributes if you wanted to ensure that your settings were not re-set. Steven D'

Re: Application-global "switches"?

2009-09-04 Thread Ethan Furman
7;m sure this would work OK, but I wonder if there is a more Pythonic way to do this sort of thing. Is there a best practice for setting such application-global switches? TIA! kynn while 1: try: run_main_code() cleanup() except: while conn_fail(): time.sleep(5.0) fina

Re: Application-global "switches"?

2009-09-04 Thread ici
d-only, since they > most be set at the beginning of the run.  But after this initial > setting, they should remain read-only.) > > I'm sure this would work OK, but I wonder if there is a more Pythonic > way to do this sort of thing.  Is there a best practice for setting

Re: Application-global "switches"?

2009-09-04 Thread Terry Reedy
but I wonder if there is a more Pythonic way to do this sort of thing. Is there a best practice for setting such application-global switches? I believe what you describe above is more or less standard practice. -- http://mail.python.org/mailman/listinfo/python-list

Application-global "switches"?

2009-09-04 Thread kj
f there is a more Pythonic way to do this sort of thing. Is there a best practice for setting such application-global switches? TIA! kynn -- http://mail.python.org/mailman/listinfo/python-list