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


Groups > comp.lang.python > #79158

Re: Is there an easy way to control indents in Python

Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'else:': 0.03; 'subject:Python': 0.06; 'parsed': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'reformat': 0.09; 'python': 0.11; 'jan': 0.12; 'code?': 0.16; 'fully,': 0.16; 'invalid.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'settings)': 0.16; 'true:': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'settings': 0.22; '>>>': 0.22; 'select': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'parse': 0.24; '15,': 0.26; 'this:': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'correct': 0.29; 'chris': 0.29; 'am,': 0.29; 'url:mailman': 0.30; 'code': 0.31; 'usually': 0.31; 'keys': 0.31; 'file': 0.32; 'url:python': 0.33; 'sense': 0.34; 'done.': 0.35; 'editor': 0.35; 'there': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'should': 0.36; 'christian': 0.38; 'auto': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'though,': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'url:mail': 0.40; 'how': 0.40; 'even': 0.60; 'such': 0.63; 'choose': 0.64; 'more': 0.64; 'forward': 0.65; 'skip:\xe2 10': 0.65; 'determine': 0.67; 'subject:there': 0.68; '8bit%:43': 0.74; "'true'": 0.84; '10:32': 0.84; 'hardly': 0.84; 'placement': 0.84; 'received:fios.verizon.net': 0.84; 'why?': 0.91; 'received:108': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Is there an easy way to control indents in Python
Date Wed, 15 Oct 2014 13:12:51 -0400
References <9a0c67be-de3a-4770-bf06-e158783bfff0@googlegroups.com> <mailman.14869.1413339808.18130.python-list@python.org> <m1l7l8$sce$1@dont-email.me> <CAMw+j7+CisEW8=jyVyxkj_7FDj_Lmj+CjjNbJ3Coi2c2q3C2Gg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding quoted-printable
X-Gmane-NNTP-Posting-Host pool-108-16-203-145.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
In-Reply-To <CAMw+j7+CisEW8=jyVyxkj_7FDj_Lmj+CjjNbJ3Coi2c2q3C2Gg@mail.gmail.com>
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 <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14883.1413393202.18130.python-list@python.org> (permalink)
Lines 65
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1413393202 news.xs4all.nl 2925 [2001:888:2000:d::a6]:44004
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:79158

Show key headers only | View raw


On 10/15/2014 10:32 AM, Chris “Kwpolska” Warrick wrote:
> On Wed, Oct 15, 2014 at 9:27 AM, alex23 <wuwei23@gmail.com> wrote:
>> On 15/10/2014 12:23 PM, Juan Christian wrote:
>>>
>>> Using PyCharm is easy:
>>>
>>> File > Settings > (IDE Settings) Editor > Smart Keys > Reformat on paste
>>>   > choose "Reformat Block"
>>
>>
>>
>> This isn't as straight forward as you imply. Say I have misindented code
>> like this:
>>
>>      if True:
>>      print 'true'
>>      else:
>>      print 'false'
>>      print 'done'
>>
>> If I select this block in PyCharm and reformat it, I get:
>>
>>      if True:
>>          print 'true'
>>      else:
>>      print 'false'
>>      print 'done'
>>
>> Which is still invalid. Even if it did work more fully, though, how would it
>> determine the correct placement of the last line of code?
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>
> It should parse this as
>
> else:
>      print 'false'
>      print 'done'
>
> Why?  Because things like `print 'done'` usually have an empty line before it:

There is no such rule in Python so it hardly dependable for auto indenting.


> if True:
> print 'true'
> else:
> print 'false'
>
> print 'done'
>
> That should be parsed the way you want it done.  Makes perfect sense
> when you look at it.
>


-- 
Terry Jan Reedy

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


Thread

Is there an easy way to control indents in Python ryguy7272 <ryanshuell@gmail.com> - 2014-10-14 19:13 -0700
  Re: Is there an easy way to control indents in Python Juan Christian <juan0christian@gmail.com> - 2014-10-14 23:23 -0300
    Re: Is there an easy way to control indents in Python alex23 <wuwei23@gmail.com> - 2014-10-15 17:27 +1000
      Re: Is there an easy way to control indents in Python Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2014-10-15 16:32 +0200
        Re: Is there an easy way to control indents in Python alex23 <wuwei23@gmail.com> - 2014-10-16 09:51 +1000
          Re: Is there an easy way to control indents in Python Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-10-17 18:22 +1300
      Re: Is there an easy way to control indents in Python Terry Reedy <tjreedy@udel.edu> - 2014-10-15 13:12 -0400
      Re: Is there an easy way to control indents in Python Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-15 13:30 -0600
        Re: Is there an easy way to control indents in Python Simon Kennedy <sffjunkie@gmail.com> - 2014-10-16 07:08 -0700
          Re: Is there an easy way to control indents in Python Chris Angelico <rosuav@gmail.com> - 2014-10-17 02:02 +1100
          Re: Is there an easy way to control indents in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-18 21:53 +1100
            Re: Is there an easy way to control indents in Python Simon Kennedy <sffjunkie@gmail.com> - 2014-10-20 08:54 -0700
              Re: Is there an easy way to control indents in Python Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-20 11:54 -0600
                Re: Is there an easy way to control indents in Python Simon Kennedy <sffjunkie@gmail.com> - 2014-10-21 01:45 -0700
                Re: Is there an easy way to control indents in Python Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-21 11:09 -0600
              Re: Is there an easy way to control indents in Python Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-20 11:57 -0600
              Re: Is there an easy way to control indents in Python Juan Christian <juan0christian@gmail.com> - 2014-10-20 17:04 -0200
              Re: Is there an easy way to control indents in Python Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-20 13:40 -0600
              Re: Is there an easy way to control indents in Python MRAB <python@mrabarnett.plus.com> - 2014-10-20 20:43 +0100
              Re: Is there an easy way to control indents in Python Juan Christian <juan0christian@gmail.com> - 2014-10-20 20:30 -0200
              Re: Is there an easy way to control indents in Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-20 21:13 -0400
  Re: Is there an easy way to control indents in Python Chris Angelico <rosuav@gmail.com> - 2014-10-15 13:18 +1100
  Re: Is there an easy way to control indents in Python Dan Stromberg <drsalists@gmail.com> - 2014-10-14 19:38 -0700
  Re: Is there an easy way to control indents in Python Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-14 21:35 -0500
  Re: Is there an easy way to control indents in Python Chris Angelico <rosuav@gmail.com> - 2014-10-15 13:47 +1100
  Re: Is there an easy way to control indents in Python jumppanen.jussi@gmail.com - 2014-10-21 06:51 -0700

csiph-web