Re: List of Functions

2016-03-28 Thread Christian Gollwitzer
Am 29.03.16 um 08:21 schrieb Rustom Mody: Dijkstra liked to point out that CS was backward in America compared to Europe because in Europe they used 'store' but Americans used anthropomorphism like memory Now given that store can mean -- among other things -- - room where I dump stuff - shop wh

Re: List of Functions

2016-03-28 Thread Marko Rauhamaa
Rustom Mody : > And my mum made the strange remark: "You guys use all the words that I > know. And you make them into sentences that have no meaning at all." That's what I think when I hear Estonian spoken. > My own finding is that repurposing old words to new concepts causes > more confusion an

Re: List of Functions

2016-03-28 Thread Rustom Mody
On Tuesday, March 29, 2016 at 8:16:12 AM UTC+5:30, Ben Bacarisse wrote: > Steven D'Aprano writes: > > > On Mon, 28 Mar 2016 06:51 pm, Jussi Piitulainen wrote: > > > >> Ben Bacarisse writes: > >> > >>> It's shame that anonymous functions (for that's what's being returned > >>> here -- a function w

Re: List of Functions

2016-03-28 Thread Chris Angelico
On Tue, Mar 29, 2016 at 3:45 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Tue, Mar 29, 2016 at 12:40 AM, Marko Rauhamaa wrote: >>> Dan Sommers : >>> On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: > As for Python, I don't feel a great need for anonymous functions.

Re: List of Functions

2016-03-28 Thread Marko Rauhamaa
Steven D'Aprano : > On Tue, 29 Mar 2016 08:40 am, Chris Angelico wrote: > >> On Tue, Mar 29, 2016 at 12:40 AM, Marko Rauhamaa wrote: >>> Dan Sommers : >>> On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: > As for Python, I don't feel a great need for anonymous functions. > H

Re: List of Functions

2016-03-28 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Mar 29, 2016 at 12:40 AM, Marko Rauhamaa wrote: >> Dan Sommers : >> >>> On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: >>> As for Python, I don't feel a great need for anonymous functions. However, I keep running into a need for anonymous classes, o

Re: List of Functions

2016-03-28 Thread Chris Angelico
On Tue, Mar 29, 2016 at 1:45 PM, Ben Bacarisse wrote: > If functions were defined > > fun f(x): return x * x > > then an anonymous function could be written as a function definition but > the name > > fun (x): return x * x > > I suppose you could do that even with "def" but it's a bit less > m

Re: List of Functions

2016-03-28 Thread Ben Bacarisse
Steven D'Aprano writes: > On Mon, 28 Mar 2016 06:51 pm, Jussi Piitulainen wrote: > >> Ben Bacarisse writes: >> >>> It's shame that anonymous functions (for that's what's being returned >>> here -- a function with no name) were born of a subject that used >>> arbitrary Greek letters for things.

Re: List of Functions

2016-03-28 Thread Rustom Mody
On Tuesday, March 29, 2016 at 5:11:02 AM UTC+5:30, Steven D'Aprano wrote: > On Mon, 28 Mar 2016 06:51 pm, Jussi Piitulainen wrote: > > > Ben Bacarisse writes: > > > >> It's shame that anonymous functions (for that's what's being returned > >> here -- a function with no name) were born of a subjec

Re: List of Functions

2016-03-28 Thread Chris Angelico
On Tue, Mar 29, 2016 at 10:50 AM, Random832 wrote: > On Mon, Mar 28, 2016, at 19:40, Steven D'Aprano wrote: >> Not to mention "Monad". I don't think *anyone* knows what a Monad is ;-) > > A monad is just a monoid in the category of endofunctors; what's the > problem? > > Well, someone had to say i

Re: List of Functions

2016-03-28 Thread Random832
On Mon, Mar 28, 2016, at 19:40, Steven D'Aprano wrote: > Not to mention "Monad". I don't think *anyone* knows what a Monad is ;-) A monad is just a monoid in the category of endofunctors; what's the problem? Well, someone had to say it. -- https://mail.python.org/mailman/listinfo/python-list

Re: List of Functions

2016-03-28 Thread Steven D'Aprano
On Mon, 28 Mar 2016 06:51 pm, Jussi Piitulainen wrote: > Ben Bacarisse writes: > >> It's shame that anonymous functions (for that's what's being returned >> here -- a function with no name) were born of a subject that used >> arbitrary Greek letters for things. We seem stuck with the mysterious

Re: List of Functions

