Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57940 > unrolled thread
| Started by | jonas.thornvall@gmail.com |
|---|---|
| First post | 2013-10-29 10:40 -0700 |
| Last post | 2013-10-30 10:02 -0700 |
| Articles | 20 on this page of 90 — 17 participants |
Back to article view | Back to comp.lang.python
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
Page 2 of 5 — ← Prev page 1 [2] 3 4 5 Next page →
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2013-10-30 03:42 -0700 |
| Message-ID | <419acbf9-2f92-47f5-bb70-b6886f258d46@googlegroups.com> |
| In reply to | #58018 |
Den onsdagen den 30:e oktober 2013 kl. 11:00:30 UTC+1 skrev Mark Lawrence: > On 30/10/2013 09:52, jonas.thornvall@gmail.com wrote: > > > > Please stop sending us double spaced crap. > > > > -- > > Python is the second best programming language in the world. > > But the best has yet to be invented. Christian Tismer > > > > Mark Lawrence I think it is not me it is probably google groups, well maybe they should consider changing linebreak sign as stored in database.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2013-10-30 03:08 -0700 |
| Message-ID | <7a457657-7a38-4f68-a33f-820b4629df31@googlegroups.com> |
| In reply to | #58009 |
Den onsdagen den 30:e oktober 2013 kl. 08:07:31 UTC+1 skrev Tim Roberts: > jonas.thornvall@gmail.com wrote: > > > > > >Why did Python not implement end... The end is really not necessary for > > >the programming language it can be excluded, but it is a courtesy to > > >the programmer and could easily be transformed to indents automaticly, > > >that is removed before the compiliation/interpretation of code. > > > > You only say that because your brain has been poisoned by languages that > > require some kind of "end". It's not necessary, and it's extra typing. 99% > > of programmers do the indentation anyway, to make the program easy to read, > > so why not just make it part of the syntax? That way, you don't > > accidentally have the indentation not match the syntax. > > -- > > Tim Roberts, timr@probo.com > > Providenza & Boekelheide, Inc. Well Tim ***one could argue*** why not do a (i think it is called parser) that react to "loop", "end" and "function". And lazy like me do not have to think about "what is not part of program". I certainly do not like the old bracket style it was a catastrophe, but in honesty the gui editor of python should have what i propose, a parser that indent automaticly at loops, functions and end. I promise you it will save millions of hours of bug searching all over world in a month.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2013-10-30 03:11 -0700 |
| Message-ID | <ebe9bdc1-b73b-4279-bca6-91595b01cb1d@googlegroups.com> |
| In reply to | #58019 |
Den onsdagen den 30:e oktober 2013 kl. 11:08:11 UTC+1 skrev jonas.t...@gmail.com: > Den onsdagen den 30:e oktober 2013 kl. 08:07:31 UTC+1 skrev Tim Roberts: > > > jonas.thornvall@gmail.com wrote: > > > > > > > > > > > > > >Why did Python not implement end... The end is really not necessary for > > > > > > >the programming language it can be excluded, but it is a courtesy to > > > > > > >the programmer and could easily be transformed to indents automaticly, > > > > > > >that is removed before the compiliation/interpretation of code. > > > > > > > > > > > > You only say that because your brain has been poisoned by languages that > > > > > > require some kind of "end". It's not necessary, and it's extra typing. 99% > > > > > > of programmers do the indentation anyway, to make the program easy to read, > > > > > > so why not just make it part of the syntax? That way, you don't > > > > > > accidentally have the indentation not match the syntax. > > > > > > -- > > > > > > Tim Roberts, timr@probo.com > > > > > > Providenza & Boekelheide, Inc. > > > > Well Tim ***one could argue*** why not do a (i think it is called parser) that react to "loop", "end" and "function". And lazy like me do not have to think about "what is not part of program". > > > > I certainly do not like the old bracket style it was a catastrophe, but in honesty the gui editor of python should have what i propose, a parser that indent automaticly at loops, functions and end. I promise you it will save millions of hours of bug searching all over world in a month. Instead of having going over indent manually, you just drop in an end it is so simple, no marking no meny indent unindent it is automaticly done. And that was the purpose of python to remove idiocies, like brackets and indents.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2013-10-30 03:19 -0700 |
| Message-ID | <f8ccf5cc-1e8d-4b8b-a2cd-b988307d5012@googlegroups.com> |
| In reply to | #58020 |
Den onsdagen den 30:e oktober 2013 kl. 11:11:17 UTC+1 skrev jonas.t...@gmail.com: > Den onsdagen den 30:e oktober 2013 kl. 11:08:11 UTC+1 skrev jonas.t...@gmail.com: > > > Den onsdagen den 30:e oktober 2013 kl. 08:07:31 UTC+1 skrev Tim Roberts: > > > > > > > jonas.thornvall@gmail.com wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >Why did Python not implement end... The end is really not necessary for > > > > > > > > > > > > > > >the programming language it can be excluded, but it is a courtesy to > > > > > > > > > > > > > > >the programmer and could easily be transformed to indents automaticly, > > > > > > > > > > > > > > >that is removed before the compiliation/interpretation of code. > > > > > > > > > > > > > > > > > > > > > > > > > > > > You only say that because your brain has been poisoned by languages that > > > > > > > > > > > > > > require some kind of "end". It's not necessary, and it's extra typing. 99% > > > > > > > > > > > > > > of programmers do the indentation anyway, to make the program easy to read, > > > > > > > > > > > > > > so why not just make it part of the syntax? That way, you don't > > > > > > > > > > > > > > accidentally have the indentation not match the syntax. > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > Tim Roberts, timr@probo.com > > > > > > > > > > > > > > Providenza & Boekelheide, Inc. > > > > > > > > > > > > Well Tim ***one could argue*** why not do a (i think it is called parser) that react to "loop", "end" and "function". And lazy like me do not have to think about "what is not part of program". > > > > > > > > > > > > I certainly do not like the old bracket style it was a catastrophe, but in honesty the gui editor of python should have what i propose, a parser that indent automaticly at loops, functions and end. I promise you it will save millions of hours of bug searching all over world in a month. > > > > Instead of having going over indent manually, you just drop in an end it is so simple, no marking no meny indent unindent it is automaticly done. And that was the purpose of python to remove idiocies, like brackets and indents. You could have it in the menu indent parser on off. If on you write out ends, and the text is automaticly indented, by using end or a reserved sign. It is quite simple i could program it in a day...
[toc] | [prev] | [next] | [standalone]
| From | alex23 <wuwei23@gmail.com> |
|---|---|
| Date | 2013-11-01 11:05 +1000 |
| Message-ID | <l4uupb$f3b$1@dont-email.me> |
| In reply to | #58022 |
On 30/10/2013 8:19 PM, jonas.thornvall@gmail.com wrote: >It is quite simple i could program it in a day... There is certainly nothing stopping you from doing so. Once finished, I recommend placing it on PyPI; if it reaches a critical mass of downloads that support your thesis that "it will save millions of hours of bug searching all over world in a month", then the Python devs would consider adding it to the library or default interpreter. Until then, you're projecting your personal preference onto everyone.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2013-10-30 07:24 -0700 |
| Message-ID | <2825d291-a974-4bc4-877c-e40525a4a627@googlegroups.com> |
| In reply to | #58020 |
Den onsdagen den 30:e oktober 2013 kl. 11:11:17 UTC+1 skrev jonas.t...@gmail.com:
> Den onsdagen den 30:e oktober 2013 kl. 11:08:11 UTC+1 skrev jonas.t...@gmail.com:
>
> > Den onsdagen den 30:e oktober 2013 kl. 08:07:31 UTC+1 skrev Tim Roberts:
>
> >
>
> > > jonas.thornvall@gmail.com wrote:
>
> >
I suddenly realised i mixed code from a plain square system with the generic exponential modulus system.
Here is the code, what it does is encode numbers in an exponential modulus base. So it is basicly a numbersystem of my own you do not need to write out + ^ and exponent because the numbersystem create unique values for every natural number.
Well without the + ^ it is hard to read but so are binary, ternary and hexadecimal. I think the requirment for a numbersystem is that it have a working arithmetic, and mine have.
So here is the working code, to write out exponential modulus number for and exponent.
#!/usr/bin/python
import math
# Function definition is here
def sq(number):
exp=1
factor=2
multip=math.pow(2,exponent)
print(x,"= ", end="")
while number>=multip:
while exp<=number:
factor+=1
exp=math.pow(factor,exponent)
factor-=1
print(factor,"^",exponent,"+",sep="",end="")
exp=math.pow(factor,exponent)
number=number-exp
exp=1
factor=1
print(number)
#Set exponent here
exponent=2
print("Exp=x^",exponent,sep="")
#Set range of numbers x
for x in range (1,100):
sq(x)
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >Why did Python not implement end... The end is really not necessary for
>
> >
>
> > >
>
> >
>
> > > >the programming language it can be excluded, but it is a courtesy to
>
> >
>
> > >
>
> >
>
> > > >the programmer and could easily be transformed to indents automaticly,
>
> >
>
> > >
>
> >
>
> > > >that is removed before the compiliation/interpretation of code.
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > You only say that because your brain has been poisoned by languages that
>
> >
>
> > >
>
> >
>
> > > require some kind of "end". It's not necessary, and it's extra typing. 99%
>
> >
>
> > >
>
> >
>
> > > of programmers do the indentation anyway, to make the program easy to read,
>
> >
>
> > >
>
> >
>
> > > so why not just make it part of the syntax? That way, you don't
>
> >
>
> > >
>
> >
>
> > > accidentally have the indentation not match the syntax.
>
> >
>
> > >
>
> >
>
> > > --
>
> >
>
> > >
>
> >
>
> > > Tim Roberts, timr@probo.com
>
> >
>
> > >
>
> >
>
> > > Providenza & Boekelheide, Inc.
>
> >
>
> >
>
> >
>
> > Well Tim ***one could argue*** why not do a (i think it is called parser) that react to "loop", "end" and "function". And lazy like me do not have to think about "what is not part of program".
>
> >
>
> >
>
> >
>
> > I certainly do not like the old bracket style it was a catastrophe, but in honesty the gui editor of python should have what i propose, a parser that indent automaticly at loops, functions and end. I promise you it will save millions of hours of bug searching all over world in a month.
>
>
>
> Instead of having going over indent manually, you just drop in an end it is so simple, no marking no meny indent unindent it is automaticly done. And that was the purpose of python to remove idiocies, like brackets and indents.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-10-30 21:42 +1100 |
| Message-ID | <mailman.1801.1383129732.18130.python-list@python.org> |
| In reply to | #58019 |
On Wed, Oct 30, 2013 at 9:08 PM, <jonas.thornvall@gmail.com> wrote:
> Well Tim ***one could argue*** why not do a (i think it is called parser) that react to "loop", "end" and "function". And lazy like me do not have to think about "what is not part of program".
Python actually does have a symbol for what you're thinking of - but
it's not a keyword. Check this out:
print("Hello, world!")
for i in range(5):
#{
print("Line #%d"%i)
#}
if i>3:
#{
print("After the loop, i is huge!")
#}
else:
#{
print("After the loop, something is seriously screwy.")
raise RuntimeError
#}
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Alister <alister.ware@ntlworld.com> |
|---|---|
| Date | 2013-10-30 14:07 +0000 |
| Message-ID | <_o8cu.52336$gs7.41159@fx16.am4> |
| In reply to | #58019 |
On Wed, 30 Oct 2013 03:08:11 -0700, jonas.thornvall wrote: > Den onsdagen den 30:e oktober 2013 kl. 08:07:31 UTC+1 skrev Tim Roberts: >> jonas.thornvall@gmail.com wrote: >> > > I certainly do not like the old bracket style it was a catastrophe, but > in honesty the gui editor of python should have what i propose, a parser > that indent automaticly at loops, functions and end. I promise you it > will save millions of hours of bug searching all over world in a month. What editor are you using? I suggest you replace it with one that knows python. I use Geany but may others operate the same way. when i press return after a line that starts a loop it automatically indents the next line the require amount. it retains the current indent level on subsequent lines until i press backspace to return to the previous level it really does not get any simpler than that. -- If you don't care where you are, then you ain't lost.
[toc] | [prev] | [next] | [standalone]
| From | Tim Roberts <timr@probo.com> |
|---|---|
| Date | 2013-11-02 13:19 -0700 |
| Message-ID | <7ana791h1gqn485mk8uti1cd7k8lklp1i8@4ax.com> |
| In reply to | #58019 |
jonas.thornvall@gmail.com wrote: > >I certainly do not like the old bracket style it was a catastrophe, but >in honesty the gui editor of python should have what i propose, a parser >that indent automaticly at loops, functions and end. Many editors do that. Vim, which is what I use, certainly does. >I promise you it will save millions of hours of bug searching all over >world in a month. I suspect you meant "dozens" rather than "millions"... Look, both schemes have their pitfalls. With an "end" requirement, it's easy to have code where the indenting doesn't match the actual nesting, and that causes human confusion. Without the "end" requirement, it's not hard to type code where you forget to dedent. Those are just two manifestations of the exact same problem. Neither scheme is provably superior to the other. It's just a choice that a language designer has to make. I happen to like Python's choice. You'll get used to it. -- Tim Roberts, timr@probo.com Providenza & Boekelheide, Inc.
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2013-11-03 12:33 +0100 |
| Message-ID | <mailman.1981.1383478438.18130.python-list@python.org> |
| In reply to | #58345 |
Op 02-11-13 21:19, Tim Roberts schreef: > jonas.thornvall@gmail.com wrote: >> >> I certainly do not like the old bracket style it was a catastrophe, but >> in honesty the gui editor of python should have what i propose, a parser >> that indent automaticly at loops, functions and end. > > Many editors do that. Vim, which is what I use, certainly does. > >> I promise you it will save millions of hours of bug searching all over >> world in a month. > > I suspect you meant "dozens" rather than "millions"... > > Look, both schemes have their pitfalls. With an "end" requirement, it's > easy to have code where the indenting doesn't match the actual nesting, and > that causes human confusion. Not really. All examples of this kind of confusion I have seem come from C where the problem IMO comes from the fact that people can choose to put one statement after a control structure or a block. I have programmed sometime in modula2 and this mismatch was just not a big deal in that language because such a mismatch usualy resulted in an end missing and the code not compiling, which resolves the confusion rather quickly. Now of course I can mis something. Maybe you can provide an example that would be confusing even with modula2 kind of control structures and still compile and produce a hard to trace bug. -- Antoon Pardon
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2013-11-03 04:54 -0800 |
| Message-ID | <36b5af2d-1723-475b-b78d-db6648556c1b@googlegroups.com> |
| In reply to | #58345 |
Den lördagen den 2:e november 2013 kl. 21:19:44 UTC+1 skrev Tim Roberts: > jonas.thornvall@gmail.com wrote: > > > > > >I certainly do not like the old bracket style it was a catastrophe, but > > >in honesty the gui editor of python should have what i propose, a parser > > >that indent automaticly at loops, functions and end. > > > > Many editors do that. Vim, which is what I use, certainly does. > > > > >I promise you it will save millions of hours of bug searching all over > > >world in a month. > > > > I suspect you meant "dozens" rather than "millions"... > > > > Look, both schemes have their pitfalls. With an "end" requirement, it's > > easy to have code where the indenting doesn't match the actual nesting, and > > that causes human confusion. Without the "end" requirement, it's not hard > > to type code where you forget to dedent. Those are just two manifestations > > of the exact same problem. Neither scheme is provably superior to the > > other. It's just a choice that a language designer has to make. > > > > I happen to like Python's choice. You'll get used to it. > > -- > > Tim Roberts, timr@probo.com > > Providenza & Boekelheide, Inc. What does Vim stand for Voyager interstellar mission?
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2013-11-03 04:55 -0800 |
| Message-ID | <cc1e1975-b723-4eee-badc-3e42b796c829@googlegroups.com> |
| In reply to | #58345 |
Den lördagen den 2:e november 2013 kl. 21:19:44 UTC+1 skrev Tim Roberts: > jonas.thornvall@gmail.com wrote: > > > > > >I certainly do not like the old bracket style it was a catastrophe, but > > >in honesty the gui editor of python should have what i propose, a parser > > >that indent automaticly at loops, functions and end. > > > > Many editors do that. Vim, which is what I use, certainly does. > > > > >I promise you it will save millions of hours of bug searching all over > > >world in a month. > > > > I suspect you meant "dozens" rather than "millions"... > > > > Look, both schemes have their pitfalls. With an "end" requirement, it's > > easy to have code where the indenting doesn't match the actual nesting, and > > that causes human confusion. Without the "end" requirement, it's not hard > > to type code where you forget to dedent. Those are just two manifestations > > of the exact same problem. Neither scheme is provably superior to the > > other. It's just a choice that a language designer has to make. > > > > I happen to like Python's choice. You'll get used to it. > > -- > > Tim Roberts, timr@probo.com > > Providenza & Boekelheide, Inc. Was there a VIM discussion group?
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2013-10-30 13:01 +0100 |
| Message-ID | <mailman.1802.1383134507.18130.python-list@python.org> |
| In reply to | #58009 |
Op 30-10-13 08:07, Tim Roberts schreef: > jonas.thornvall@gmail.com wrote: >> >> Why did Python not implement end... The end is really not necessary for >> the programming language it can be excluded, but it is a courtesy to >> the programmer and could easily be transformed to indents automaticly, >> that is removed before the compiliation/interpretation of code. > > You only say that because your brain has been poisoned by languages that > require some kind of "end". It's not necessary, and it's extra typing. 99% > of programmers do the indentation anyway, to make the program easy to read, > so why not just make it part of the syntax? That way, you don't > accidentally have the indentation not match the syntax. Because it is a pain in the ass. Now suddenly my program doesn't work because I somehow inserted a tab instead of spaces. The end would also gives extra protection against faulty manipulations. I have at one time accidently copied a function partly further below. Because python doesn't need an end, the compilor was unable to detect this was only part of a function which caused a bug which was harder to find. Python made it's choice and I can live with that, but telling people who prefer it had made an other choice that their brain is poisoned, only shows you are unable to see the disadvantages. -- Antoon Pardon
[toc] | [prev] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2013-10-30 15:50 +0000 |
| Message-ID | <l4r9sj$g4o$1@reader1.panix.com> |
| In reply to | #58028 |
On 2013-10-30, Antoon Pardon <antoon.pardon@rece.vub.ac.be> wrote:
> Op 30-10-13 08:07, Tim Roberts schreef:
>> jonas.thornvall@gmail.com wrote:
>>>
>>> Why did Python not implement end... The end is really not necessary for
>>> the programming language it can be excluded, but it is a courtesy to
>>> the programmer and could easily be transformed to indents automaticly,
>>> that is removed before the compiliation/interpretation of code.
>>
>> You only say that because your brain has been poisoned by languages that
>> require some kind of "end". It's not necessary, and it's extra typing. 99%
>> of programmers do the indentation anyway, to make the program easy to read,
>> so why not just make it part of the syntax? That way, you don't
>> accidentally have the indentation not match the syntax.
>
> Because it is a pain in the ass. Now suddenly my program doesn't work
> because I somehow inserted a tab instead of spaces.
Then don't do that.
I'm only half-kidding. Inserting incorrect tokens into program source
breaks programs in all languages. The tricky bit is that in many
editors spaces and tabs look the same. You can pick an editor that
provides a visual difference, or you can pick an editor that always
does the right thing, or you can stick with it until your fingers
learn to do the right thing.
> The end would also gives extra protection against faulty
> manipulations. I have at one time accidently copied a function partly
> further below. Because python doesn't need an end, the compilor was
> unable to detect this was only part of a function which caused a bug
> which was harder to find.
>
> Python made it's choice and I can live with that, but telling people
> who prefer it had made an other choice that their brain is poisoned,
> only shows you are unable to see the disadvantages.
Those of us who've been using Python for more than a few days think it
is you who are unable to see the advantages. ;)
Whether allowing indentation via either tabs or spaces was a
fundamental design flaw has long been debated. Personally, I think
tabs should be outlawed in all source code...
--
Grant Edwards grant.b.edwards Yow! Uh-oh!! I'm having
at TOO MUCH FUN!!
gmail.com
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2013-10-30 08:54 -0700 |
| Message-ID | <875a974d-9810-4059-a692-a70a566726a5@googlegroups.com> |
| In reply to | #58050 |
Den onsdagen den 30:e oktober 2013 kl. 16:50:43 UTC+1 skrev Grant Edwards: > On 2013-10-30, Antoon Pardon <antoon.pardon@rece.vub.ac.be> wrote: > > > Op 30-10-13 08:07, Tim Roberts schreef: > > >> jonas.thornvall@gmail.com wrote: > > >>> > > >>> Why did Python not implement end... The end is really not necessary for > > >>> the programming language it can be excluded, but it is a courtesy to > > >>> the programmer and could easily be transformed to indents automaticly, > > >>> that is removed before the compiliation/interpretation of code. > > >> > > >> You only say that because your brain has been poisoned by languages that > > >> require some kind of "end". It's not necessary, and it's extra typing. 99% > > >> of programmers do the indentation anyway, to make the program easy to read, > > >> so why not just make it part of the syntax? That way, you don't > > >> accidentally have the indentation not match the syntax. > > > > > > Because it is a pain in the ass. Now suddenly my program doesn't work > > > because I somehow inserted a tab instead of spaces. > > > > Then don't do that. > > > > I'm only half-kidding. Inserting incorrect tokens into program source > > breaks programs in all languages. The tricky bit is that in many > > editors spaces and tabs look the same. You can pick an editor that > > provides a visual difference, or you can pick an editor that always > > does the right thing, or you can stick with it until your fingers > > learn to do the right thing. > > > > > The end would also gives extra protection against faulty > > > manipulations. I have at one time accidently copied a function partly > > > further below. Because python doesn't need an end, the compilor was > > > unable to detect this was only part of a function which caused a bug > > > which was harder to find. > > > > > > Python made it's choice and I can live with that, but telling people > > > who prefer it had made an other choice that their brain is poisoned, > > > only shows you are unable to see the disadvantages. > > > > Those of us who've been using Python for more than a few days think it > > is you who are unable to see the advantages. ;) > > > > Whether allowing indentation via either tabs or spaces was a > > fundamental design flaw has long been debated. Personally, I think > > tabs should be outlawed in all source code... > > > > -- > > Grant Edwards grant.b.edwards Yow! Uh-oh!! I'm having > > at TOO MUCH FUN!! > > gmail.com I think the idea with tab indentation would been it is an easy road for automation. I think it is easily that project goes anal when let over to code monkeys, maybe that is the case.
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2013-10-30 19:59 +0100 |
| Message-ID | <mailman.1826.1383159589.18130.python-list@python.org> |
| In reply to | #58050 |
Op 30-10-13 16:50, Grant Edwards schreef:
> On 2013-10-30, Antoon Pardon <antoon.pardon@rece.vub.ac.be> wrote:
>>
>> Because it is a pain in the ass. Now suddenly my program doesn't work
>> because I somehow inserted a tab instead of spaces.
>
> Then don't do that.
>
> I'm only half-kidding. Inserting incorrect tokens into program source
> breaks programs in all languages. The tricky bit is that in many
> editors spaces and tabs look the same. You can pick an editor that
> provides a visual difference, or you can pick an editor that always
> does the right thing, or you can stick with it until your fingers
> learn to do the right thing.
But tab and spaces are not tokens. They are token seperators. You can
add as many tabs and spaces at the end of a line or between an
identifier and an operator and it won't make any difference.I can even
write the following.
a = (
b + c )
where I can freely choose to use any number of tabs and spaces at the
start of the second line and python will not complain. So comparing
mixing tabs and spaces with inserting an incorrect token in other
languages doesn't make much sense to me.
>>
>> Python made it's choice and I can live with that, but telling people
>> who prefer it had made an other choice that their brain is poisoned,
>> only shows you are unable to see the disadvantages.
>
> Those of us who've been using Python for more than a few days think it
> is you who are unable to see the advantages. ;)
I started using python when it was still 1.5.2, so I think I am using
it for more than a few days too.
--
Antoon Pardon
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-10-30 23:17 +1100 |
| Message-ID | <mailman.1803.1383135479.18130.python-list@python.org> |
| In reply to | #58009 |
On Wed, Oct 30, 2013 at 11:01 PM, Antoon Pardon <antoon.pardon@rece.vub.ac.be> wrote: > Because it is a pain in the ass. Now suddenly my program doesn't work > because I somehow inserted a tab instead of spaces. 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. Also, the parser should tell you if you mix tabs and spaces, so that won't trip anything either. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2013-10-30 13:42 +0100 |
| Message-ID | <mailman.1804.1383136979.18130.python-list@python.org> |
| In reply to | #58009 |
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: >> Because it is a pain in the ass. Now suddenly my program doesn't work >> because I somehow inserted a tab instead of spaces. > > 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. 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. Also when you have an xterm, selecting a tab and pasting it into another it will turn the tab into spaces. 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 immediatly, 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 differen 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. -- Antoon Pardon
[toc] | [prev] | [next] | [standalone]
| From | Alister <alister.ware@ntlworld.com> |
|---|---|
| Date | 2013-10-30 14:22 +0000 |
| Message-ID | <_C8cu.52337$gs7.11961@fx16.am4> |
| In reply to | #58031 |
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.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2013-10-30 07:31 -0700 |
| Message-ID | <d4b5996a-09e9-4f84-a54c-0480a8256305@googlegroups.com> |
| In reply to | #58040 |
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...
[toc] | [prev] | [next] | [standalone]
Page 2 of 5 — ← Prev page 1 [2] 3 4 5 Next page →
Back to top | Article view | comp.lang.python
csiph-web