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


Groups > comp.lang.python > #51648

Re: Script that converts between indentation and curly braces in Python code

Path csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed0.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.86.MISMATCH!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'subject:Python': 0.06; 'subject:code': 0.07; 'converts': 0.09; 'spaces': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'braces,': 0.16; 'braces?': 0.16; 'copying.': 0.16; 'curly': 0.16; 'eat': 0.16; 'inserting': 0.16; 'losing': 0.16; 'notation': 0.16; 'precede': 0.16; 'subject: \n ': 0.16; 'subject:between': 0.16; 'tabs': 0.16; 'whitespace.': 0.16; 'wrote:': 0.18; '(but': 0.19; 'stack': 0.19; 'cc:addr:python.org': 0.22; 'copied': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'that.': 0.31; 'indentation': 0.31; 'subject:that': 0.31; 'figure': 0.32; 'url:python': 0.33; 'guess': 0.33; 'copying': 0.34; 'maybe': 0.34; 'could': 0.34; 'problem': 0.35; 'convert': 0.35; 'received:google.com': 0.35; 'google': 0.35; 'add': 0.35; 'there': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'should': 0.36; 'application': 0.37; 'pm,': 0.38; 'environment.': 0.39; 'sure': 0.39; 'url:mail': 0.40; 'even': 0.60; 'lost': 0.61; 'course': 0.61; 'back': 0.62; 'exchange': 0.63; '30,': 0.65; 'to:addr:gmail.com': 0.65; 'jul': 0.74; 'walk': 0.74; '11:45': 0.84; 'musical': 0.84; 'that)': 0.84; 'joel': 0.91; 'tags,': 0.95; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=9meSZ+mzWVl7r4t+5ninyyqc505cNDX0iGwYojO+Hrg=; b=w3w2TrdbatQm53CJ6jsbNpPtPhIeaBinLtKAvZ4yfy1GvcNZrgD9/PF3tffj2kmzex 9D81DBacnokv47kJJZ49TEs07bfQCQd5dmh52LW6P+TZRcQHJToUUdp/o3Efb4LYNBP0 iomNQSwCATJ1wKkRSaYbxeofQ+MtYHE+J9hfGCMlhrbaealju4IQ+w4JvNdZHI+6Y9Df xZhuVHqa1JkXhvZNTCcWkdMXcBhLCFHDeTOGCwQTGRmFPkUTcwbguJAfiexIx7vfabGx X9NvHGK9FS5vSooseFVVNiVfX8vVBqoeYfltDHdPNKIjQKJAa79a6trAUE6Q4CaFICVb UwXw==
MIME-Version 1.0
X-Received by 10.220.124.1 with SMTP id s1mr11420949vcr.93.1375274275705; Wed, 31 Jul 2013 05:37:55 -0700 (PDT)
In-Reply-To <09DBD544-FA04-48DC-8FEA-1E788FE1C6A6@gmail.com>
References <09DBD544-FA04-48DC-8FEA-1E788FE1C6A6@gmail.com>
Date Wed, 31 Jul 2013 08:37:55 -0400
Subject Re: Script that converts between indentation and curly braces in Python code
From Joel Goldstick <joel.goldstick@gmail.com>
To Musical Notation <musicdenotation@gmail.com>
Content-Type text/plain; charset=UTF-8
Cc Python Mailing List <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18.1375274285.1251.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1375274285 news.xs4all.nl 15879 [2001:888:2000:d::a6]:41565
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51648

Show key headers only | View raw


On Tue, Jul 30, 2013 at 11:45 PM, Musical Notation
<musicdenotation@gmail.com> 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.

I guess you could google that.

What do you mean that indentation is 'sometimes' lost when copying.  I
think you should walk down that path to understand why you are losing
your indentation.  It could be you are using tabs instead of spaces
for indentation.  It could also be that you are inserting your code
directly into HTML which of course will eat the extra whitespace.
That problem can be solved with <pre> tags, or maybe even <code> (but
I am not sure about that)

If you are copying code to a website like stack exchange you need to
precede each line of code with  (2 I think!) spaces.  They use
markdown.

If you wanted to add in curly braces, I am guesses the only purpose
for this would be that you would convert them back to proper
indentation in the copied to environment.  So then you have to figure
out a way to do that.



> --
> http://mail.python.org/mailman/listinfo/python-list



-- 
Joel Goldstick
http://joelgoldstick.com

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Script that converts between indentation and curly braces in Python code Joel Goldstick <joel.goldstick@gmail.com> - 2013-07-31 08:37 -0400

csiph-web