Please help me understand this code....

R

randy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Code help please 4
Help me sort out this script 1
Help with code 0
Help please 8
Help with my responsive home page 2
Please help me to solve this JS problem 6
Help needed with code 5
Can't understand code 2

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top