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


Groups > comp.lang.python > #43342

Can I iterate over a dictionary outside a function ?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.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 <insideshoes@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.051
X-Spam-Evidence '*H*': 0.90; '*S*': 0.00; 'iterate': 0.09; 'suggest': 0.14; 'dict': 0.16; 'iterated': 0.16; 'iterkeys': 0.16; 'prog': 0.16; 'subject: ?': 0.16; 'to:name:python-list@python.org': 0.22; 'function': 0.29; 'returned': 0.30; 'message-id:@mail.gmail.com': 0.30; 'but': 0.35; 'received:google.com': 0.35; 'shows': 0.36; 'possible': 0.36; 'error.': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'subject:Can': 0.60; 'address': 0.63; 'subject:over': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=iJ1LSpvsH/kbxb/vtj8frUckhVwk2m3Pxfs5qA2sZ+A=; b=yNrcB/Dc0vINJV4L7RkfsMAoIhdG2wjRii0NXxvQDH4qBj0aTKF4UdNbgo2vQHv/wj GPUwf1EZ9pxXbviy4iySe1AF7qRpMDhfFt0Hqv1eo6rWtXKqTVnZL0gaUO17epZy8vri ZDHK+cMjh0UXSo8/F7i81vnWlv9fuDpjEB/B5bBmip0GQ2Q0KrQBp08Idr0zFsAkPAb4 BaWv6SdsBHk/sDg6+H2nhcEsJXZKes0okAk3cQ/oSQxqntsMdWygPbwSeYznRcdqmE65 mg1J8dDb3bYindZmnIzsrpRjnSw+Ya+TEmT2eC0m4cncKBD7pStYA42Ch32IEfdVSE0t P3Ig==
MIME-Version 1.0
X-Received by 10.50.212.38 with SMTP id nh6mr15225009igc.72.1365673686877; Thu, 11 Apr 2013 02:48:06 -0700 (PDT)
Date Thu, 11 Apr 2013 15:18:06 +0530
Subject Can I iterate over a dictionary outside a function ?
From inshu chauhan <insideshoes@gmail.com>
To "python-list@python.org" <python-list@python.org>
Content-Type multipart/alternative; boundary=14dae93408fffc4bff04da12ae3d
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.452.1365673689.3114.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365673689 news.xs4all.nl 2640 [2001:888:2000:d::a6]:50921
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43342

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

I have a prog in which a functions returns a dict but when I try to iterate
over the dict using iterkeys, It shows an error. I think its because only
address of the dictionary is returned so cannot be iterated upon.

Please suggest some way by which it can be made possible to iterate over
the dictionary using  iterkeys outside the function ?

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


Thread

Can I iterate over a dictionary outside a function ? inshu chauhan <insideshoes@gmail.com> - 2013-04-11 15:18 +0530
  Re: Can I iterate over a dictionary outside a function ? Alexander Blinne <news@blinne.net> - 2013-04-11 23:33 +0200

csiph-web