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


Groups > comp.lang.python > #4866

Re: Python 3 dict question

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.04; '>>>>': 0.09; 'first:': 0.09; 'pm,': 0.11; 'wrote:': 0.14; 'iterator': 0.16; 'traceback': 0.16; '(most': 0.16; 'work,': 0.20; 'header:In-Reply-To:1': 0.22; 'subject:question': 0.22; 'last):': 0.23; 'received:209.85.161.46': 0.26; 'received:mail- fx0-f46.google.com': 0.26; 'object': 0.27; 'message- id:@mail.gmail.com': 0.28; "doesn't": 0.28; 'received:209.85.161': 0.29; 'fri,': 0.29; 'typeerror:': 0.31; 'to:addr:python-list': 0.32; '"",': 0.35; 'received:209.85': 0.37; 'received:google.com': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'header:Received:5': 0.40; '2011': 0.62
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=NePDZnKiWeR2Pbs8/hAlsppnkYTQ9h+xmj71lojBQPE=; b=h3nTOZzQczDcMn5J2F9OZmJ1Q0UjA7VW69AcqEHUZO572Ik58J+lP6O6XALn/q9MEC EjpnPLj0xOokqCTFEMq9EJu3/zfkQAxmy2oE7bdMycZIKgo0H0uGdda0a9MJFbLudfBE aT5sRQt9yoX8XIKcmhAEMHzTV0+z45ULg5I68=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=T6vI1y8jKwaSeajKHVRn/9oTj0itVodRjUCH3eOqg+TQHDddt/JBg843eMOrib7V7T 6Yc3iuyfyO1X9/XRCe2AQ/l3Z0sCsAlwa/cisNSCLqUtakm2f/xwqO8y1QWqW6CLdk5Y mWezN/5rckynv3F13PrlSKsy4Dcm+rWM/q844=
MIME-Version 1.0
In-Reply-To <777641c8-4928-4e49-832a-6a4a076628d1@o26g2000vby.googlegroups.com>
References <ded9dfa0-a031-4513-8751-7ff7bfd5dcc7@e8g2000vbz.googlegroups.com> <mailman.1262.1304711497.9059.python-list@python.org> <777641c8-4928-4e49-832a-6a4a076628d1@o26g2000vby.googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Fri, 6 May 2011 14:48:45 -0600
Subject Re: Python 3 dict question
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.1268.1304714956.9059.python-list@python.org> (permalink)
Lines 10
NNTP-Posting-Host 82.94.164.166
X-Trace 1304714956 news.xs4all.nl 81482 [::ffff:82.94.164.166]:43822
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:4866

Show key headers only | View raw


On Fri, May 6, 2011 at 1:57 PM, dmitrey <dmitrey15@gmail.com> wrote:
> Unfortunately, it doesn't work, it turn out to be dict_items:
>>>> next({1:2}.items())
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> TypeError: dict_items object is not an iterator

So call iter() on it first:

next(iter(myDict.items()))

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


Thread

Python 3 dict question dmitrey <dmitrey15@gmail.com> - 2011-05-06 12:40 -0700
  Re: Python 3 dict question Chris Rebert <clp2@rebertia.com> - 2011-05-06 12:51 -0700
    Re: Python 3 dict question dmitrey <dmitrey15@gmail.com> - 2011-05-06 12:57 -0700
      Re: Python 3 dict question Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-06 14:48 -0600
      Dictionary Views -- good examples?  [was Re: Python 3 dict question] Ethan Furman <ethan@stoneleaf.us> - 2011-05-06 15:49 -0700
        Re: Dictionary Views -- good examples?  [was Re: Python 3 dict question] Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-07 21:09 +1200
          Re: Dictionary Views -- good examples?  [was Re: Python 3 dict question] Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-05-08 11:23 +0200
      Re: Dictionary Views -- good examples? [was Re: Python 3 dict question] Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-06 18:23 -0600
      Re: Dictionary Views -- good examples? [was Re: Python 3 dict question] Ethan Furman <ethan@stoneleaf.us> - 2011-05-10 10:18 -0700
  Re: Python 3 dict question Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-06 14:02 -0600
  Re: Python 3 dict question Rob Wolfe <rw@smsnet.pl> - 2011-05-06 22:46 +0200
  Re: Python 3 dict question nirinA raseliarison <nirina.raseliarison@gmail.com> - 2011-05-06 14:18 -0700
  Re: Python 3 dict question Raymond Hettinger <python@rcn.com> - 2011-05-10 10:25 -0700

csiph-web