> Message: 3 > Date: Sun, 17 Aug 2008 01:28:23 -0400 > From: xbmuncher <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Is there python editor or plugin for a python > editor for curly brackets around code blocks? > To: "Timothy Grant" <[EMAIL PROTECTED]> > Cc: tutor@python.org > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="iso-8859-1" > > I talked about earlier how the main problem for me wanting to use > curly > braces is because of the visual ease of seeing the end of the code > blocks.. > well you can change the indention guidelines on most code editors to a > bright color and this might be the next best thing. Also a good > feature to > implement is just like there are highlighted curly braces when your > mouse or > key presses are inside certain code blocks, they should highlight or > change > the indentation guides to the same effect....
Highlighted braces are only useful for detecting misleading indentation, in python, since indentation is part of the syntax (instead of just a visual marker) highlighting brace/indentation lost 50% of its usefulness. In python, to see where a block ends, you just need to skim for the first line that have less indentation than the current block. Well, admittably, in a multilevel block that ends at the same time, it is sometimes hard to identify which level is ended, especially if the indentation is small: def blah(): def innerfunc(foo): for i in range(100): if i == foo: while i: i -= 1 for i in range(10): print i innerfunc(10) but that's why PEP 8 (Style Guidelines) recommends using 4 spaces which is quite a lot. Anyway, if you have a code that is more than 4 levels deep, it is a good indication that it may require refactoring. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor