Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62563
| References | <40ddd2cf-483f-423b-9a4d-93f6a5e77df2@googlegroups.com> <8e01f218-ec00-4d01-ab82-53e1ea7670e2@googlegroups.com> |
|---|---|
| Date | 2013-12-22 19:05 -0500 |
| Subject | Re: How can i return more than one value from a function to more than one variable |
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4517.1387757150.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
return a tuple: return a, b, c or whatever On Sun, Dec 22, 2013 at 6:41 PM, Bob Rashkin <rrashkin@gmail.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 = 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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: How can i return more than one value from a function to more than one variable Bob Rashkin <rrashkin@gmail.com> - 2013-12-22 15:41 -0800
Re: How can i return more than one value from a function to more than one variable Joel Goldstick <joel.goldstick@gmail.com> - 2013-12-22 19:05 -0500
Re: How can i return more than one value from a function to more than one variable Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-23 00:37 +0000
Re: How can i return more than one value from a function to more than one variable Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-12-22 22:17 -0500
Re: How can i return more than one value from a function to more than
one variable Dave Angel <davea@davea.name> - 2013-12-22 19:57 -0500
Re: How can i return more than one value from a function to more than one variable Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-23 11:45 +1100
csiph-web