469,903 Members | 1,667 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,903 developers. It's quick & easy.

How do I use Code Context under Options in IDLE?

Hi all,
I have this Code Context feature under Options in the IDLE.
How should I use it? Are there folks here who use it regularly and find
it useful.
Please guide me.

Thanks!
Senthil

Apr 17 '06 #1
2 6968
Phoe6 wrote:
Hi all,
I have this Code Context feature under Options in the IDLE.
How should I use it? Are there folks here who use it regularly and find
it useful.
Please guide me.
Well, you could start by looking at the Help:

Options Menu:

Configure IDLE -- Open a configuration dialog. Fonts, indentation,
keybindings, and color themes may be altered.
Startup Preferences may be set, and Additional Help
Souces can be specified.
---
Code Context -- Open a pane at the top of the edit window which
shows the block context of the section of code
which is scrolling off the top or the window.

But what does that actually mean?

Take this code fragment example (with line numbers added
for reference)

1 import collatz_functions as cf
2
3 def makepath(dstart,cstart,pattern,reps):
4 print pattern
5 alphabet = '
123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmno pqrstuvwxyz'
6 # fopen('pathmade.lst', WRITE,TEXT)
7 coeff = dstart
8 oldcoeff = coeff/3
9 const = cstart
10 print 'coeff %d const %d oldcoeff %d' % (coeff,const,oldcoeff)
11 for i in xrange(1,reps+1):
12 print 'i',i
13 for j in xrange(1,len(pattern)):
14 print 'j',j
15 currstep = alphabet.index(pattern[j])
16 print 'currstep',currstep
17 while currstep>2:
18 coeff = 4 * coeff
19 const = 4 * const
20 currstep = currstep - 2
21 print 'coeff %d const %d currstep %d' %
(coeff,const,currstep)
22 if currstep==1:

The moment line 3 scrolls off the top of the edit window, it appears
in the code context window. This tells you that the current line at
the top of the screen is in line 3's scope. When line 11 scrolls off,
it appears in the code context window showing you that the current
lines are now in the scope of the for loop.

By the time you reach line 18, your code context window looks like
(line 3 has scrolled off the code context window):

11 for i in xrange(1,reps+1):
13 for j in xrange(1,len(pattern)):
17 while currstep>2:

Allowing you to see where line 18 is in the big picture. The moment
I scroll past line 21, line 17 drops off the code context window
showing me that my scope is now back to that of line 13.

And no, I don't use it regulary because I wasn't even aware of it
until you asked.

Thanks!
Senthil


Apr 17 '06 #2
me********@aol.com wrote:
---
Code Context -- Open a pane at the top of the edit window which
shows the block context of the section of code
which is scrolling off the top or the window.

But what does that actually mean?

Take this code fragment example (with line numbers added
for reference)


That explaination was very helpful and cleared my doubts.

Thanks a lot.

Regards,
Senthil

Apr 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Madiba | last post: by
1 post views Thread by Matt Leslie | last post: by
14 posts views Thread by Ian Richardson | last post: by
19 posts views Thread by Vinod | last post: by
2 posts views Thread by George | last post: by
171 posts views Thread by tshad | last post: by
16 posts views Thread by Albretch Mueller | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.