Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.04; 'argument': 0.05; '[1,': 0.09; 'parameter': 0.09; 'received:67.192': 0.09; 'received:67.192.241': 0.09; 'received:dfw.emailsrvr.com': 0.09; 'repeated': 0.09; 'def': 0.12; '3],': 0.16; 'arg': 0.16; 'clear.': 0.16; 'prefered': 0.16; 'skip:[ 30': 0.16; 'wrote:': 0.18; 'subject:] ': 0.20; 'seems': 0.21; '>>>': 0.22; 'python?': 0.22; 'header:User-Agent:1': 0.23; 'received:emailsrvr.com': 0.24; 'question': 0.24; 'appreciated': 0.26; 'received:(smtp server)': 0.26; 'this:': 0.26; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'expanding': 0.29; 'subject:list': 0.30; "i'm": 0.30; 'gary': 0.31; 'jean': 0.31; 'possible.': 0.35; 'but': 0.35; 'version': 0.36; 'really': 0.36; 'sequence': 0.36; 'method': 0.36; 'should': 0.36; 'list': 0.37; 'e.g.': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'realize': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'times': 0.62; 'show': 0.63; 'kind': 0.63; 'different': 0.65; 'hand': 0.80; 'mention.': 0.84; 'mind:': 0.84 X-Virus-Scanned: OK Date: Mon, 03 Feb 2014 14:06:16 -0800 From: Gary Herron User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: [newbie] copying identical list for a function argument References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391465505 news.xs4all.nl 2859 [2001:888:2000:d::a6]:58897 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65381 On 02/03/2014 01:36 PM, Jean Dupont wrote: > I have a list like this: > [1,2,3] > > 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 you mention. A number of things come to mind: >>> 4*[[1,2,3]] [[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 def fn(L): ... 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 def fn(a,b,c,d): ... I'm sure other interpretations of your question are possible. Gary Herron > > what is the prefered method to realize this in Python? > > any help would be really appreciated > > kind regards, > jean >