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


Groups > comp.lang.python > #58045

Re: First day beginner to python, add to counter after nested loop

From Alister <alister.ware@ntlworld.com>
Subject Re: First day beginner to python, add to counter after nested loop
Newsgroups comp.lang.python
References (7 earlier) <5270F529.5040307@rece.vub.ac.be> <CAPTjJmoW41xSsTx+wjHG64=OGA2FcY+YY1Ceas3wq5pJv42YFw@mail.gmail.com> <mailman.1804.1383136979.18130.python-list@python.org> <_C8cu.52337$gs7.11961@fx16.am4> <d4b5996a-09e9-4f84-a54c-0480a8256305@googlegroups.com>
Message-ID <Ao9cu.52339$gs7.15084@fx16.am4> (permalink)
Organization virginmedia.com
Date 2013-10-30 15:15 +0000

Show all headers | View raw


On Wed, 30 Oct 2013 07:31:04 -0700, jonas.thornvall wrote:

> Den onsdagen den 30:e oktober 2013 kl. 15:22:50 UTC+1 skrev Alister:
>> On Wed, 30 Oct 2013 13:42:37 +0100, Antoon Pardon wrote:
>> 
>> 
>> 
>> > Op 30-10-13 13:17, Chris Angelico schreef:
>> 
>> >> On Wed, Oct 30, 2013 at 11:01 PM, Antoon Pardon
>> 
>> >> <antoon.pardon@rece.vub.ac.be> wrote:
>> 
>> >> I broadly agree with your post (I'm of the school of thought that
>> 
>> >> braces are better than indentation for delimiting blocks), but I
>> >> don't
>> 
>> >> think this argument holds water. All you need to do is be consistent
>> 
>> >> about tabs OR spaces (and I'd recommend tabs, since they're simpler
>> >> and
>> 
>> >> safer), and you'll never have this trouble.
>> 
>> 
>> > 
>> > Easier said than done. First of all I can be as consistent as
>> > possible,
>> 
>> > I can't just take code from someone else and insert it because that
>> 
>> > other person may be consistenly doing it different from me.
>> 
>> 
>> 
>> I disagree it is very easy.
>> 
>> 
>> 
>> 1) make sure you editor is set to inset 4 spaces rather than tab when
>> 
>> pressing the tab key. consistency in your own code is now not an issue.
>> 
>> 
>> 
>> 2) when importing code from someone else a simple search & replace of
>> tab
>> 
>> with 4 spaces will instantly correct the formatting on code using tab
>> 
>> without breaking code that doesn't.
>> 
>> 
>> 
>> 
>> 
>> 
>> > 
>> > Then if you are working on different machines, the settings of your
>> 
>> > editor may not always be the same so that you have tabs on one
>> > machine
>> 
>> > and spaces on an other, which causes problem when you move the code.
>> 
>> 
>> > 
>> that is fixed by setting your environment consistantly but step 2 above
>> 
>> will fix it if you forget.
>> 
>> 
>> 
>> > Also when you have an xterm, selecting a tab and pasting it into
>> > another
>> 
>> > it will turn the tab into spaces.
>> 
>> 
>> 
>> Read pep 11 & always use 4 spaces for indentation not tab.
>> 
>> 
>> 
>> 
>> > 
>> > All these things usually can be ignored, they typically only show up
>> 
>> > when you print something and things aren't aligned as you expect but
>> 
>> > with python you are forced to correct those things immediately,
>> > forcing
>> 
>> > you to focus on white space layout issues instead of on the logic of
>> > the
>> 
>> > code.
>> 
>> 
>> > 
>> >> Also, the parser should tell you if you mix tabs and spaces, so that
>> 
>> >> won't trip anything either.
>> 
>> 
>> > 
>> > Maybe you mean something different than I understand but a program
>> 
>> > throwing a syntax error because there is a tab instead of a number of
>> 
>> > spaces or vice versa, is something I would understand as tripping.
>> 
>> 
>> 
>> no more than failing to close a brace in a C like language
>> 
>> indentation is the syntax of python you will grow to love it, like most
>> 
>> people I found it distracting at first even though i tended to indent
>> 
>> other code (inconsistently)to make it readable.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> --
>> 
>> I am what you will be; I was what you are.
> 
> Alister i do not ask for changing the actual implementation with indents
> that the compiler/interpretator work with. What i ask for is some
> courtesy relative the programmers using IDLE, to incorporate a simple
> automatic parser that let them who like to write slopy formatted with
> end instead to do so. And the parser in editor automaticly go in and
> autoindent *function, loops, if and allow end that the editor autoindent
> to end of loop. It can not be that hard i have implemented my own python
> using this...

