Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #72670
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: OT: This Swift thing |
| Date | 2014-06-04 22:43 -0400 |
| References | (4 earlier) <lmlftv$6ii$1@speranza.aioe.org> <mailman.10703.1401891868.18130.python-list@python.org> <lmnbsn$jlv$1@speranza.aioe.org> <mailman.10717.1401920316.18130.python-list@python.org> <lmo9ph$610$1@speranza.aioe.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.10720.1401936204.18130.python-list@python.org> (permalink) |
On 6/4/2014 7:23 PM, Mark H Harris wrote: > On 6/4/14 5:18 PM, Terry Reedy wrote: >> On 6/4/2014 10:53 AM, Mark H Harris wrote: >>> The primary paradigm on this topic locally is that >>> indents are bad because malformed or mangled code cannot be reformatted >>> easily (if at all). >> >> Begin solution:':' as the end of a line means 'begin block; indent next >> line'. If one is using tools that mangle, one can add end-of-block >> comments: '# end, # end if, # if (end implied), or even just ##. In any >> case, the stylized comment could mean 'dedent' and code could be >> reconstituted with all indents stripped. There are probably programs on >> PyPI to do that. End of excuse. >> > > Yup. Well, I've only been doing python coding for ~9-10 years, but > I've never had this formatting problem. The only problem I have seen is when people post code here with \t for indent. Many mail readers treat \t as a null char since it actually has no standard translation into screen space. This is one reason why PEP8 recommends using spaces rather than \t for indent. On today's systems, the space saved with \t is not worth the trouble. > I viewed the entire debate as > 'an excuse'. I'm going to do some looking on PyPI-- it would be nice to > point folks to something concrete. If its an excuse, then that puts an > end to it. > > As long as I'm addressing an IDLE guy, what would you think of a > feature for IDLE that would format python code with block delimiters > automatically and visa versa ? I would not include it by default, as I would not want to encourage block-commenting Python code. However, anyone could write an extension that would add 3 menu items: BlockIn (add block comment), BlockDent (re-indent according to block markers), and BlockOut (remove block comments). The editor Format menu would be the obvious place. One would not have to parse; instead let tokenize do that. Then BlockIn: add Block comment and Newline tokens before Dedent tokens; BlockDent: replace BlockComment Newline with Dedent. In either case, follow with untokenize. Simply removing block markers could be done directly. The block comment could even be user configurable. (At the moment, untokenize does not properly reconstitue files indented with \t.) -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-03 20:43 +0000
Re: OT: This Swift thing Marko Rauhamaa <marko@pacujo.net> - 2014-06-04 00:19 +0300
Re: OT: This Swift thing Steven D'Aprano <steve@pearwood.info> - 2014-06-04 04:30 +0000
Re: OT: This Swift thing Marko Rauhamaa <marko@pacujo.net> - 2014-06-04 08:23 +0300
Re: OT: This Swift thing Mark H Harris <harrismh777@gmail.com> - 2014-06-03 16:49 -0500
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-04 08:01 +1000
Re: OT: This Swift thing "Eric S. Johansson" <esj@harvee.org> - 2014-06-03 19:22 -0400
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-04 09:29 +1000
Re: OT: This Swift thing "Eric S. Johansson" <esj@harvee.org> - 2014-06-03 19:36 -0400
Re: OT: This Swift thing Steven D'Aprano <steve@pearwood.info> - 2014-06-04 04:54 +0000
Re: OT: This Swift thing Mark H Harris <harrismh777@gmail.com> - 2014-06-04 09:43 -0500
Re: OT: This Swift thing Skip Montanaro <skip@pobox.com> - 2014-06-04 09:24 -0500
Re: OT: This Swift thing Mark H Harris <harrismh777@gmail.com> - 2014-06-04 09:53 -0500
Re: OT: This Swift thing Terry Reedy <tjreedy@udel.edu> - 2014-06-04 18:18 -0400
Re: OT: This Swift thing Mark H Harris <harrismh777@gmail.com> - 2014-06-04 18:23 -0500
Re: OT: This Swift thing Terry Reedy <tjreedy@udel.edu> - 2014-06-04 22:43 -0400
Re: OT: This Swift thing Steven D'Aprano <steve@pearwood.info> - 2014-06-05 08:39 +0000
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-05 18:52 +1000
Re: OT: This Swift thing Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-06-05 08:27 -0400
Re: OT: This Swift thing Rustom Mody <rustompmody@gmail.com> - 2014-06-05 05:56 -0700
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-05 15:12 +0000
Re: OT: This Swift thing Rustom Mody <rustompmody@gmail.com> - 2014-06-05 08:39 -0700
Re: OT: This Swift thing Rustom Mody <rustompmody@gmail.com> - 2014-06-05 08:44 -0700
Tabs (was Re: OT: This Swift thing) Terry Reedy <tjreedy@udel.edu> - 2014-06-05 15:05 -0400
Re: Tabs (was Re: OT: This Swift thing) Terry Reedy <tjreedy@udel.edu> - 2014-06-05 18:23 -0400
Re: Tabs (was Re: OT: This Swift thing) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-06-05 20:52 -0400
Re: OT: This Swift thing CHIN Dihedral <dihedral88888@gmail.com> - 2014-06-15 03:08 -0700
Re: OT: This Swift thing Michael Torrie <torriem@gmail.com> - 2014-06-04 09:00 -0600
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-05 01:26 +1000
Re: OT: This Swift thing Kevin Walzer <kw@codebykevin.com> - 2014-06-03 19:39 -0400
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-04 01:53 +0200
Re: OT: This Swift thing Andrea D'Amore <anddamNOALPASTICCIODICARNE+gruppi@brapi.net> - 2014-06-04 09:47 +0200
csiph-web