By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,676 Members | 2,249 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,676 IT Pros & Developers. It's quick & easy.

Please help me understand this code....

P: n/a
Hello,
I am a programmer, but not a python guy. So I am a little confused with
the following python code. Specifically what does the ":" do in the
array arithmetic?

new_page = map[opage]
old_page = map[opage^1]
center = new_page[1:-1,1:-1]
origcenter = array(center)
center[:] = old_page[2:,2:]

center += old_page[1:-1,2:]
center += old_page[:-2,2:]
center += old_page[2:,1:-1]
center += old_page[:-2,1:-1]
center += old_page[2:,:-2]
center += old_page[1:-1,:-2]
center += old_page[:-2,:-2]
center >>= 2
center -= origcenter
center -= (center>>density)

Thanks!!
Randy

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The : is used in Python for slice notation, which is explained pretty
thoroughly in the Python tutorial, specifically at:

http://www.python.org/doc/2.4/tut/node5.html

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.