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


Groups > comp.lang.python > #44159

Re: Running simultaneuos "FOR" loops

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.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.021
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'syntax': 0.04; 'error:': 0.07; 'cc:addr:python-list': 0.11; '170,': 0.16; '23,': 0.16; 'callable': 0.16; 'data)': 0.16; 'dictionaries': 0.16; 'keys.': 0.16; 'required\xa0': 0.16; 'skip:z 30': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; 'looked': 0.18; 'not,': 0.20; '>>>': 0.22; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'cc:2**0': 0.24; '&gt;': 0.26; 'define': 0.26; 'skip:" 40': 0.26; 'code:': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; '???': 0.30; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'file': 0.32; 'run': 0.32; 'url:python': 0.33; 'running': 0.33; '(most': 0.33; 'skip:s 30': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'doing': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'so,': 0.37; 'implement': 0.38; 'skip:& 10': 0.38; 'pm,': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'subject:" ': 0.39; 'skip:p 20': 0.39; '8bit%:6': 0.40; 'url:mail': 0.40; 'how': 0.40; 'zip': 0.64; 'more': 0.64; 'yes': 0.68; 'disturb': 0.91; 'obvious,': 0.91; 'subject:FOR': 0.91; 'to:none': 0.92; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:cc:content-type; bh=++4y+wRwbd5uFa84dEW+tYKvnTWvQKPrZb3tKk1UzyY=; b=ZFamaW/H4mMhWM5xVbqwYfSywCSoRM0AzkcKXNr1SS1/WvH/pLHm7GVDNzajJhZOjL L6GR+EuxR1pyrzVK/ts31x+p8Pim3IGyG0ey5M3lPitwVNYxXDSVcdMmY2g/sMwJobqc hxgZylSEWkV/aaIR/pyz5K8ZvT2O6opA0I0SbVA3s2/Jey31gWggvGpGFk3pNbiyAcQl eltyME4gCW2FZvDQGbkFef6bS+7u52i3887gSigUoDW023cjEgVsfLzCvF1G+0MzEBI6 YQGr9smuF4BLQE4E97UtlUSbIAUT2m0HlMPTzavnHHEd0PA77qpstLjbLp+oa4ppJtHV meSA==
MIME-Version 1.0
X-Received by 10.50.7.42 with SMTP id g10mr22884070iga.97.1366701187982; Tue, 23 Apr 2013 00:13:07 -0700 (PDT)
In-Reply-To <CAFqGZREDssOaUJfr7pRN3hF-EeB1Bg80W3aPs3zMtGNhg6NfWg@mail.gmail.com>
References <CAFqGZRGmNj1Hsedz0j8aHw+0UN+a+RDOFNUd1fU2v22T5VyhGg@mail.gmail.com> <CAPTjJmoqGXr0B=kLk0W2vPJ=SOxCvvKUP7QRR8FS7wk8SZn2aw@mail.gmail.com> <CAFqGZRECdw_KcgO4PPbEntJwEN59V==iC6cgsi=rFw2hg__pfA@mail.gmail.com> <CAFqGZREDssOaUJfr7pRN3hF-EeB1Bg80W3aPs3zMtGNhg6NfWg@mail.gmail.com>
Date Tue, 23 Apr 2013 12:43:07 +0530
Subject Re: Running simultaneuos "FOR" loops
From inshu chauhan <insideshoes@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type multipart/alternative; boundary=089e0111cf50d2ec2204db01ea7c
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.959.1366701190.3114.python-list@python.org> (permalink)
Lines 138
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1366701190 news.xs4all.nl 2236 [2001:888:2000:d::a6]:38324
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44159

Show key headers only | View raw


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

This statement is giving me the following error

Statement:
for p, k, j in zip(sorted(segments.iterkeys(), class_count.iterkeys(),
pixel_count.iterkeys())):

Error:
Traceback (most recent call last):
  File "C:\Users\inshu\Desktop\Training_segs_trial2.py", line 170, in
<module>
    access_segments(segimage, data)
  File "C:\Users\inshu\Desktop\Training_segs_trial2.py", line 147, in
access_segments
    for p, k, j in zip(sorted(segments.iterkeys(), class_count.iterkeys(),
pixel_count.iterkeys())):
TypeError: 'dictionary-keyiterator' object is not callable





On Tue, Apr 23, 2013 at 12:33 PM, inshu chauhan <insideshoes@gmail.com>wrote:

> zip isn't doing the required
>
>
> On Tue, Apr 23, 2013 at 12:28 PM, inshu chauhan <insideshoes@gmail.com>wrote:
>
>> Yes Simultaneously means all three running at the same time, I looked up
>> zip just now, but will it not disturb my dictionaries ?
>> And yes the dictionaries have same number of keys.
>>
>> thanks
>>
>>
>> On Tue, Apr 23, 2013 at 12:16 PM, Chris Angelico <rosuav@gmail.com>wrote:
>>
>>> On Tue, Apr 23, 2013 at 4:40 PM, inshu chauhan <insideshoes@gmail.com>
>>> wrote:
>>> > i have to implement the below line in one of my code:
>>> >
>>> > for  p in sorted(segments.iterkeys()) and for k in
>>> > sorted(class_count.iterkeys()) and for j in
>>> sorted(pixel_count.iterkeys()):
>>> >
>>> > Its giving me a syntax error which is obvious, but how can I make all
>>> three
>>> > for loop run simultaneously or any other way to do this simultaneous
>>> work
>>> > ???
>>>
>>> Define simultaneously. Do the three dictionaries have the same number
>>> of keys? If so, look up zip() or itertools.izip; if not, you may have
>>> to more clearly define "simultaneous".
>>>
>>> ChrisA
>>> --
>>> http://mail.python.org/mailman/listinfo/python-list
>>>
>>
>>
>

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


Thread

Re: Running simultaneuos "FOR" loops inshu chauhan <insideshoes@gmail.com> - 2013-04-23 12:43 +0530
  Re: Running simultaneuos "FOR" loops Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-04-23 09:38 +0200
  Re: Running simultaneuos "FOR" loops Duncan Booth <duncan.booth@invalid.invalid> - 2013-04-23 08:59 +0000

csiph-web