concatenate function

James Elford at
Tue Mar 13 16:54:20 CET 2012

On 13/03/12 14:35, ferreirafm wrote:
> Hi List,
> I've coded three functions that I would like to concatenate. I mean, run
> them one after another. The third function depends on the results of the
> second function, which depends on the results of the first one. When I call
> one function after another, python runs them at the same time causing
> obvious errors messages. I've tried to call one of them from inside another
> but no way. Any clues are appreciated.

> Complete code goes here: 

Do you think you could provide a much shorter example to illustrate what
you need? In general, when you want to run one function on the result of
another, you can do something like:

<<< def increment_all(l);
...	return [i+1 for i in l]

<<< increment_all(increment_all(range(3))
[2, 3, 4]

Here we apply the function increment_all to the result of the function

If you are talking about the "results" of each function in terms of it
mutating an object, and then the next function mutating the same object
in a (possibly) different way, then calling the functions in order will
do what you want.

l = [0, 3, 5, 2]
l.append(10)		# [0, 3, 5, 2, 10]
l.sort()		# [0, 2, 3, 5, 10]
l.append(3)		# [0, 2, 3, 5, 10, 3]


> --
> View this message in context:
> Sent from the Python - python-list mailing list archive at

More information about the Python-list mailing list