Re: What exactly is pass? What should it be?

2011-11-18 Thread Thomas Rachel
Am 18.11.2011 05:34 schrieb Dennis Lee Bieber: def _pass(*args): pass def long_running_process(arg1, arg2, arg_etc, report = _pass): result1 = do_stuff() report(result1) So this is a call to a function that just returns a None, which is dropped by the interpreter... I'm

Re: What exactly is pass? What should it be?

2011-11-18 Thread MRAB
On 18/11/2011 04:34, Dennis Lee Bieber wrote: On Thu, 17 Nov 2011 18:18:11 -0800 (PST), John Ladasky lada...@my-deja.com declaimed the following in gmane.comp.python.general: I'm trying to write tidy, modular code which includes a long-running process. From time to time I MIGHT like to

What exactly is pass? What should it be?

2011-11-17 Thread John Ladasky
Hi folks, I'm trying to write tidy, modular code which includes a long-running process. From time to time I MIGHT like to check in on the progress being made by that long-running process, in various ways. Other times, I'll just want to let it run. So I have a section of code which,

Re: What exactly is pass? What should it be?

2011-11-17 Thread Chris Rebert
On Thu, Nov 17, 2011 at 6:18 PM, John Ladasky lada...@my-deja.com wrote: Hi folks, I'm trying to write tidy, modular code which includes a long-running process.  From time to time I MIGHT like to check in on the progress being made by that long-running process, in various ways.  Other

Re: What exactly is pass? What should it be?

2011-11-17 Thread Chris Angelico
On Fri, Nov 18, 2011 at 1:18 PM, John Ladasky lada...@my-deja.com wrote: def _pass(*args):    pass def long_running_process(arg1, arg2, arg_etc, report = _pass): For some compactness at the expense of brevity, you could use a lambda: def long_running_process(arg1, arg2, arg_etc, report =

Re: What exactly is pass? What should it be?

2011-11-17 Thread Dominic Binks
On 11/17/2011 6:45 PM, Chris Rebert wrote: On Thu, Nov 17, 2011 at 6:18 PM, John Ladaskylada...@my-deja.com wrote: Hi folks, I'm trying to write tidy, modular code which includes a long-running process. From time to time I MIGHT like to check in on the progress being made by that

Re: What exactly is pass? What should it be?

2011-11-17 Thread Ben Finney
John Ladasky lada...@my-deja.com writes: So, pass does not appear to be a function, nor even an object. Is it nothing more than a key word? Yes. Unlike some languages where the program is a collection of expressions, a Python program is a series of statements which themselves may or may not be

Re: What exactly is pass? What should it be?

2011-11-17 Thread John Ladasky
On Thursday, November 17, 2011 6:45:58 PM UTC-8, Chris Rebert wrote: Seems fine to me (good use of the null object pattern), although I might define _pass() to instead take exactly 1 argument, since that's all you ever call report() with in your example. Oops, I over-simplified the calls to

Re: What exactly is pass? What should it be?

2011-11-17 Thread John Ladasky
On Thursday, November 17, 2011 8:34:22 PM UTC-8, Dennis Lee Bieber wrote: On Thu, 17 Nov 2011 18:18:11 -0800 (PST), John Ladasky lad...@my-deja.com declaimed the following in gmane.comp.python.general: def _pass(*args): pass This is the equivalent of def _pass(*args):

Re: What exactly is pass? What should it be?

2011-11-17 Thread Chris Angelico
On Fri, Nov 18, 2011 at 4:07 PM, John Ladasky lada...@my-deja.com wrote: One of my questions was: would there be any merit to having the Python pass token itself defined exactly as _pass() is defined above? No, there wouldn't. The Python 'pass' statement is a special statement that indicates a

Re: What exactly is pass? What should it be?

2011-11-17 Thread Chris Rebert
On Thu, Nov 17, 2011 at 9:34 PM, Chris Angelico ros...@gmail.com wrote: On Fri, Nov 18, 2011 at 4:07 PM, John Ladasky lada...@my-deja.com wrote: One of my questions was: would there be any merit to having the Python pass token itself defined exactly as _pass() is defined above? No, there

Re: What exactly is pass? What should it be?

2011-11-17 Thread alex23
On Nov 18, 12:59 pm, Chris Angelico ros...@gmail.com wrote: If you call your dummy function something else, it may help readability/self-documentation too. Or replace the pass with a docstring for the same effect: def silent(*args): Null Object to repress reporting --

Re: What exactly is pass? What should it be?

2011-11-17 Thread Steven D'Aprano
On Thu, 17 Nov 2011 21:07:23 -0800, John Ladasky wrote: One of my questions was: would there be any merit to having the Python pass token itself defined exactly as _pass() is defined above? No. The pass statement compiles to nothing at all. Your _pass() function compiles to a function