2016-03-28 Thread Chris Angelico
On Tue, Mar 29, 2016 at 9:52 AM, Steven D'Aprano wrote: > That would be called "type" :-) > > type(name, bases, namespace) returns a new class: > > > py> C = type("MyClass", (object,), {'foo': 1}) > py> C > > py> C.foo > 1 Yeah, but to do that in a single expression, you need to have all the fun

Re: List of Functions

2016-03-28 Thread Steven D'Aprano
On Tue, 29 Mar 2016 08:40 am, Chris Angelico wrote: > On Tue, Mar 29, 2016 at 12:40 AM, Marko Rauhamaa wrote: >> Dan Sommers : >> >>> On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: >>> As for Python, I don't feel a great need for anonymous functions. However, I keep running i

Re: List of Functions

2016-03-28 Thread Chris Angelico
On Tue, Mar 29, 2016 at 12:40 AM, Marko Rauhamaa wrote: > Dan Sommers : > >> On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: >> >>> As for Python, I don't feel a great need for anonymous functions. >>> However, I keep running into a need for anonymous classes, or, >>> rather, classless o

Re: List of Functions

2016-03-28 Thread Marko Rauhamaa
Dan Sommers : > On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: > >> As for Python, I don't feel a great need for anonymous functions. >> However, I keep running into a need for anonymous classes, or, >> rather, classless objects. Not a biggie. I just create a one-off >> inner class and

Re: List of Functions

2016-03-28 Thread Dan Sommers
On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: > As for Python, I don't feel a great need for anonymous functions. > However, I keep running into a need for anonymous classes, or, rather, > classless objects. Not a biggie. I just create a one-off inner class > and instantiate it, but I

Re: List of Functions

2016-03-28 Thread Marko Rauhamaa
Jussi Piitulainen : > Ben Bacarisse writes: >> It's shame that anonymous functions (for that's what's being returned >> here -- a function with no name) were born of a subject that used >> arbitrary Greek letters for things. We seem stuck with the mysterious >> but meaningless "lambda" for a very

Re: List of Functions

2016-03-28 Thread Jussi Piitulainen
Ben Bacarisse writes: > It's shame that anonymous functions (for that's what's being returned > here -- a function with no name) were born of a subject that used > arbitrary Greek letters for things. We seem stuck with the mysterious > but meaningless "lambda" for a very simple and useful idea.

Re: List of Functions

2016-03-27 Thread Ben Bacarisse
Richard Riehle writes: > Several months ago, I posted a question regarding how to create a list > of functions. > I realize that this seems trivial to many experience Pythonistas. But > it might prove useful for those who are relative newcomers to the > language. In any case,

Re: List of Functions

