Re: Nested Parameter Definitions

2007-02-26 Thread Paddy
On Feb 25, 11:41 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > Just looks like an extension of the normal tuple unpacking feature > of the language. > Yep, it looks like good Python to me too. Maybe the tutorial could be extended to cover this form of parameter too? It would be good

Re: Nested Parameter Definitions

2007-02-25 Thread bearophileHUGS
Virgil Dupras: > Without the call example, I would have > had a hard time to try to figure out what these extra brackets are > for. For this reason, I think that an explicit unpack is more > readable, and thus better. I can't agree. Bye, bearophile -- http://mail.python.org/mailman/listinfo/py

Re: Nested Parameter Definitions

2007-02-25 Thread Hendrik van Rooyen
"Arnaud Delobelle" <[EMAIL PROTECTED]> wrote: > On Feb 25, 6:00 pm, "Paddy" <[EMAIL PROTECTED]> wrote: > > I blogged on finding a new-to-me feature of Python, in that you are > > allowed to nnest parameter definitions: > > > > >>> def x ((p0, p1), p2): > > > > ... return p0,p1,p2 > > ...>>> x

Re: Nested Parameter Definitions

2007-02-25 Thread Gabriel Genellina
En Sun, 25 Feb 2007 15:00:31 -0300, Paddy <[EMAIL PROTECTED]> escribió: def x ((p0, p1), p2): > ... return p0,p1,p2 The first time I saw it used was in Zope, a long time ago. And I like it. Of course it only has any sense if you expect the tuple (p0,p1) to exist *before* the functi

Re: Nested Parameter Definitions

2007-02-25 Thread Steven D'Aprano
On Sun, 25 Feb 2007 11:06:03 -0800, Virgil Dupras wrote: > On Feb 25, 1:00 pm, "Paddy" <[EMAIL PROTECTED]> wrote: >> I blogged on finding a new-to-me feature of Python, in that you are >> allowed to nnest parameter definitions: >> >> >>> def x ((p0, p1), p2): >> >> ... return p0,p1,p2 [snip]

Re: Nested Parameter Definitions

2007-02-25 Thread Steven D'Aprano
On Sun, 25 Feb 2007 10:00:31 -0800, Paddy wrote: > I wondered if those of you with some Python experience new of nested > parameters and don't use them; or just forgot/don't know it is > possible? I learnt about this some time ago. I don't often use it, although it makes sense to write this: def

Re: Nested Parameter Definitions

2007-02-25 Thread Paddy
On Feb 25, 7:06 pm, "Virgil Dupras" <[EMAIL PROTECTED]> wrote: > On Feb 25, 1:00 pm, "Paddy" <[EMAIL PROTECTED]> wrote: > > > > > I blogged on finding a new-to-me feature of Python, in that you are > > allowed to nnest parameter definitions: > > > >>> def x ((p0, p1), p2): > > > ... return p0,p

Re: Nested Parameter Definitions

2007-02-25 Thread Arnaud Delobelle
On Feb 25, 6:00 pm, "Paddy" <[EMAIL PROTECTED]> wrote: > I blogged on finding a new-to-me feature of Python, in that you are > allowed to nnest parameter definitions: > > >>> def x ((p0, p1), p2): > > ... return p0,p1,p2 > ...>>> x(('Does', 'this'), 'work') > > ('Does', 'this', 'work') Reminds

Re: Nested Parameter Definitions

2007-02-25 Thread Virgil Dupras
On Feb 25, 1:00 pm, "Paddy" <[EMAIL PROTECTED]> wrote: > I blogged on finding a new-to-me feature of Python, in that you are > allowed to nnest parameter definitions: > > >>> def x ((p0, p1), p2): > > ... return p0,p1,p2 > ...>>> x(('Does', 'this'), 'work') > > ('Does', 'this', 'work') > > > >