[Tutor] Is there python editor or plugin for a python editor for curly brackets around code blocks?

Timothy Grant timothy.grant at gmail.com
Thu Aug 14 07:16:24 CEST 2008


On Wed, Aug 13, 2008 at 9:08 PM, xbmuncher <xboxmuncher at gmail.com> wrote:
> I don't see what the big deal is on coming up with the .{ #{, and other
> bracket types to try to not interfere with normal bracket use in python. Its
> relatively easy to create a parser to identify the brackets in use normally
> and the code block brackets, with regex or without.
>
> On Wed, Aug 13, 2008 at 11:39 PM, Chad Crabtree <flaxeater at gmail.com> wrote:
>>
>> Oh, I forgot there's another way to add braces
>>
>> if it_is_way_cool: #{
>>  print 'coolness'
>> #}
>>
>> On Wed, Aug 13, 2008 at 11:06 PM, xbmuncher <xboxmuncher at gmail.com> wrote:
>> > I'll check out your links. But in response to some of the things said:
>> > I'm a fan of indentation, a replacement of indentation with curly braces
>> > is
>> > not what I was aiming for. If I could have it my way, I'd have
>> > indentation
>> > and curly braces. I don't want to change official python syntax either..
>> > I
>> > just want to be able to easily do it myself.
>> >
>> > The big problem I had that I didn't explain well enough when I said
>> > "visually" is that it is visually hard to tell when code blocks end when
>> > other code blocks and statements begin immediately after them. With
>> > curly
>> > braces you can easily visualize when looking at a lot of code where the
>> > code
>> > block ends. The best thing you can do in python currently is to put an
>> > empty
>> > line in between the last line of a code block and the following code, so
>> > you
>> > can better visualize the end of the code block.
>> >
>> > On Wed, Aug 13, 2008 at 4:23 AM, Chris Fuller
>> > <cfuller084 at thinkingplanet.net> wrote:
>> >>
>> >> Some clarifications w.r.t. indentation and Python:
>> >> http://www.secnetix.de/olli/Python/block_indentation.hawk
>> >>
>> >> It's just a joke, really:
>> >> http://timhatch.com/projects/pybraces/
>> >>
>> >> Turnabout is fair play!
>> >> http://blog.micropledge.com/2007/09/nobraces/
>> >>
>> >> Also, pindent.py in the Tools/scripts directory of your Python
>> >> distribution
>> >> will produce correctly indented scripts if the blocks are designated
>> >> with
>> >> a "#end" line.
>> >>
>> >>
>> >> But seriously, you don't want to go creating a separate class of source
>> >> file.
>> >> It'll be harder for you and the other programmers to context switch
>> >> when
>> >> working with code that uses the standard style, will confuse others who
>> >> won't
>> >> know what to do with your code, adds overhead to the compiling, will
>> >> break
>> >> when somebody tries to run it under the standard environment, could
>> >> clutter
>> >> up your development directories, depending on the implementation, etc.
>> >>
>> >> Here's a thread from 1999 on the Python mailing list that discusses the
>> >> issue:
>> >> http://mail.python.org/pipermail/python-list/1999-June/004450.html
>> >>
>> >> There's another script towards the end that might even do what you
>> >> want,
>> >> but
>> >> you might want to read what they have to say first :)
>> >>
>> >> Cheers
>> >> _______________________________________________
>> >> Tutor maillist  -  Tutor at python.org
>> >> http://mail.python.org/mailman/listinfo/tutor



If it's no big deal to parse the braces, I would encourage you to
write your own python preprocessor to handle that for you.


-- 
Stand Fast,
tjg. [Timothy Grant]


More information about the Tutor mailing list