Re: Passing ints to a function

2012-06-10 Thread Rick Johnson
On Jun 9, 3:29 am, Jussi Piitulainen wrote: > Here's something you could have thought of for yourself even when you > didn't remember that Python does have special built-in support for > applying a function to a list of arguments: > > def five(func, args): >    a, b, c, d, e = args >    return fu

Re: Passing ints to a function

2012-06-09 Thread Chris Angelico
On Sat, Jun 9, 2012 at 6:29 PM, Jussi Piitulainen wrote: > The point is that the function itself can be passed as an argument to > the auxiliary function ... And unlike in Javascript, a bound method is fully callable too. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing ints to a function

2012-06-09 Thread Jussi Piitulainen
stayvoid writes: > > You want to unpack the list: > > > > function(*a)  # like function(a[0], a[1], a[2], ...) > > Awesome! I forgot about this. Here's something you could have thought of for yourself even when you didn't remember that Python does have special built-in support for applying a fun

Re: Passing ints to a function

2012-06-08 Thread stayvoid
> You want to unpack the list: > > function(*a)  # like function(a[0], a[1], a[2], ...) Awesome! I forgot about this. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing ints to a function

2012-06-08 Thread Steven D'Aprano
On Fri, 08 Jun 2012 16:41:40 -0700, stayvoid wrote: > Hello, > > I want to pass several values to a function which is located on a server > (so I can't change its behavior). That function only accepts five values > which must be ints. > > There are several lists: > a = [1, 2, 3, 4, 5] > b = [5,

Re: Passing ints to a function

2012-06-08 Thread Benjamin Kaplan
On Fri, Jun 8, 2012 at 7:41 PM, stayvoid wrote: > Hello, > > I want to pass several values to a function which is located on a > server (so I can't change its behavior). > That function only accepts five values which must be ints. > > There are several lists: > a = [1, 2, 3, 4, 5] > b = [5, 4, 3,

Re: Passing ints to a function

2012-06-08 Thread Ian Kelly
On Fri, Jun 8, 2012 at 5:41 PM, stayvoid wrote: > Hello, > > I want to pass several values to a function which is located on a > server (so I can't change its behavior). > That function only accepts five values which must be ints. > > There are several lists: > a = [1, 2, 3, 4, 5] > b = [5, 4, 3,

Passing ints to a function

2012-06-08 Thread stayvoid
Hello, I want to pass several values to a function which is located on a server (so I can't change its behavior). That function only accepts five values which must be ints. There are several lists: a = [1, 2, 3, 4, 5] b = [5, 4, 3, 2, 1] c = [0, 0, 0, 0, 0] I want to pass each value from these l