Home > Mobile >  All list objects passed to a function at once
All list objects passed to a function at once

Time:09-02

So i have a list with some objects:

from sympy import *
myList = [Interval(-oo,4), Interval(8,12), Interval(16,20)]

And i need to pass every object to a function at once, like this:

Union(Interval(-oo,4), Interval(8,12), Interval(16,20))

Is there an easy way to do it? I just can't see any way to do this.

Edit: Specified the functions and objects I am working with

CodePudding user response:

What you are looking for is called packing/unpacking of arguments and can indeed be done through the '*' operator

A detailed explanation and examples can be found on this link

  • Related