Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.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.023 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'advance': 0.07; '22,': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'def': 0.12; 'subject: \n ': 0.16; 'subject:variable': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'basically': 0.19; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; '>': 0.26; 'switch': 0.26; 'second': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'supposed': 0.32; 'url:python': 0.33; 'subject:from': 0.34; 'problem': 0.35; 'december': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'subject:one': 0.36; 'vice': 0.36; 'url:listinfo': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'list': 0.37; 'list.': 0.37; 'whatever': 0.38; 'pm,': 0.38; 'subject:can': 0.39; 'sure': 0.39; 'url:mail': 0.40; 'how': 0.40; 'subject:more': 0.64; 'to:addr:gmail.com': 0.65; 'joel': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=pf/LkSTtqbqd+FV7SISRtlFKl8V4SgmfZjRDzAs2c3w=; b=icUu+0K+zNFo+rQkbmv2L4C1rIJiQYnPCSXyHteOWqFu80ehzWB3tYGX0G93yL4Qmx +1QRl62e1l3UIrqf5piShPco18Wu1Jcn3ZUiaYzXFLiOagjXjVDkZ0LfUCGJDxWUDyY5 tpuHeFKkOo8qe/BufBMb/FTsx41RewTTpYR5p8+dQAY6Y6X2sHLdoQLtQuIHjBBXAtwg QrU5lzONaBBKSYCp47gEIza/ZYdFv9k9KaG6dCXxRj2aC2XbpDIND4evMvgqosRCtF3J n2tH5sIMgTOd5WyFK9e2cjxGNnnuu3vAo48vsd7UsJWd/MpCxQE2zxnUoixm4Ki2i2Km yh6g== MIME-Version: 1.0 X-Received: by 10.52.165.210 with SMTP id za18mr292315vdb.20.1387757137304; Sun, 22 Dec 2013 16:05:37 -0800 (PST) In-Reply-To: <8e01f218-ec00-4d01-ab82-53e1ea7670e2@googlegroups.com> References: <40ddd2cf-483f-423b-9a4d-93f6a5e77df2@googlegroups.com> <8e01f218-ec00-4d01-ab82-53e1ea7670e2@googlegroups.com> Date: Sun, 22 Dec 2013 19:05:37 -0500 Subject: Re: How can i return more than one value from a function to more than one variable From: Joel Goldstick To: Bob Rashkin Content-Type: multipart/alternative; boundary=001a11c2048e34243504ee286366 Cc: "python-list@python.org" 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: 116 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387757150 news.xs4all.nl 2907 [2001:888:2000:d::a6]:59037 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62563 --001a11c2048e34243504ee286366 Content-Type: text/plain; charset=UTF-8 return a tuple: return a, b, c or whatever On Sun, Dec 22, 2013 at 6:41 PM, Bob Rashkin wrote: > On Sunday, December 22, 2013 4:54:46 PM UTC-6, dec...@msn.com wrote: > > basically what I wanna do is this : > > > > > > > > x = 4 > > > > y = 7 > > > > def switch (z,w): > > > > ***this will switch z to w and vice verca*** > > > > c= z > > > > z=w > > > > w=c > > > > print 'Now x =', w, 'and y = ' , z > > > > return w > > > > x = switch(x,y) > > > > > > > > How am I supposed to do so I can return also a value to the variable y > WITHOUT printing 'Now x =', w, 'and y = ' , z a second time ? > > > > > > > > thanks in advance > > Not sure I understand the problem but I think the answer is to put > multiple values in a list and return the list. > -- > https://mail.python.org/mailman/listinfo/python-list > -- Joel Goldstick http://joelgoldstick.com --001a11c2048e34243504ee286366 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
return a tuple:

return a, b, c
<= br>
or whatever


On Sun, Dec 22, 2013 at 6:41 PM, Bob Rashkin <rrashkin@g= mail.com> wrote:
On Sunday, December 22, 2013 4:54:46 PM UTC-= 6, dec...@msn.com wrote:
> basically what I wanna do is this :
>
>
>
> x =3D 4
>
> y =3D 7
>
> def switch (z,w):
>
> ***this will switch z to w and vice verca***
>
> =C2=A0 =C2=A0 =C2=A0c=3D z
>
> =C2=A0 =C2=A0 =C2=A0z=3Dw
>
> =C2=A0 =C2=A0 =C2=A0w=3Dc
>
> =C2=A0 =C2=A0 =C2=A0print 'Now x =3D', w, 'and y =3D '= , z
>
> =C2=A0 =C2=A0 =C2=A0return w
>
> x =3D switch(x,y)
>
>
>
> =C2=A0How am I supposed to do so I can =C2=A0return also a value to th= e variable y WITHOUT printing 'Now x =3D', w, 'and y =3D ' = , z =C2=A0 a second time ?
>
>
>
> thanks in advance

Not sure I understand the problem but I think the answer is to put multiple= values in a list and return the list.
--
https://mail.python.org/mailman/listinfo/python-list



--
--001a11c2048e34243504ee286366--