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: 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 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 Subject: Re: [newbie] A question about lists and strings References: In-Reply-To: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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