Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39747

Re: [Python-ideas] iterable.__unpack__ method

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; 'broken': 0.03; 'subject:Python': 0.05; 'expressions': 0.07; 'works.': 0.07; 'subject:method': 0.09; 'sure,': 0.09; 'thread,': 0.09; 'violates': 0.09; 'cc:addr:python-list': 0.10; 'language': 0.14; '(sorry': 0.16; '-tkc': 0.16; 'ah,': 0.16; 'command,': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'iterable': 0.16; 'itertools': 0.16; 'naming': 0.16; 'subject:ideas': 0.16; 'tuple,': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'subject:] ': 0.19; 'discussion': 0.20; 'import': 0.21; 'subject:skip:i 10': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'looks': 0.26; 'order.': 0.27; 'chris': 0.28; 'concern': 0.29; 'concern.': 0.29; 'case,': 0.29; "i'm": 0.29; 'evaluation': 0.30; 'url:python': 0.32; 'could': 0.32; 'done': 0.34; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; 'totally': 0.36; 'charset:us-ascii': 0.36; 'two': 0.37; 'url:docs': 0.38; 'subject:-': 0.40; 'your': 0.60; 'email name :python-list': 0.62; 'evaluate': 0.62; 'is.': 0.62; 'skip:n 10': 0.63; 'dry': 0.84; 'received:50.22': 0.84; 'url:reference': 0.84; 'received:108': 0.91
Date Sun, 24 Feb 2013 08:44:53 -0600
From Tim Chase <python.list@tim.thechases.com>
To Chris Angelico <rosuav@gmail.com>
Subject Re: [Python-ideas] iterable.__unpack__ method
In-Reply-To <CAPTjJmoSwpQzq8WfH+LyNvjaYf81T0hc8nukJmjuC7WCe2qyQQ@mail.gmail.com>
References <c2d617bf-e2e1-40fe-b50b-7746aba06946@googlegroups.com> <kga1b9$apn$1@ger.gmane.org> <CAPTjJmp==jidQSzK6yPXY2NY9Mi0QqpUuhTX3iy9MVaG5yAUrQ@mail.gmail.com> <CADiSq7fgqhefNGDBQALEvTwh_8WvVKqgCWYgyrOwopMLXde0dA@mail.gmail.com> <kgboat$jhs$1@ger.gmane.org> <CADiSq7dyzeferPZoPj-MmMepa3bHqSA6m+7kgnin+-2pjZQv3g@mail.gmail.com> <CADiSq7dhcJggX96Nn_Q_YQHfQNO+fGZYGv2LCHpqAYGPjGBkgQ@mail.gmail.com> <CAP7+vJJYH5Yb02HPjRbE5Vo14__XP4cPqOVUQ_ysO9bdS+pYyA@mail.gmail.com> <CADiSq7f=s49N9p+2haawW8Q5585+mKvXYv1NynYGgtKToOL41w@mail.gmail.com> <5129F8C4.4080307@hastings.org> <CAPTjJmq+imANaad7roL_Vfdn02qLVmYLgLkMfcPJbaNVfXtOKA@mail.gmail.com> <512A20A3.1020006@pearwood.info> <CAPTjJmoSwpQzq8WfH+LyNvjaYf81T0hc8nukJmjuC7WCe2qyQQ@mail.gmail.com>
X-Mailer Claws Mail 3.7.6 (GTK+ 2.20.1; x86_64-pc-linux-gnu)
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - boston.accountservergroup.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - tim.thechases.com
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2406.1361717014.2939.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1361717014 news.xs4all.nl 6873 [2001:888:2000:d::a6]:56090
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:39747

Show key headers only | View raw


On 2013-02-25 01:19, Chris Angelico wrote:
> >>>      command, subcommand = next(iterargs), next(iterargs)
> >>
> >>
> >> Err.... is there a language guarantee of the order of evaluation
> >> in a tuple, or is this just a "CPython happens to evaluate
> >> independent expressions left-to-right"? This is totally broken
> >> if the next() calls could be done in either order.
> >
> > It's a language guarantee.
> >
> > http://docs.python.org/2/reference/expressions.html#evaluation-order
> 
> Ah, so it is. My bad, sorry! In that case, sure, this works. It
> still violates DRY though, naming the iterable twice and relying on
> the reader noticing that that means "take two off this one". But
> that's a much weaker concern.

Your DRY/readability concern might then be addressed by writing it as

  from itertools import islice
  # ...
  command, subcommand = islice(iterargs, 2)

(sorry if this was already addressed in the python-ideas@ thread,
since I'm not subscribed there and it looks like discussion migrated
to python-list@).

-tkc


Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: [Python-ideas] iterable.__unpack__ method Tim Chase <python.list@tim.thechases.com> - 2013-02-24 08:44 -0600

csiph-web