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


Groups > comp.lang.python > #4008

Re: Argument of the bool function

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'partial': 0.05; 'bool': 0.09; 'lambda:': 0.09; 'target,': 0.09; 'pm,': 0.11; '25,': 0.12; 'wrote:': 0.14; '**kwargs)': 0.16; '**kwargs):': 0.16; '*args,': 0.16; 'better:': 0.16; 'functools': 0.16; 'rachel': 0.16; 'subject:function': 0.16; '\xa0def': 0.16; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'cheers,': 0.20; 'maybe': 0.21; 'header:In- Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'mon,': 0.22; 'received:209.85.161.46': 0.26; 'received:mail- fx0-f46.google.com': 0.26; 'function': 0.27; 'message- id:@mail.gmail.com': 0.28; 'received:209.85.161': 0.29; 'class': 0.29; 'yet': 0.30; 'cc:addr:python.org': 0.31; 'import': 0.32; '...': 0.32; 'received:209.85': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'end': 0.39; 'received:209': 0.39; 'header:Received:5': 0.40; 'order': 0.61; '2011': 0.62; 'care': 0.67; 'schrieb': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=lCbOxkVkee0bQKhoZbB2k/5+xVOVyyCqQvJkuz5Fsyo=; b=pA7XuECCTwNeTpkIdBiugnkXZCRxuUOIdoyIniy6dqBz2SVs4cTtTte+jn7wFA2JqN s+CxVOphqWhMOPgorQrqdLXmSnC+BLUTOxc7rK7b/QHyA1ckbYiJ2ouC+vY+sg7pqVEw oXL58xwzZe/ZCNHWJyrLOqPtb9pB5UwW8V/lA=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=GzE2QL2OipsA4sH9AkbUC7byiwkKeg5Xh4yNtigTYvx80a3L0dFOhCn1OTMBUOtB04 7lbhxahDMah1EXopAXmP8GDPyFFOqkXlihe07jsYj3PgV86XUo1+0A4MGqjpbc12hl6/ /+xOfjvFUkrjYJ5QjqrucytW7h3cOkWqdgHZc=
MIME-Version 1.0
In-Reply-To <ip4p1v$gmf$1@r03.glglgl.eu>
References <4d9f374b$0$12803$426a34cc@news.free.fr> <mailman.154.1302280920.9059.python-list@python.org> <4da1a8b5$0$23679$426a74cc@news.free.fr> <mailman.190.1302440567.9059.python-list@python.org> <inslea$p6d$1@speranza.aioe.org> <ip40gf$i0o$1@r03.glglgl.eu> <ip4p1v$gmf$1@r03.glglgl.eu>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Mon, 25 Apr 2011 17:44:38 -0600
Subject Re: Argument of the bool function
To Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
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.824.1303775109.9059.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 82.94.164.166
X-Trace 1303775110 news.xs4all.nl 41114 [::ffff:82.94.164.166]:48236
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:4008

Show key headers only | View raw


On Mon, Apr 25, 2011 at 3:28 PM, Thomas Rachel
<nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
wrote:
> Am 25.04.2011 16:29, schrieb Thomas Rachel:
>
>> or maybe even better (taking care for closures):
>>
>> function = bool
>> value = 'the well at the end of the world'
>> ## ...
>> actions.append(lambda val=value: function(val))
>> ## ...
>> for function in actions:
>> results.append(function())
>
> Or yet even better:
>
> class Job(object):
>    def __init__(self, target, *args, **kwargs):
>        self.target = lambda: target(*args, **kwargs)
>    def __call__(self):
>        return self.target()
>
> in order to do
>
> actions.append(Job(function, val))
> actions.append(Job(function, x=val))

from functools import partial
actions.append(partial(function, val))
actions.append(partial(function, x=val))

Cheers,
Ian

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


Thread

Re: Argument of the bool function Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-04-25 16:29 +0200
  Re: Argument of the bool function Chris Angelico <rosuav@gmail.com> - 2011-04-26 05:33 +1000
    Re: Argument of the bool function Paul Rubin <no.email@nospam.invalid> - 2011-04-25 16:26 -0700
      Re: Argument of the bool function Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-26 02:38 +0000
  Re: Argument of the bool function Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-04-25 23:28 +0200
    Re: Argument of the bool function Ian Kelly <ian.g.kelly@gmail.com> - 2011-04-25 17:44 -0600

csiph-web