Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.116 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.77; '*S*': 0.00; 'way:': 0.09; 'itertools': 0.16; 'library': 0.18; 'looked': 0.18; 'skip:f 30': 0.19; 'print': 0.22; 'header:User-Agent:1': 0.23; 'initial': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'wondering': 0.29; 'subject:list': 0.30; 'subject:that': 0.31; 'me?': 0.32; 'maybe': 0.34; 'could': 0.34; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'subject:?': 0.36; 'hi,': 0.36; 'list': 0.37; 'needed': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'times': 0.62; 'such': 0.63; 'series': 0.66; 'subject:there': 0.68; 'subjectcharset:utf-8': 0.72; 'obvious': 0.74 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 28 Aug 2013 14:17:45 +0100 From: ishish To: Subject: Re: Is there a function that applies list of functions to a =?UTF-8?Q?value=3F?= In-Reply-To: References: X-Sender: ishish@domhain.de User-Agent: RoundCube Webmail/0.7.1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1377695867 news.xs4all.nl 15977 [2001:888:2000:d::a6]:34901 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53154 Am 28.08.2013 13:52, schrieb AdamKal: > Hi, > > From time to time I have to apply a series of functions to a value in > such a way: > > func4(func3(func2(func1(myval)))) > > I was wondering if there is a function in standard library that would > take a list of functions and a initial value and do the above like > this: > > func_im_looking_for([func1, func2, func3, func4], myval) > > I looked in itertools but nothing seamed to do the job. This seams > like something vary obvious that was needed many times elsewhere so > maybe you could help me? You could try somthing like: myval = 'whatever' for i in range(1,4): print eval("func%s(%s)" % (i, myval))