Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51647 > unrolled thread

Script that converts between indentation and curly braces in Python code

Started byMusical Notation <musicdenotation@gmail.com>
First post2013-07-31 10:45 +0700
Last post2013-08-01 06:23 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  Script that converts between indentation and curly braces in Python code Musical Notation <musicdenotation@gmail.com> - 2013-07-31 10:45 +0700
    Re: Script that converts between indentation and curly braces in Python code Neil Hodgson <nhodgson@iinet.net.au> - 2013-07-31 23:20 +1000
    Re: Script that converts between indentation and curly braces in Python code Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-01 06:23 +0000

#51647 — Script that converts between indentation and curly braces in Python code

FromMusical Notation <musicdenotation@gmail.com>
Date2013-07-31 10:45 +0700
SubjectScript that converts between indentation and curly braces in Python code
Message-ID<mailman.16.1375272465.1251.python-list@python.org>
Is there any script that converts indentation in Python code to curly braces? The indentation is sometime lost when I copy my code to an application or a website.

[toc] | [next] | [standalone]


#51653

FromNeil Hodgson <nhodgson@iinet.net.au>
Date2013-07-31 23:20 +1000
Message-ID<zL-dnfjUlN4vkmTMnZ2dnUVZ_uWdnZ2d@westnet.com.au>
In reply to#51647
Musical Notation:

> Is there any script that converts indentation in Python code to curly braces?
> The indentation is sometime lost when I copy my code to an application or a website.

    pindent.py in the Tools/Scripts directory of Python installations 
does something similar by adding or removing comments that look like

# end if

    Neil

[toc] | [prev] | [next] | [standalone]


#51717

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-08-01 06:23 +0000
Message-ID<51f9fed7$0$30000$c3e8da3$5496439d@news.astraweb.com>
In reply to#51647
On Wed, 31 Jul 2013 10:45:36 +0700, Musical Notation wrote:

> Is there any script that converts indentation in Python code to curly
> braces? The indentation is sometime lost when I copy my code to an
> application or a website.

Complain to the website or application that it is throwing away 
significant data. If you had a website that turned this paragraph into 
this:

"Complaintothewebsiteorapplicationthatitisthrowingawaysignificantdata.Ifyouhadawebsitethatturnedthisparagraphintothis"

you would rightly complain about the bug, or stop using the website. 
Throwing away indentation is no different.


-- 
Steven

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web