Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65381
| 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 | <gary.herron@islandtraining.com> |
| 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 <gary.herron@islandtraining.com> |
| 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 | <df3d41dd-222d-4a05-b9de-377d67b77bda@googlegroups.com> |
| In-Reply-To | <df3d41dd-222d-4a05-b9de-377d67b77bda@googlegroups.com> |
| 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 <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6367.1391465505.18130.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
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
>
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[newbie] copying identical list for a function argument Jean Dupont <jeandupont314@gmail.com> - 2014-02-03 13:36 -0800
Re: [newbie] copying identical list for a function argument Gary Herron <gary.herron@islandtraining.com> - 2014-02-03 14:06 -0800
Re: [newbie] copying identical list for a function argument Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-03 22:19 +0000
Re: [newbie] copying identical list for a function argument Jean Dupont <jeandupont115@gmail.com> - 2014-02-04 01:14 -0800
Re: [newbie] copying identical list for a function argument Tim Chase <python.list@tim.thechases.com> - 2014-02-03 15:51 -0600
Re: [newbie] copying identical list for a function argument Rustom Mody <rustompmody@gmail.com> - 2014-02-03 19:09 -0800
csiph-web