Re: Assigning to None (was Re: Question about Python)

2005-07-03 Thread Bengt Richter
On Mon, 04 Jul 2005 09:11:19 +1000, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Sun, 03 Jul 2005 19:19:05 +, Bengt Richter wrote: > >> On Sun, 03 Jul 2005 11:47:07 +1000, Steven D'Aprano <[EMAIL PROTECTED]> >> wrote: >> >>>On Fri, 01 Jul 2005 12:59:20 -0400, François Pinard wrote: >>> >>>

Re: Assigning to None (was Re: Question about Python)

2005-07-03 Thread Steven D'Aprano
On Sun, 03 Jul 2005 19:19:05 +, Bengt Richter wrote: > On Sun, 03 Jul 2005 11:47:07 +1000, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >>On Fri, 01 Jul 2005 12:59:20 -0400, François Pinard wrote: >> >>> [Peter Hansen] Mike Meyer wrote: > Yes. I once grabbed an old program that did

Re: Assigning to None (was Re: Question about Python)

2005-07-03 Thread Bengt Richter
On Sun, 03 Jul 2005 11:47:07 +1000, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Fri, 01 Jul 2005 12:59:20 -0400, François Pinard wrote: > >> [Peter Hansen] >>> Mike Meyer wrote: >>> > Yes. I once grabbed an old program that did assignments to None. But >>> > that's always been a bad idea. >> >

Re: Assigning to None

2005-07-03 Thread Rocco Moretti
François Pinard wrote: > [Rocco Moretti] > > >>foo, bar, _ = gen_tuple(stuff) > > >>as '_' is already special cased (last result in interactive mode), and >>is already used for "don't care" sematics in Prolog. > > > `_' is also the `gettext' function in internationalised programs. It so > se

Re: Assigning to None (was Re: Question about Python)

2005-07-02 Thread Steven D'Aprano
On Fri, 01 Jul 2005 12:59:20 -0400, François Pinard wrote: > [Peter Hansen] >> Mike Meyer wrote: >> > Yes. I once grabbed an old program that did assignments to None. But >> > that's always been a bad idea. > >> What was the use case!? > > People used to assign None to itself as a keyword argume

Re: Assigning to None

2005-07-01 Thread Michael Sparks
Mike Meyer wrote: > Peter Hansen <[EMAIL PROTECTED]> writes: >> Mike Meyer wrote: >>> Yes. I once grabbed an old program that did assignments to None. But >>> that's always been a bad idea. >> What was the use case!? > > Unpacking a tuple. Something like this: > > (foo, bar, None) = gen

Re: Assigning to None

2005-07-01 Thread François Pinard
[Rocco Moretti] > foo, bar, _ = gen_tuple(stuff) > as '_' is already special cased (last result in interactive mode), and > is already used for "don't care" sematics in Prolog. `_' is also the `gettext' function in internationalised programs. It so seems that `_' is in great demand! :-) -- Fr

Re: Assigning to None

2005-07-01 Thread Rocco Moretti
Mike Meyer wrote: > Peter Hansen <[EMAIL PROTECTED]> writes: > > >>Mike Meyer wrote: >> >>>Yes. I once grabbed an old program that did assignments to None. But >>>that's always been a bad idea. >> >>What was the use case!? > > > Unpacking a tuple. Something like this: > > (foo, bar,

Re: Assigning to None

2005-07-01 Thread François Pinard
[Roy Smith] > 4) foo, bar = gen_tuple(stuff)[0:1]. In some ways, this is the >cleanest because it doesn't pollute the namespace with an un-needed >variable, but I think it's the least readable. Less legible often means more error prone. For example, here, foo, bar = gen_tuple(stuf

Re: Assigning to None

2005-07-01 Thread Roy Smith
>Peter Hansen <[EMAIL PROTECTED]> writes: > >> Mike Meyer wrote: >>> Yes. I once grabbed an old program that did assignments to None. But >>> that's always been a bad idea. >> What was the use case!? > >Unpacking a tuple. Something like this: > > (foo, bar, None) = gen_tuple(stuff) I can

Re: Assigning to None

2005-07-01 Thread Mike Meyer
Peter Hansen <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Yes. I once grabbed an old program that did assignments to None. But >> that's always been a bad idea. > What was the use case!? Unpacking a tuple. Something like this: (foo, bar, None) = gen_tuple(stuff) I've never seen

Re: Assigning to None (was Re: Question about Python)

2005-07-01 Thread François Pinard
[Peter Hansen] > Mike Meyer wrote: > > Yes. I once grabbed an old program that did assignments to None. But > > that's always been a bad idea. > What was the use case!? People used to assign None to itself as a keyword argument in function headers. The goal was to make a local copy of the refere

Assigning to None (was Re: Question about Python)

2005-07-01 Thread Peter Hansen
Mike Meyer wrote: > Yes. I once grabbed an old program that did assignments to None. But > that's always been a bad idea. What was the use case!? -Peter -- http://mail.python.org/mailman/listinfo/python-list