Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33734
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!rt.uk.eu.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <d@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.060 |
| X-Spam-Evidence | '*H*': 0.88; '*S*': 0.00; '"""': 0.05; 'indices': 0.07; 'subject:Error': 0.07; 'cc:addr:python-list': 0.10; 'def': 0.10; 'called,': 0.16; 'excerpt': 0.16; 'rings': 0.16; 'subject:Index': 0.16; 'zero,': 0.16; 'earlier': 0.21; 'either.': 0.22; 'tuples': 0.22; 'cc:2**0': 0.23; "i've": 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'points': 0.29; 'source': 0.29; 'returned': 0.30; 'point': 0.31; 'asked': 0.33; "aren't": 0.33; 'doubt': 0.33; 'list': 0.35; 'bigger': 0.35; 'false': 0.35; 'continue': 0.35; 'but': 0.36; "i'll": 0.36; 'skip:p 20': 0.36; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'your': 0.60; 'first': 0.61; 'back': 0.62; 'ever': 0.63; 'header:Reply-To:1': 0.68; '3000': 0.71; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'square': 0.75; 'you:': 0.75; 'around,': 0.84; 'comment.': 0.91; 'same,': 0.91 |
| Date | Wed, 21 Nov 2012 08:32:26 -0500 |
| From | Dave Angel <d@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 |
| MIME-Version | 1.0 |
| To | inshu chauhan <insideshoes@gmail.com> |
| Subject | Re: Index Error |
| References | <CAFqGZRGWginSj-OAA3z7afXzBHuyH6n0By_8hU0J_8i7r1O9_w@mail.gmail.com> |
| In-Reply-To | <CAFqGZRGWginSj-OAA3z7afXzBHuyH6n0By_8hU0J_8i7r1O9_w@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:qnKOm/KViBJDQx5S9j9iw9WP9CNbWQ+YnQRRWIlNKOD 3ew6M/zV3NfpXHGal3qmclGQwwi69WUe6Fti4ikebBuymsZXyr QOd/UZVfVLXTzrF8vARBRb1eWwTnTTgFmCfWZ7p3p28xTxQUY6 j5e43MfX2qnFdyTHv0Rp+FKfTg2bigLc+C/3lxzfffTKs5gZyy 6hNMh9MgqA8T3RXofa46MGSGNWhmhLzpVJ/RKMGzc49YTGiQa1 M6/OibGup+0pre+6778jz+USN8Q6PzK0ClVFto6i/jKKd+zvJq X5xjFqZskVYrPCQSC0KLD10wPkFUqCfJW3yS+v6sv2rN3qfyQ= = |
| Cc | "python-list@python.org" <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | d@davea.name |
| 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.152.1353504762.29569.python-list@python.org> (permalink) |
| Lines | 63 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1353504762 news.xs4all.nl 6952 [2001:888:2000:d::a6]:57914 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:33734 |
Show key headers only | View raw
>
> <snip>
>
>>
>> Back to an earlier comment. I asked if N was ever bigger than x or
>> bigger than y, and you said never. But your ComputeClasses will have
>> such a case the very first time around, when cx==0, cy==0, and
>> ring_number == 1.
>>
>
> I doubt this , M confused..
>
I'll paste an excerpt of the last source I've seen from you:
"""
def GenerateRing(x,y, N): Generates square rings around a point in data
which has 300 columns(x) and 3000 rows(y)
indices = []
for i in xrange(-N, N):
indices.append((x+i, y-N))
indices.append((x+N, y+i))
indices.append((x-i, y+N))
indices.append((x-N, y-i))
return indices
def ComputeClasses(data):
radius = .5
points = []
for cy in xrange(0, data.height):
for cx in xrange(0, data.width):
if data[cy,cx] == (0.0,0.0,0.0):
continue
else :
centre = data[cy, cx]
points.append(centre)
change = True
while change:
for ring_number in xrange(1, 100):
change = False
new_indices = GenerateRing(cx, cy, ring_number)
"""
When that GenerateRing() is first called, cy will be zero, cx the same,
and ring_number will be 1.
So some of the tuples in the returned list will have negative ints. You
don't check for that either.
I still think that data.height and data.width aren't the right limits to
be using.
--
DaveA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Index Error Dave Angel <d@davea.name> - 2012-11-21 08:32 -0500
csiph-web