Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #26863
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <d@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.016 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'subject:: [': 0.03; 'subject:question': 0.08; 'cc:addr:python-list': 0.10; 'def': 0.10; 'advance.': 0.15; 'call?': 0.16; 'string': 0.17; 'wrote:': 0.17; 'string,': 0.17; 'subject:] ': 0.19; 'changes': 0.20; 'trying': 0.21; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'values': 0.26; 'am,': 0.27; 'realize': 0.27; 'chris': 0.28; 'probably': 0.29; 'function': 0.30; 'lists': 0.31; 'subject:lists': 0.32; 'could': 0.32; 'values.': 0.33; 'problem': 0.33; 'thanks': 0.34; 'list': 0.35; 'similar': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; 'level': 0.37; 'why': 0.37; 'rather': 0.37; 'sure': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'your': 0.60; 'worth': 0.63; 'wanting': 0.65; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply- to:no real name:2**0': 0.72 |
| Date | Fri, 10 Aug 2012 06:58:47 -0400 |
| From | Dave Angel <d@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
| MIME-Version | 1.0 |
| To | Mok-Kong Shen <mok-kong.shen@t-online.de> |
| Subject | Re: [newbie] A question about lists and strings |
| References | <k02jn0$id2$1@news.albasani.net> <mailman.3150.1344593295.4697.python-list@python.org> <k02nt5$r8p$1@news.albasani.net> <mailman.3153.1344595204.4697.python-list@python.org> <k02otn$t6f$1@news.albasani.net> |
| In-Reply-To | <k02otn$t6f$1@news.albasani.net> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:kgZl2HxGUmeZqqVHyLyq6tKPYPEAXizt0IoC6rYL9+V DwqUqAEpN3jbPVah9RoxXZUoPMa32UzOMq2s8r/FDkkvFHAstQ M/nokJUfsKMjSt3R590rtDA9I2EiDTGMDCxRnah7l/W4PDQ1cN vINlVEXMQkqwGM5+nZ4gfXKBA8wV/6g9+egproIXyO3PC2MYyN WHb8neEn7ErpSwkUotdirXhlCmnSEfDeVpn9k09ttjPKhkjucg 0/AVp9BGk59jWyR814BK9rW6WL/HOgdMendgEO0VJ2i+WYVbDB FgA+l+wsTWBPTYJ+g22Xx+eNiPUs0UdB7R+VJOx0W/ic8lyCg= = |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | d@davea.name |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3157.1344596349.4697.python-list@python.org> (permalink) |
| Lines | 34 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1344596349 news.xs4all.nl 6986 [2001:888:2000:d::a6]:46266 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:26863 |
Show key headers only | View raw
On 08/10/2012 06:48 AM, Mok-Kong Shen wrote:
> Am 10.08.2012 12:40, schrieb Chris Angelico:
>
>> But it's probably worth thinking about exactly why you're wanting to
>> change that string, and what you're really looking to accomplish.
>> There may well be a better way.
>
> My problem is the following: I have at top level 3 lists and 3 strings:
> lista, listb, listc and stra, strb, strc. I can with a single function
> call change all 3 list values. How could I realize similar changes
> of the 3 string values with a single function call?
>
> Thanks in advance.
>
> M. K. Shen
>
>
Make sure your function returns the values, rather than just trying to
mutate them in place.
def aa(mystring1, mystring2, mystring3):
mystring1 += "something"
mystring2 += "otherthing"
mystring3 += "nobody"
return mystring1, mystring2, mystring3
str1, str2, str3 = aa(str1, str2, str3)
--
DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[newbie] A question about lists and strings Mok-Kong Shen <mok-kong.shen@t-online.de> - 2012-08-10 11:19 +0200
Re: [newbie] A question about lists and strings Roman Vashkevich <vashkevichrb@gmail.com> - 2012-08-10 13:28 +0400
Re: [newbie] A question about lists and strings Roman Vashkevich <vashkevichrb@gmail.com> - 2012-08-10 13:48 +0400
Re: [newbie] A question about lists and strings Mok-Kong Shen <mok-kong.shen@t-online.de> - 2012-08-10 12:12 +0200
Re: [newbie] A question about lists and strings Chris Angelico <rosuav@gmail.com> - 2012-08-10 20:37 +1000
Re: [newbie] A question about lists and strings Dave Angel <d@davea.name> - 2012-08-10 06:37 -0400
Re: [newbie] A question about lists and strings Roman Vashkevich <vashkevichrb@gmail.com> - 2012-08-10 14:56 +0400
Re: [newbie] A question about lists and strings Mok-Kong Shen <mok-kong.shen@t-online.de> - 2012-08-10 13:08 +0200
Re: [newbie] A question about lists and strings Dave Angel <d@davea.name> - 2012-08-10 06:56 -0400
Re: [newbie] A question about lists and strings Chris Angelico <rosuav@gmail.com> - 2012-08-10 21:00 +1000
Re: [newbie] A question about lists and strings Roman Vashkevich <vashkevichrb@gmail.com> - 2012-08-10 15:06 +0400
Re: [newbie] A question about lists and strings Peter Otten <__peter__@web.de> - 2012-08-10 11:59 +0200
Re: [newbie] A question about lists and strings Rotwang <sg552@hotmail.co.uk> - 2012-08-10 16:12 +0100
Re: [newbie] A question about lists and strings Dave Angel <d@davea.name> - 2012-08-10 06:07 -0400
Re: [newbie] A question about lists and strings Mok-Kong Shen <mok-kong.shen@t-online.de> - 2012-08-10 12:31 +0200
Re: [newbie] A question about lists and strings Chris Angelico <rosuav@gmail.com> - 2012-08-10 20:40 +1000
Re: [newbie] A question about lists and strings Mok-Kong Shen <mok-kong.shen@t-online.de> - 2012-08-10 12:48 +0200
Re: [newbie] A question about lists and strings Dave Angel <d@davea.name> - 2012-08-10 06:58 -0400
Re: [newbie] A question about lists and strings Dave Angel <d@davea.name> - 2012-08-10 06:53 -0400
csiph-web