[python-win32] python print statements

Nalli Dinesh nalli.dinesh at gmail.com
Thu Jan 8 19:12:37 CET 2009


Thanks Vernon, Jim, Micheal.

I kind of knew the different ways of modelling any python application as you
guys have described in your email. I appreciate your inputs though. But I am
looking for a different solution.

Here is what I am looking at -

I do not want to remodel my application at this stage. I have print
statements all over the place. I looking at a solution where, without
touching the print statements at all, I want to tell the python interpreter
to not execute print statements inside my application, when the application
is running. Like, is there a way to tell the Python interpreter do not
bother to execute print lines in my application. Or is there a way to just
define a python builtin variable which dictates executing print statements
or not.

Hope I am able to describe clearly what solution I am looking for.

To my understanding, I do not think any language supports stuff like this.
If I am right about it, then we all know to what level of growth all the s/w
languages must grow too!!!!

On Thu, Jan 8, 2009 at 8:02 AM, Vernon Cole <vernondcole at gmail.com> wrote:

> How about --
>  if debug: print x
> or, in a more complex setting, have a "verbose" attribute in each module
> and --
>  if self.verbose > 2: print x   # so you can have levels of debug printouts
> ??
> --
> Vernon Cole
>
> On Wed, Jan 7, 2009 at 11:30 PM, Michel Claveau <mc at mclaveau.com> wrote:
> > Hi!
> >
> > 1) Define your print function. Example:
> >   def mprint(*par):
> >       for i in par:
> >           print i,
> >       print
> >
> > 2) in your code, replace all  'print'  by  'mprint'
> >
> > 3) when you want cancel the print, modify only the mprint function.
> >
> > @-salutations
> > --
> > Michel Claveau
> > _______________________________________________
> > python-win32 mailing list
> > python-win32 at python.org
> > http://mail.python.org/mailman/listinfo/python-win32
> >
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20090108/716dd831/attachment.htm>


More information about the python-win32 mailing list