Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #44159
| 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 | 2013-04-23 12:43 +0530 |
| Subject | Re: Running simultaneuos "FOR" loops |
| From | inshu chauhan <insideshoes@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.959.1366701190.3114.python-list@python.org> (permalink) |
[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 | Next — Next in thread | Find similar | Unroll 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