In that case I think you have found yourself a project ;-)

I believe Idle is itself written in python so adding a clean-up function 
that meets your requirements should be feasible. you may even find others 
who find it useful.

Personally I would recommend finding a better environment than Idle




-- 
Your love life will be... interesting.

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


Thread

First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-29 10:40 -0700
  Re: First day beginner to python, add to counter after nested loop Neil Cerutti <neilc@norwich.edu> - 2013-10-29 18:09 +0000
    Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-29 11:23 -0700
      Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-29 11:35 -0700
        Re: First day beginner to python, add to counter after nested loop Dave Angel <davea@davea.name> - 2013-10-29 19:24 +0000
          Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-29 13:08 -0700
            Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-29 13:11 -0700
              Re: First day beginner to python, add to counter after nested loop Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-29 20:37 +0000
              Re: First day beginner to python, add to counter after nested loop Dave Angel <davea@davea.name> - 2013-10-30 01:44 +0000
            Re: First day beginner to python, add to counter after nested loop Ned Batchelder <ned@nedbatchelder.com> - 2013-10-29 16:30 -0400
            Re: First day beginner to python, add to counter after nested loop Neil Cerutti <neilc@norwich.edu> - 2013-10-29 20:32 +0000
              Re: First day beginner to python, add to counter after nested loop Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-10-30 11:53 +1300
            Re: First day beginner to python, add to counter after nested loop Tim Roberts <timr@probo.com> - 2013-10-30 00:07 -0700
              Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 01:52 -0700
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 02:48 -0700
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 02:52 -0700
                Re: First day beginner to python, add to counter after nested loop Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-30 10:00 +0000
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 03:13 -0700
                Re: First day beginner to python, add to counter after nested loop rusi <rustompmody@gmail.com> - 2013-10-30 05:08 -0700
                Re: First day beginner to python, add to counter after nested loop Ned Batchelder <ned@nedbatchelder.com> - 2013-10-30 08:51 -0400
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 03:42 -0700
              Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 03:08 -0700
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 03:11 -0700
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 03:19 -0700
                Re: First day beginner to python, add to counter after nested loop alex23 <wuwei23@gmail.com> - 2013-11-01 11:05 +1000
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 07:24 -0700
                Re: First day beginner to python, add to counter after nested loop Chris Angelico <rosuav@gmail.com> - 2013-10-30 21:42 +1100
                Re: First day beginner to python, add to counter after nested loop Alister <alister.ware@ntlworld.com> - 2013-10-30 14:07 +0000
                Re: First day beginner to python, add to counter after nested loop Tim Roberts <timr@probo.com> - 2013-11-02 13:19 -0700
                Re: First day beginner to python, add to counter after nested loop Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-11-03 12:33 +0100
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-11-03 04:54 -0800
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-11-03 04:55 -0800
              Re: First day beginner to python, add to counter after nested loop Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-10-30 13:01 +0100
                Re: First day beginner to python, add to counter after nested loop Grant Edwards <invalid@invalid.invalid> - 2013-10-30 15:50 +0000
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 08:54 -0700
                Re: First day beginner to python, add to counter after nested loop Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-10-30 19:59 +0100
              Re: First day beginner to python, add to counter after nested loop Chris Angelico <rosuav@gmail.com> - 2013-10-30 23:17 +1100
              Re: First day beginner to python, add to counter after nested loop Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-10-30 13:42 +0100
                Re: First day beginner to python, add to counter after nested loop Alister <alister.ware@ntlworld.com> - 2013-10-30 14:22 +0000
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 07:31 -0700
                Re: First day beginner to python, add to counter after nested loop Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-30 15:09 +0000
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 08:35 -0700
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 08:51 -0700
                Re: First day beginner to python, add to counter after nested loop Alister <alister.ware@ntlworld.com> - 2013-10-30 15:51 +0000
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 09:14 -0700
                Re: First day beginner to python, add to counter after nested loop Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-10-30 16:47 -0400
                Re: First day beginner to python, add to counter after nested loop alex23 <wuwei23@gmail.com> - 2013-11-01 11:07 +1000
                Re: First day beginner to python, add to counter after nested loop rusi <rustompmody@gmail.com> - 2013-10-30 08:53 -0700
                Re: First day beginner to python, add to counter after nested loop Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2013-10-30 22:00 +0530
                Re: First day beginner to python, add to counter after nested loop rusi <rustompmody@gmail.com> - 2013-10-30 09:45 -0700
                Re: First day beginner to python, add to counter after nested loop Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-30 15:54 +0000
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 08:57 -0700
                Re: First day beginner to python, add to counter after nested loop Alister <alister.ware@ntlworld.com> - 2013-10-30 16:13 +0000
                Re: First day beginner to python, add to counter after nested loop rusi <rustompmody@gmail.com> - 2013-10-30 09:16 -0700
                Re: First day beginner to python, add to counter after nested loop Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-30 16:38 +0000
                Re: First day beginner to python, add to counter after nested loop Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-30 16:22 +0000
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 09:31 -0700
                Re: First day beginner to python, add to counter after nested loop MRAB <python@mrabarnett.plus.com> - 2013-10-30 17:44 +0000
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 10:55 -0700
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 11:02 -0700
                Re: First day beginner to python, add to counter after nested loop Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-10-30 20:09 +0100
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 12:16 -0700
                Re: First day beginner to python, add to counter after nested loop Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-10-30 19:01 +0100
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 11:43 -0700
                Re: First day beginner to python, add to counter after nested loop Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-30 19:05 +0000
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 12:13 -0700
                Re: First day beginner to python, add to counter after nested loop Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-10-30 20:59 +0100
                Re: First day beginner to python, add to counter after nested loop Ned Batchelder <ned@nedbatchelder.com> - 2013-10-30 16:52 -0400
                Re: First day beginner to python, add to counter after nested loop Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-10-30 22:07 +0100
                Re: First day beginner to python, add to counter after nested loop rusi <rustompmody@gmail.com> - 2013-10-31 00:37 -0700
                Re: First day beginner to python, add to counter after nested loop Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-31 10:11 +0000
                Re: First day beginner to python, add to counter after nested loop rusi <rustompmody@gmail.com> - 2013-10-31 04:07 -0700
                Re: First day beginner to python, add to counter after nested loop Alister <alister.ware@ntlworld.com> - 2013-11-01 11:17 +0000
                Re: First day beginner to python, add to counter after nested loop rusi <rustompmody@gmail.com> - 2013-11-01 09:52 -0700
                Re: First day beginner to python, add to counter after nested loop Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-10-31 12:12 +0100
                Re: First day beginner to python, add to counter after nested loop rusi <rustompmody@gmail.com> - 2013-10-31 04:40 -0700
                Re: First day beginner to python, add to counter after nested loop Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-31 14:01 +0000
                Re: First day beginner to python, add to counter after nested loop rusi <rustompmody@gmail.com> - 2013-10-31 08:30 -0700
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 11:55 -0700
                Re: First day beginner to python, add to counter after nested loop Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-30 19:26 +0000
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 12:38 -0700
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 12:41 -0700
                Re: First day beginner to python, add to counter after nested loop Dave Angel <davea@davea.name> - 2013-10-31 03:02 +0000
                Re: First day beginner to python, add to counter after nested loop Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-10-30 16:50 -0400
                Re: First day beginner to python, add to counter after nested loop jonas.thornvall@gmail.com - 2013-10-30 09:19 -0700
                Re: First day beginner to python, add to counter after nested loop Alister <alister.ware@ntlworld.com> - 2013-10-30 15:15 +0000
                Re: First day beginner to python, add to counter after nested loop Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-10-30 15:56 +0100
                Re: First day beginner to python, add to counter after nested loop Alister <alister.ware@ntlworld.com> - 2013-10-30 16:07 +0000
                Re: First day beginner to python, add to counter after nested loop Alister <alister.ware@ntlworld.com> - 2013-10-30 16:14 +0000
                Re: First day beginner to python, add to counter after nested loop rurpy@yahoo.com - 2013-10-30 10:02 -0700

csiph-web