2016-03-27 Thread Erik
Hi Richard, On 27/03/16 20:38, Richard Riehle wrote: I realize that this seems trivial to many experience Pythonistas. But it might prove useful for those who are relative newcomers Thanks for sharing your solution (people finding the original question because it happens to match their own

List of Functions

2016-03-27 Thread Richard Riehle
Several months ago, I posted a question regarding how to create a list of functions. I quickly solved the problem on my own, but I am just now getting around to sharing my solution. It was actually quite simple, and also quite useful for the problem I had at hand. Below is an example of one

Re: Calling a list of functions

2015-12-13 Thread Anand
On Sunday, December 13, 2015 at 9:26:52 AM UTC-8, Ganesh Pal wrote: > Hi Team, > > Iam on linux and python 2.7 . I have a bunch of functions which I > have run sequentially . > I have put them in a list and Iam calling the functions in the list as > shown below , this works fine for me , please

Re: Calling a list of functions

2015-12-13 Thread Chris Angelico
On Mon, Dec 14, 2015 at 1:43 PM, Steven D'Aprano wrote: > Why do people do this? > > "Hi, here's a cake a made earlier, I think it tastes really nice. What do > you think?" > > "That's not a cake. It's a bowl of mud with a cherry on top. Where is the > actual cake?" Steven, haven't you ever had a

Re: Calling a list of functions

2015-12-13 Thread Steven D'Aprano
On Mon, 14 Dec 2015 04:26 am, Ganesh Pal wrote: > Hi Team, > > Iam on linux and python 2.7 . I have a bunch of functions which I > have run sequentially . > I have put them in a list and Iam calling the functions in the list as > shown below , this works fine for me , No it doesn't. It doesn

Re: Calling a list of functions

2015-12-13 Thread Grant Edwards
On 2015-12-13, Ganesh Pal wrote: > Hi Team, > > Iam on linux and python 2.7 . I have a bunch of functions which I > have run sequentially . I have put them in a list and Iam calling the > functions in the list as shown below , this works fine for me , > please share your opinion/views on the same

Re: Calling a list of functions

2015-12-13 Thread Ian Kelly
please share your > opinion/views on the same > > > Sample code : > > def print1(): > print "one" > > def print2(): > print "two" > > def print3(): > print "three" > > print_test = [print1(),print2(),print3()] //call

Re: Calling a list of functions

2015-12-13 Thread Peter Otten
Ganesh Pal wrote: > Hi Team, > > Iam on linux and python 2.7 . I have a bunch of functions which I > have run sequentially . > I have put them in a list and Iam calling the functions in the list as > shown below , this works fine for me , please share your > opinion/views on the same > > > S

Re: Calling a list of functions

2015-12-13 Thread BartC
On 13/12/2015 17:26, Ganesh Pal wrote: Iam on linux and python 2.7 . I have a bunch of functions which I have run sequentially . I have put them in a list and Iam calling the functions in the list as shown below , this works fine for me , please share your opinion/views on the same Sample c

Calling a list of functions

2015-12-13 Thread Ganesh Pal
Hi Team, Iam on linux and python 2.7 . I have a bunch of functions which I have run sequentially . I have put them in a list and Iam calling the functions in the list as shown below , this works fine for me , please share your opinion/views on the same Sample code : def print1(): print "

Re: Is there a function that applies list of functions to a value?

2013-08-30 Thread Fabrice Pombet
On Friday, August 30, 2013 8:36:40 AM UTC+2, alex23 wrote: > On 30/08/2013 4:17 PM, fp2...@gmail.com wrote: > > > On Wednesday, August 28, 2013 8:50:53 PM UTC+2, Josh English wrote: > > >> def compose(*funcs): > > >> for func in funcs: > > >> if not callable(func): > > >>

Re: Is there a function that applies list of functions to a value?

2013-08-30 Thread Fabrice Pombet
On Friday, August 30, 2013 8:23:44 AM UTC+2, alex23 wrote: > On 30/08/2013 4:14 PM, fp2...@gmail.com wrote: > > > For this purpose however, I suspect that a named function with a proper > > docstring that can be imported and reused over and over again is probably > > more appropriate than a lamb

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread alex23
On 30/08/2013 4:17 PM, fp2...@gmail.com wrote: On Wednesday, August 28, 2013 8:50:53 PM UTC+2, Josh English wrote: def compose(*funcs): for func in funcs: if not callable(func): raise ValueError('Must pass callable functions') Imho still, the ValueError you are rais

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread alex23
On 30/08/2013 4:14 PM, fp2...@gmail.com wrote: For this purpose however, I suspect that a named function with a proper docstring that can be imported and reused over and over again is probably more appropriate than a lambda Given that in Chris' example the lambda was returned from a factory,

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread fp2161
On Wednesday, August 28, 2013 8:50:53 PM UTC+2, Josh English wrote: > Reduce tricks are nice, but I prefer clarity sometimes: > > > > def double(x): > > return x*2 > > > > def add3(x): > > return x+3 > > > > > > def compose(*funcs): > > for func in funcs: > > if n

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread fp2161
On Thursday, August 29, 2013 11:35:39 PM UTC+2, Chris Angelico wrote: > On Fri, Aug 30, 2013 at 7:27 AM, wrote: > > > Chris, call me a snob, but I resent using lambdas (aren't they usually > > considered odd/bad practice in python?) > > > > They're not bad practice; all they are is a functio

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread fp2161
On Friday, August 30, 2013 4:09:45 AM UTC+2, Steven D'Aprano wrote: > On Thu, 29 Aug 2013 13:50:39 -0700, fp2161 wrote: > > > > > My way is so obvious that it may not be that interesting... > > > > > > def func4(f1,f2,f3,f4): > > > def anon(x): > > > f1(f2(f3(f4(x > > >

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread Terry Reedy
On 8/29/2013 5:48 PM, fp2...@gmail.com wrote: Here is the generalisable version: def comp(*func): def anon(x): res=x for f in func: res=f(res) return res return anon With a bit more work, one can set the __name__ and __qualname__ attributes.

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread Chris Angelico
On Fri, Aug 30, 2013 at 7:27 AM, wrote: > Chris, call me a snob, but I resent using lambdas (aren't they usually > considered odd/bad practice in python?) They're not bad practice; all they are is a function without a name, that's restricted to returning a single expression. So they're perfectl

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread Steven D'Aprano
On Thu, 29 Aug 2013 14:27:23 -0700, fp2161 wrote: > Chris, call me a snob, but I resent using lambdas (aren't they usually > considered odd/bad practice in python?) Only among people who dislike functional programming idioms. Like GvR. It is true that lambda functions are slightly restricted com

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread Steven D'Aprano
On Thu, 29 Aug 2013 13:50:39 -0700, fp2161 wrote: > My way is so obvious that it may not be that interesting... > > def func4(f1,f2,f3,f4): > def anon(x): > f1(f2(f3(f4(x > return anon I don't think "obvious" is quite the right description. Well, perhaps "obviously wrong" :-

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread fp2161
4(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([

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread fp2161
On Thursday, August 29, 2013 11:05:38 PM UTC+2, Chris Angelico wrote: > On Fri, Aug 30, 2013 at 6:50 AM, wrote: > > > My way is so obvious that it may not be that interesting... > > > > > > def func4(f1,f2,f3,f4): > > > def anon(x): > > > f1(f2(f3(f4(x > > > return anon

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread fp2161
On Thursday, August 29, 2013 11:05:38 PM UTC+2, Chris Angelico wrote: > On Fri, Aug 30, 2013 at 6:50 AM, wrote: > > > My way is so obvious that it may not be that interesting... > > > > > > def func4(f1,f2,f3,f4): > > > def anon(x): > > > f1(f2(f3(f4(x > > > return anon

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread Chris Angelico
On Fri, Aug 30, 2013 at 6:50 AM, wrote: > My way is so obvious that it may not be that interesting... > > def func4(f1,f2,f3,f4): > def anon(x): > f1(f2(f3(f4(x > return anon Or have it return the result of f1. And then, since it's an anonymous function that simply returns an

Re: Is there a function that applies list of functions to a value?

2013-08-29 Thread fp2161
tion 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 >

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Josh English
Reduce tricks are nice, but I prefer clarity sometimes: def double(x): return x*2 def add3(x): return x+3 def compose(*funcs): for func in funcs: if not callable(func): raise ValueError('Must pass callable functions') def inner(value): for func in fu

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread AdamKal
W dniu środa, 28 sierpnia 2013 15:43:39 UTC+2 użytkownik Tim Chase napisał: > When 3 replies from 3 people all arrive within minutes, each > suggesting reduce(), I'd figure it's the "one obvious way to do > it" :-) I guess it's at least a good hint ;) Thanks to all! :) -- http://mail.pytho

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Tim Chase
On 2013-08-28 06:23, AdamKal wrote: > Thanks! > > I guess this is as simple as it gets then. I was just looking for > the "one obvious way to do it". When 3 replies from 3 people all arrive within minutes, each suggesting reduce(), I'd figure it's the "one obvious way to do it" :-) -tkc --

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Chris Angelico
On Wed, Aug 28, 2013 at 11:23 PM, AdamKal wrote: > I guess this is as simple as it gets then. I was just looking for the "one > obvious way to do it". The one obvious way to do some things is to post on python-list and see what comes back :) I love reading over these sorts of threads, they're go

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Thomas Rachel
Am 2013-08-28 14: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

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread AdamKal
f 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 abo

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Jussi Piitulainen
Tim Chase writes: > On 2013-08-28 05:52, AdamKal wrote: > > 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

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread ishish
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

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Jussi Piitulainen
AdamKal writes: > 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 va

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Tim Chase
On 2013-08-28 05:52, AdamKal wrote: > 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 ini

Is there a function that applies list of functions to a value?

2013-08-28 Thread 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(

Re: How to create a list of functions depending on a parameter?

2009-05-27 Thread Luis Zarrabeitia
On Tuesday 26 May 2009 05:00:14 am Paul Rudin wrote: > > class Foo(object): > > def __init__(self, pos): > self.pos = pos > > def __call__(self, arg): > return self.pos + arg > > f = [Foo(x) for x in range(10)] Or, without the class: In [1]: def get_incrementor(n): ...:

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Scott David Daniels
enzo michelangeli wrote: Let's suppose I want to create a list of n functions of a single argument, returning the sum between argument and index in the list, so that e.g.: f[0](10) will return 10 f[3](12) will return 15 ...and so on. I had naively though of coding: f = [lambda x: x+j for j in

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Diez B. Roggisch
Arnaud Delobelle wrote: > "Diez B. Roggisch" writes: > >> You need to capture n into the closure of the lambda: >> >> f = [lambda x, n=n: x+j for j in xrange(n)] > > You mean [lambda x, j=j: x+j for j in xrange(n)] Ah, sorry, parentheses-problem. Diez -- http://mail.python.org/mailman/li

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Diez B. Roggisch
Paul Rudin wrote: > "Diez B. Roggisch" writes: > >> enzo michelangeli schrieb: >>> Let's suppose I want to create a list of n functions of a single >>> argument, returning the sum between argument and index in the list, so >>> that e.g.: >>> >>> f[0](10) will return 10 >>> f[3](12) will return 1

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread enzo michelangeli
Thanks guys. So far I had only come out with f = [eval('lambda x: x+'+str(j)) for j in range(3)] ...which I hated because, as everybody knows, eval is evil :-) Enzo On May 26, 5:20 pm, Arnaud Delobelle wrote: > "Diez B. Roggisch" writes: > > > You need to capture n into the closure of the lam

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Arnaud Delobelle
"Diez B. Roggisch" writes: > You need to capture n into the closure of the lambda: > > f = [lambda x, n=n: x+j for j in xrange(n)] You mean [lambda x, j=j: x+j for j in xrange(n)] Another way would be [(lambda j:lambda x: x+j)(j) for j in xrange(n)] Or more readably: def adder(n): return

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Paul Rudin
"Diez B. Roggisch" writes: > enzo michelangeli schrieb: >> Let's suppose I want to create a list of n functions of a single >> argument, returning the sum between argument and index in the list, so >> that e.g.: >> >> f[0](10) will return 10 >> f[3](12) will return 15 >> >> ...and so on. I had na

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Diez B. Roggisch
enzo michelangeli schrieb: Let's suppose I want to create a list of n functions of a single argument, returning the sum between argument and index in the list, so that e.g.: f[0](10) will return 10 f[3](12) will return 15 ...and so on. I had naively though of coding: f = [lambda x: x+j for j

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Paul Rudin
enzo michelangeli writes: > Let's suppose I want to create a list of n functions of a single > argument, returning the sum between argument and index in the list, so > that e.g.: > > f[0](10) will return 10 > f[3](12) will return 15 > > ...and so on. I had naively though of coding: > > f = [lamb

How to create a list of functions depending on a parameter?

2009-05-26 Thread enzo michelangeli
Let's suppose I want to create a list of n functions of a single argument, returning the sum between argument and index in the list, so that e.g.: f[0](10) will return 10 f[3](12) will return 15 ...and so on. I had naively though of coding: f = [lambda x: x+j for j in range(n)] Unfortunately,

Re: Get a list of functions in a file

2008-12-29 Thread member Basu
Thanks for all your replies, but the thing is I want to get the list of functions in that file itself, not by importing it as a module. I've decided to go with a class-based approach due to a number of other reasons, but I'm still interested in a way to get function name in that f

Re: Get a list of functions in a file

2008-12-29 Thread Terry Reedy
member Basu wrote: I'm putting some utility functions in a file and then building a simple shell interface to them. Is their some way I can automatically get a list of all the functions in the file? I could wrap them in a class and then use attributes, but I'd rather leave them as simple functi

Re: Get a list of functions in a file

2008-12-29 Thread Aaron Brady
On Dec 29, 3:50 am, "Chris Rebert" wrote: > On Sun, Dec 28, 2008 at 11:26 PM, member Basu wrote: > > I'm putting some utility functions in a file and then building a simple > > shell interface to them. Is their some way I can automatically get a list of > > all the functions in the file? I could

Re: Get a list of functions in a file

2008-12-29 Thread Gabriel Genellina
En Mon, 29 Dec 2008 05:26:52 -0200, member Basu escribió: I'm putting some utility functions in a file and then building a simple shell interface to them. Is their some way I can automatically get a list of all the functions in the file? I could wrap them in a class and then use attributes,

Re: Get a list of functions in a file

2008-12-29 Thread Chris Rebert
On Sun, Dec 28, 2008 at 11:26 PM, member Basu wrote: > I'm putting some utility functions in a file and then building a simple > shell interface to them. Is their some way I can automatically get a list of > all the functions in the file? I could wrap them in a class and then use > attributes, but

Get a list of functions in a file

2008-12-28 Thread member Basu
I'm putting some utility functions in a file and then building a simple shell interface to them. Is their some way I can automatically get a list of all the functions in the file? I could wrap them in a class and then use attributes, but I'd rather leave them as simple functions. Thanks, Basu -- ht

Re: Executing a list of functions

2007-03-19 Thread Alex Martelli
HMS Surprise <[EMAIL PROTECTED]> wrote: ... > Why is apply deprecated? Because it does exacly the same job as just calling the function with *a/**k, and there should preferably be only one obvious way to perform a given task (this guiding principle leads to simplicity in the language, and is co

Re: Executing a list of functions

2007-03-19 Thread HMS Surprise
On Mar 16, 6:44 pm, James Stroud <[EMAIL PROTECTED]> wrote: > HMS Surprise wrote: > > Seems to me that one should be able to put the names of several > > functions in a list and then have the list executed. But it seems the > > output of the functions is hidden, only their return value is visible.

Re: Executing a list of functions

2007-03-16 Thread James Stroud
HMS Surprise wrote: > Seems to me that one should be able to put the names of several > functions in a list and then have the list executed. But it seems the > output of the functions is hidden, only their return value is visible. > Is this because the list execution is another scope? > > Thanx, >

Re: Executing a list of functions

2007-03-16 Thread Michel Claveau
Hi! Your code run OK for me. But, if you want "time-lag" (sorry for my english) execution, you can try this: def a(): print "this is a" def b(): print "this is b" lst = [a, b] [f() for f in lst] -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/py

Re: Executing a list of functions

2007-03-16 Thread 7stud
On Mar 16, 3:59 pm, "7stud" <[EMAIL PROTECTED]> wrote: > lst = [a, b] > > The () symbol causes the named function to execute, and a function > call in the code is always replaced by the function's return value. Try this: -- def a(): print "this is a" def b(): print "this is b

Re: Executing a list of functions

2007-03-16 Thread 7stud
lst = [a, b] The () symbol causes the named function to execute, and a function call in the code is always replaced by the function's return value. -- http://mail.python.org/mailman/listinfo/python-list

Executing a list of functions

2007-03-16 Thread HMS Surprise
Seems to me that one should be able to put the names of several functions in a list and then have the list executed. But it seems the output of the functions is hidden, only their return value is visible. Is this because the list execution is another scope? Thanx, jh ~~~

Re: list of functions question

2006-04-27 Thread val
Tim, Greatly appreciate your help. You are right - the functions work from the list; i don't actually need the string with events. Thanks again - great list and great people... Val -- http://mail.python.org/mailman/listinfo/python-list

Re: list of functions question

2006-04-27 Thread val
Hi Kent, Thanks. Great help. It does work now, and with expressions as well. my very best, Val -- http://mail.python.org/mailman/listinfo/python-list

Re: list of functions question

2006-04-27 Thread val
John Machin wrote: > On 27/04/2006 10:38 AM, val bykoski wrote: > > Hi The List: > > I have a modeling app where i'm detecting events (in temporal > > dynamics) applying a set of (boolean) functions - kind of: > > > > event_list = "f1 f2 etc".split() # each fi detects a specific event > > i have

Re: list of functions question

2006-04-27 Thread Kent Johnson
val bykoski wrote: > Hi The List: >I have a modeling app where i'm detecting events (in temporal > dynamics) applying a set of (boolean) functions - kind of: > > event_list = "f1 f2 etc".split() # each fi detects a specific event > i have defs for functions fi, or simple boolean expressions

Re: list of functions question

2006-04-27 Thread John Machin
On 27/04/2006 10:38 AM, val bykoski wrote: > Hi The List: > I have a modeling app where i'm detecting events (in temporal > dynamics) applying a set of (boolean) functions - kind of: > > event_list = "f1 f2 etc".split() # each fi detects a specific event > i have defs for functions fi, or simp

Re: list of functions question

2006-04-27 Thread Tim Roberts
ould have worked: event_list = [f1, f2, etc] As it is, event_list is a list of strings, not a list of functions. Then, when you want to call it, remember that it has to be treated like a function: for ev in event_list: if ev(t): pass If you REALLY need the list of functions to

list of functions question

2006-04-26 Thread val bykoski
Hi The List: I have a modeling app where i'm detecting events (in temporal dynamics) applying a set of (boolean) functions - kind of: event_list = "f1 f2 etc".split() # each fi detects a specific event i have defs for functions fi, or simple boolean expressions for each, so that evList is a