Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #15851

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

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'argument,': 0.09; 'lambda:': 0.09; 'none):': 0.09; 'def': 0.14; 'argument': 0.15; 'arg2,': 0.16; 'dummy': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; "function's": 0.16; 'lambda': 0.16; 'msg:': 0.16; 'subject:pass': 0.16; 'received:74.125.82.44': 0.17; 'received:mail-ww0-f44.google.com': 0.17; 'wrote:': 0.18; 'specifies': 0.18; '(or': 0.22; 'expense': 0.23; 'header:In-Reply- To:1': 0.23; 'function': 0.27; 'not.': 0.27; 'fine.': 0.28; 'message-id:@mail.gmail.com': 0.29; 'definition': 0.30; 'subject:?': 0.31; 'nov': 0.31; 'pm,': 0.31; 'to:addr:python- list': 0.32; 'that,': 0.33; 'message.': 0.34; 'subject:What': 0.34; 'something': 0.36; 'fri,': 0.36; 'else,': 0.36; 'received:74.125.82': 0.37; 'think': 0.37; 'could': 0.38; 'received:google.com': 0.38; 'some': 0.38; 'received:74.125': 0.39; 'help': 0.39; "it's": 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.39; 'skip:_ 10': 0.40; 'skip:l 20': 0.40; 'your': 0.61; 'john': 0.62; '2011': 0.62; 'hand,': 0.76; 'subject:should': 0.84; '1:18': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=0ksfMMPrwmfLYaENZqL6hUhTUk5Gk2yDgayOHcXBzX0=; b=KyOQ9SL8fJj4no2bh/EvdeA2yfsNUA65RgdpM/jilgU6lBEa1QWnuqlAoCcE8J3eHC s6tcgEWgHPfOaN0ndxzH9QsomJGNY+0orXMrb+RB8CpJIzrETME2mnrTtN76lWFi4Kpp vsfyk+XADhpK+ijrrR5q2ABWaTGQspV/1O0gM=
MIME-Version 1.0
In-Reply-To <27955957.352.1321582691251.JavaMail.geo-discussion-forums@prap37>
References <27955957.352.1321582691251.JavaMail.geo-discussion-forums@prap37>
Date Fri, 18 Nov 2011 13:59:13 +1100
Subject Re: What exactly is "pass"? What should it be?
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2814.1321585155.27778.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1321585155 news.xs4all.nl 6902 [2001:888:2000:d::a6]:56235
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:15851

Show key headers only | View raw


On Fri, Nov 18, 2011 at 1:18 PM, John Ladasky <ladasky@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 = lambda msg: None):

Other than that, I think it's fine. (Actually, the lambda has a slight
advantage in self-documentation; in the main function's definition it
specifies that the 'report' argument is a function that takes one
argument, the message. (Or whatever that argument is. Name it
appropriately.)

If you call your dummy function something else, it may help
readability/self-documentation too. On the other hand, it may not.
YMMV.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

What exactly is "pass"?  What should it be? John Ladasky <ladasky@my-deja.com> - 2011-11-17 18:18 -0800
  Re: What exactly is "pass"? What should it be? Chris Rebert <clp2@rebertia.com> - 2011-11-17 18:45 -0800
    Re: What exactly is "pass"? What should it be? John Ladasky <ladasky@my-deja.com> - 2011-11-17 21:03 -0800
    Re: What exactly is "pass"? What should it be? John Ladasky <ladasky@my-deja.com> - 2011-11-17 21:03 -0800
  Re: What exactly is "pass"? What should it be? Chris Angelico <rosuav@gmail.com> - 2011-11-18 13:59 +1100
    Re: What exactly is "pass"? What should it be? alex23 <wuwei23@gmail.com> - 2011-11-17 22:04 -0800
  Re: What exactly is "pass"? What should it be? Dominic Binks <dbinks@codeaurora.org> - 2011-11-17 19:01 -0800
  Re: What exactly is "pass"?  What should it be? Ben Finney <ben+python@benfinney.id.au> - 2011-11-18 14:45 +1100
  Re: What exactly is "pass"?  What should it be? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-11-17 20:34 -0800
    Re: What exactly is "pass"?  What should it be? John Ladasky <ladasky@my-deja.com> - 2011-11-17 21:07 -0800
      Re: What exactly is "pass"? What should it be? Chris Angelico <rosuav@gmail.com> - 2011-11-18 16:34 +1100
      Re: What exactly is "pass"? What should it be? Chris Rebert <clp2@rebertia.com> - 2011-11-17 21:49 -0800
      Re: What exactly is "pass"?  What should it be? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-18 06:07 +0000
    Re: What exactly is "pass"?  What should it be? John Ladasky <ladasky@my-deja.com> - 2011-11-17 21:07 -0800
    Re: What exactly is "pass"?  What should it be? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-11-18 10:57 +0100
  Re: What exactly is "pass"?  What should it be? MRAB <python@mrabarnett.plus.com> - 2011-11-18 13:03 +0000

csiph-web