Re: How can i return more than one value from a function to more than one variable

2013-12-23 Thread Simon Hayward
> 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

Using multiple assignment.

# Swap values
x, y = 4, 7
y, x = x, y

Or to keep this in a function, return a tuple and assign from that:

def switch(x, y):
return y, x

x, y = switch(x, y)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fairly OT: Why "flufl"?

2013-02-04 Thread Simon Hayward
On Feb 4, 2013 4:27 PM, "nn"  wrote:
>
> On Feb 4, 10:10 am, Chris Angelico  wrote:
> > This isn't particularly related to the post I'm quoting, it's more a
> > point of curiosity.
> >
> > On Mon, Feb 4, 2013 at 10:53 AM, João Bernardo  wrote:
> >
> > Re: [Python-ideas] constant/enum type in stdlib
> >
> > > I have my own implementation with a basic api somewhat borrowed from
> > > flufl.enum (plus a lot of other stuff)...
> >
> > What is the origin of the term FLUFL? It's referenced in PEP 401 about
> > the retirement of the BDFL and the appointment of Barry Warsaw as
> > Guido's successor. Is that where the expression FLUFL originated, or
> > is "Friendly Language Uncle For Life" a backformation?
> >
> > This might be more of a personal question for Barry, in the same way
> > that asking me why I'm "Rosuav" wouldn't be a list question, but I'm
> > wondering if there's something more Python to it.
> >
> > Just a point of random curiosity!
> >
> > ChrisA
>
> My guess is that it originated with PEP 401, and that FLUFL ("Friendly
> Language Uncle For Life") were created as humorous take on the equally
> silly title of BDFL ("Benevolent Dictator For Life").
> --
> http://mail.python.org/mailman/listinfo/python-list

Barry talks about the origin of "flufl" at the end of this radio free
python podcast.

http://radiofreepython.com/episodes/10/
-- 
http://mail.python.org/mailman/listinfo/python-list