Hi, You could try the C preprocessor. Personally, I'd just go for python's inbult logging framework, and worry about the performance issue later.
Regards On Mon, Jun 8, 2009 at 1:07 AM, Vishal <vsapr...@gmail.com> wrote: > Hello, > We would like to have debug and release versions of our scripts. However > since the scripts are directly used by the 'users' and they are not real > software guys...maintaining two different scripts and then keeping them > synchronized across 15-20 workstations etc is not something that the > management wants. > Scripts are complex enough that we cannot abstract out all the variables > into config files....which might have been easier for users (just change > parameters in a config file) > > *Is there a way to create a conditionally compilable Python script ?* Some > facility that would prevent from code getting compiled into > ".pyc"....something like the old #ifdef #endif preprocessor directives....is > there a Python preprocessory available :) > > if thats doable I can ask them to make all experimental modifications > within the conditional directives. I could still ask them to do that using > simple if's and bool parameters, however, putting too many ifs might degrade > the performance of these scripts. ("the lesser the branches the better it is > for processor performance...more so for super scalar processors") > > We cannot use the, often unknown, __debug__ flag, because our users would > like to simply double-click on a python file, which means to use the -O or > -OO options (which sets __debug__ to False) we'd have to make windows python > command line have these, and then double clicking would be of no use if you > want the run stuff inside the __debug__. > > Any and every help is most welcome :) > > Thanks and best regards, > Vishal Sapre > > On Wed, May 27, 2009 at 1:25 PM, Sam's Lists <samsli...@gmail.com> wrote: > >> Anand--- >> >> Thanks, that worked great. >> >> -Sam >> >> >> On Tue, May 26, 2009 at 7:34 PM, Anand Chitipothu >> <anandol...@gmail.com>wrote: >> >>> > text = "The Price £7" >>> > pattern = u"£\d" >>> > >>> > m = re.search(pattern, text, re.UNICODE) >>> > print m.group(0) >>> >>> Your text is in utf-8 encoding and pattern in unicode. >>> Make text unicode solves the issue. >>> >>> text = u"The Price £7" >>> pattern = u"£\d" >>> m = re.search(pattern, text, re.UNICODE) >>> print m.group(0).encode('utf-8') >>> >>> Anand >>> _______________________________________________ >>> BangPypers mailing list >>> BangPypers@python.org >>> http://mail.python.org/mailman/listinfo/bangpypers >>> >> >> >> _______________________________________________ >> BangPypers mailing list >> BangPypers@python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> >> > > > -- > Thanks and best regards, > Vishal Sapre > > --- > > "So say...Day by day, in every way, I am getting better, better and better > !!!" > "A Strong and Positive attitude creates more miracles than anything else. > Because...Life is 10% how you make it, and 90% how you take it" > "Diamond is another piece of coal that did well under pressure” > "Happiness keeps u Sweet, Trials keep u Strong, > Sorrow keeps u Human, Failure Keeps u Humble, > Success keeps u Glowing, But only God Keeps u Going.....Keep Going....." > > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > > -- I am but a man.
_______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers