[newbie] copying identical list for a function argument
gary.herron at islandtraining.com
Mon Feb 3 23:06:16 CET 2014
On 02/03/2014 01:36 PM, Jean Dupont wrote:
> I have a list like this:
> The argument of my function should be a repeated version e.g.
> [1,2,3],[1,2,3],[1,2,3],[1,2,3] (could be a different number of times repeated also)
That's not very clear. You say "The" argument (singular; meaning 1) but
then show what seems to be four arguments. Can you show us the function
A number of things come to mind:
[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]
so fn(n*[[1,2,3]]) might do for a single parameter function
On the other hand expanding a sequence into individual parameters:
fn(*(4*[[1,2,3]])) # note extra * preceding the arg
willl be a valid call for
I'm sure other interpretations of your question are possible.
> what is the prefered method to realize this in Python?
> any help would be really appreciated
> kind regards,
More information about the Python-list