Re: Grouping code by indentation - feature or ******?

2005-04-08 Thread Tim Tyler
I, Tim Tyler <[EMAIL PROTECTED]> wrote or quoted: > What do you guys think about Python's grouping of code via > indentation? Some relevant resources: http://c2.com/cgi/wiki?PythonWhiteSpaceDiscussion http://c2.com/cgi/wiki?IndentationEqualsGrouping http://c2.com/cgi/wiki?SyntacticallySignifica

Re: Grouping code by indentation - feature or ******?

2005-04-01 Thread Javier Bezos
"Steve Holden" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] [Discussion on Python slices and the off-by-one issue deleted] > While this may be an interesting philosophical (or should that be > philological) discussion, since Python has worked this way for donkey's > year

Re: Grouping code by indentation - feature or ******?

2005-04-01 Thread Steve Holden
Javier Bezos wrote: "Myles Strous" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] satisfy some handy properties, the first of which being: l[:n] + l[n:] = l I don't think l[:5] + l[5:] = l is a handy property and to me is clearly counterintuitive. Further, It can be quite useful

Re: Grouping code by indentation - feature or ******?

2005-03-31 Thread Greg Ewing
Javier Bezos wrote: 2) You have an ending point (e) and a length: lst[e-t+1:e+1]. If you use the "slice indices represent points between the elements" mental model, then you don't have an ending point here, you have one less than the ending point -- hence it's not surprising that you need to add

Re: Grouping code by indentation - feature or ******?

2005-03-30 Thread Javier Bezos
"Myles Strous" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] >>> satisfy some handy properties, the first of which being: >>> l[:n] + l[n:] = l >> >> I don't think l[:5] + l[5:] = l is a handy property >> and to me is clearly counterintuitive. Further, > > It can be quite usef

Re: Grouping code by indentation - feature or ******?

2005-03-29 Thread Tim Roberts
"Terry Reedy" <[EMAIL PROTECTED]> wrote: > >"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> 1) The stuff doesn't has to be spread over multiple pages. One >> can have 2 functions, each about three quarter of a page. >> The second function will then cross a page

Re: Grouping code by indentation - feature or ******?

2005-03-29 Thread Myles Strous
I wrote: > It can be quite useful for inserting something into a list (or string), > after finding the position where you wish to insert it. Oops, I missed Dennis Lee Bieber's working example of exactly that. My apologies. Regars, Myles. -- http://mail.python.org/mailman/listinfo/python-list

Re: Grouping code by indentation - feature or ******?

2005-03-29 Thread Myles Strous
Javier Bezos wrote: > "Jacob Lee" <[EMAIL PROTECTED]> escribió en el mensaje > > satisfy some handy properties, the first of which being: > > l[:n] + l[n:] = l > > I don't think l[:5] + l[5:] = l is a handy property > and to me is clearly counterintuitive. Further, It can be quite useful for ins

Re: Grouping code by indentation - feature or ******?

2005-03-29 Thread Terry Reedy
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 1) The stuff doesn't has to be spread over multiple pages. One > can have 2 functions, each about three quarter of a page. > The second function will then cross a page boundary. Once upon a time, one could put a li

Re: Grouping code by indentation - feature or ******?

2005-03-29 Thread Diez B. Roggisch
> What I or you prefer carries very little weight. I know layout-things > stir up a lot of bad feeling, but I honostly think those people should > grow up. When I cooperate in a project, I adapt my style to the one > used in the project. I may use a tool to change between styles for > things I work

Re: Grouping code by indentation - feature or ******?

2005-03-29 Thread Roy Smith
Antoon Pardon <[EMAIL PROTECTED]> wrote: > 1) The stuff doesn't has to be spread over multiple pages. One >can have 2 functions, each about three quarter of a page. >The second function will then cross a page boundary. The advice "don't write a function longer than a page" is as good advic

Re: Grouping code by indentation - feature or ******?

2005-03-29 Thread Antoon Pardon
Op 2005-03-25, Terry Reedy schreef <[EMAIL PROTECTED]>: > > "Antoon Pardon" <[EMAIL PROTECTED]> wrote in message > >> 1) It makes it hard to see how many levels are dedented at the end of >> a suite, and sometime makes it difficult to see where the end >> of a suite is. If e.g. you are looking

Re: Grouping code by indentation - feature or ******?

2005-03-28 Thread Antoon Pardon
Op 2005-03-25, Dennis Lee Bieber schreef <[EMAIL PROTECTED]>: > On 25 Mar 2005 14:26:28 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> >> 1) It makes it hard to see how many levels are dedented at the end of >>a suite, and sometime makes it difficult

Re: Grouping code by indentation - feature or ******?

2005-03-28 Thread Antoon Pardon
Op 2005-03-25, Diez B. Roggisch schreef <[EMAIL PROTECTED]>: >> Normally one is the project leader. He decides. > > Whishful thinking. > > Another problem I have with code that is _not_ layouted the way I'm used to > it is that the perception of what very code does gets more difficult to me. > You

Re: Grouping code by indentation - feature or ******?

2005-03-28 Thread Javier Bezos
"Dennis Lee Bieber" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > > I don't think l[:5] + l[5:] = l is a handy property > > and to me is clearly counterintuitive. Further, [snipped in the reply] Please, don't remove parts of my post which are relevant to the discussion. I s

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Scott David Daniels
Reinhold Birkenfeld wrote: Jacob Lee wrote: About slices: I agree that Python's slice boundaries (some_list[a:b] being all elements with a <= index < b) are counterintuitive at first. But this method does satisfy some handy properties, the first of which being: l[:n] + l[n:] = l And best of all,

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Patrik Andreasen
Giovanni Bajo wrote: Terry Reedy wrote: 3) Sometimes the structure of the algorithm is not the structure of the code as written, people who prefer that the indentation reflects the structure of the algorithm instead of the structure of the code, are forced to indent wrongly. Do you have any sim

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Javier Bezos
"Reinhold Birkenfeld" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] >>s t r i n g >> ^ ^ ^ ^ ^ ^ ^ >> 0 1 2 3 4 5 6 >> >> so that [1:2] is "t". > > Incidentally, the Python Tutorial tells us exactly the same... Ah! I've just forgotten t

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Reinhold Birkenfeld
Javier Bezos wrote: > MetaFont explains this by saying that the index > doesn't refer to a character but to a position > between characters, which when traslated to Python > would mean: > >s t r i n g > ^ ^ ^ ^ ^ ^ ^ > 0 1 2 3 4 5 6 > > so that [1:2] is "t

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Reinhold Birkenfeld
Jacob Lee wrote: > About slices: > > I agree that Python's slice boundaries (some_list[a:b] being all elements > with a <= index < b) are counterintuitive at first. But this method does > satisfy some handy properties, the first of which being: > l[:n] + l[n:] = l And best of all, this is true

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Terry Reedy
"Giovanni Bajo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry Reedy wrote: > >>> 3) Sometimes the structure of the algorithm is not the structure >>> of the code as written, people who prefer that the indentation >>> reflects the structure of the algorithm instead of the

Re: Python slogan, was Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Reinhold Birkenfeld
Kent Johnson wrote: >> Wikiquote is nice. I missed it because I googled for Mark Twain and parts of >> the Churchill quote -- for that I'm now convinced it is as wikiquote gives >> a slightly longer excerpt and the date and location of the speech (November >> 11, 1947, in the House of Commons). >

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Javier Bezos
"Jacob Lee" <[EMAIL PROTECTED]> escribió en el mensaje >> things which compesate that (another annoying point >> of Python are slices -- mine are always off by 1). >About slices: Thank you, but I knew the motivations for this odd behaviour, which can be found as well in, for example, MetaFont.

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Giovanni Bajo
Terry Reedy wrote: >> 3) Sometimes the structure of the algorithm is not the structure >> of the code as written, people who prefer that the indentation >> reflects the structure of the algorithm instead of the structure >> of the code, are forced to indent wrongly. > > Do you have any simpl

Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Jacob Lee
On Sat, 26 Mar 2005 10:02:13 +0100, Javier Bezos wrote: > > "Tim Tyler" <[EMAIL PROTECTED]> escribió en el mensaje > news:[EMAIL PROTECTED] >> What do you guys think about Python's grouping of code via indentation? >> >> Is it good - perhaps because it saves space and eliminates keypresses? >> >>

Re: Python slogan, was Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Peter Otten
Kent Johnson wrote: > Interesting that in the quote on wikiquote, Churchill indicates that the > sentiment is not original with him: > "Indeed, it has been said that democracy is the worst form of government > except all those other forms that have been tried from time to time." > > Note the "it

Re: Python slogan, was Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Kent Johnson
Peter Otten wrote: Skip Montanaro wrote: >> Or, paraphrasing Mark Twain, "Python is the worst possible >> programming language, except for all the others." Google thinks it's Winston Churchill as well. I did come across a quote wiki: http://www.wikiquote.org/ Wikiquote is nice. I misse

Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread James Stroud
On Saturday 26 March 2005 02:52 pm, Mike Meyer wrote: > Because newlines are optional statement terminators. Yes; I have accidentally found that ; can be used also as an optional statement terminator--when rewriting some perl code. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Mike Meyer
James Stroud <[EMAIL PROTECTED]> writes: > On Friday 25 March 2005 08:39 am, Ivan Van Laningham wrote: > Why do we need : at the end of our if and for loops? I spend approximately 6 > minutes/100 lines of code going back and finding all of the times I missed :. > Is it for cheating? Because new

Re: Python slogan, was Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Peter Otten
Skip Montanaro wrote: > >> Or, paraphrasing Mark Twain, "Python is the worst possible > >> programming language, except for all the others." > Google thinks it's Winston Churchill as well. I did come across a quote > wiki: > > http://www.wikiquote.org/ > > None of the quotes attrib

Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Ron_Adam
On Fri, 25 Mar 2005 11:31:33 -0800, James Stroud <[EMAIL PROTECTED]> wrote: >On Friday 25 March 2005 08:39 am, Ivan Van Laningham wrote: >> As far as grouping by indentation goes, it's why I fell in love with >> Python in the first place.  Braces and so on are just extraneous cruft >> as far as I'

Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Jeremy Bowers
On Sat, 26 Mar 2005 15:42:03 +, Tim Tyler wrote: > I very much favour the smalltalk-inspired idea of keeping the actual > language as small as is reasonably possible. > > I wonder if there are any promising new kids on the dynamic > scripting-language block that I haven't heard about yet - i.e

Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Tim Tyler
Javier Bezos <[EMAIL PROTECTED]> wrote or quoted: > "Tim Tyler" <[EMAIL PROTECTED]> escribi? en el mensaje > > What do you guys think about Python's grouping of code via indentation? > > > > Is it good - perhaps because it saves space and eliminates keypresses? [...] > I particularly hate it, bu

Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Tim Tyler
Peter Otten <[EMAIL PROTECTED]> wrote or quoted: > I, Tim Tyler wrote: > > What do you guys think about Python's grouping of code via indentation? > > This is a Python newsgroup. Assume that we all have been brainwashed. ;-) I had a good look for comp.lang.python.advocacy before posting my ques

Re: Python slogan, was Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Skip Montanaro
>> Or, paraphrasing Mark Twain, "Python is the worst possible >> programming language, except for all the others." Peter> I've been trying to establish that a while ago, but would Peter> attribute it to Winston Churchill -- so I'm a little confused Peter> now. Google thinks i

Re: Python slogan, was Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Kent Johnson
Peter Otten wrote: Tim Roberts wrote: Or, paraphrasing Mark Twain, "Python is the worst possible programming language, except for all the others." I've been trying to establish that a while ago, but would attribute it to Winston Churchill -- so I'm a little confused now. Can you provide the text w

Python slogan, was Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Peter Otten
Tim Roberts wrote: > Rocco Moretti <[EMAIL PROTECTED]> wrote: > >>Antoon Pardon wrote: >>> I have problems with all languages >>> currently available, so I use those which rub me wrong the least. >>> ... [I]t doesn't weight heavy enough >>> to go and use an other language, although I keeping look

Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Javier Bezos
"Tim Tyler" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > What do you guys think about Python's grouping of code via indentation? > > Is it good - perhaps because it saves space and eliminates keypresses? > > Or is it bad - perhaps because it makes program flow dependent on >

Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Tim Roberts
Rocco Moretti <[EMAIL PROTECTED]> wrote: >Antoon Pardon wrote: >> I have problems with all languages >> currently available, so I use those which rub me wrong the least. >> ... [I]t doesn't weight heavy enough >> to go and use an other language, although I keeping looking at >> the other language

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Paul McGuire
My favorite part is not getting into religious coder wars over where the (@#$&(&!!$ braces go! Let the indentation (which you do anyway, even when you have braces) do the grouping. -- Paul BTW - anyone who tries to justify code design based on "eliminating keypresses," or, my God!, "saving space

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Jeremy Bowers
On Fri, 25 Mar 2005 11:31:33 -0800, James Stroud wrote: > Now, what happened to the whitespace idea here? This code seems very > unpythonic. I think : is great for slices and lamda where things go on one > line, but to require it to specify the start of a block of code seems a > little perlish. It

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread casevh
James Stroud wrote: > On Friday 25 March 2005 08:39 am, Ivan Van Laningham wrote: > > As far as grouping by indentation goes, it's why I fell in love with > > Python in the first place. Braces and so on are just extraneous cruft > > as far as I'm concerned. It's the difference between Vietnamese

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Larry Bates
Can tell you that even when I was learning Python, I very rarely forgot the colon (except when I've switched to writing JavaScript or some other language that doesn't use it and switch back to Python. It seemed to make sense. As for the one-liner you mentioned, you may call it cheating, but it is

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Bill Mill
On Fri, 25 Mar 2005 11:38:37 -0800, Robert Kern <[EMAIL PROTECTED]> wrote: > James Stroud wrote: > > On Friday 25 March 2005 08:39 am, Ivan Van Laningham wrote: > > > >>As far as grouping by indentation goes, it's why I fell in love with > >>Python in the first place. Braces and so on are just ext

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Robert Kern
James Stroud wrote: On Friday 25 March 2005 08:39 am, Ivan Van Laningham wrote: As far as grouping by indentation goes, it's why I fell in love with Python in the first place. Braces and so on are just extraneous cruft as far as I'm concerned. It's the difference between Vietnamese verbs and Lati

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread James Stroud
On Friday 25 March 2005 08:39 am, Ivan Van Laningham wrote: > As far as grouping by indentation goes, it's why I fell in love with > Python in the first place.  Braces and so on are just extraneous cruft > as far as I'm concerned.  It's the difference between Vietnamese verbs > and Latin verbs;-)

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Terry Reedy
"Tim Tyler" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What do you guys think about Python's grouping of code via indentation? A major plus. I was fanatic about carefully indenting my C code. > Is it good - perhaps because it saves space and eliminates keypresses? It elimin

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Terry Reedy
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message > 1) It makes it hard to see how many levels are dedented at the end of > a suite, and sometime makes it difficult to see where the end > of a suite is. If e.g. you are looking at the code spread over > two pieces of paper, it is sometime

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Rocco Moretti
Antoon Pardon wrote: I have problems with all languages currently available, so I use those which rub me wrong the least. ... [I]t doesn't weight heavy enough to go and use an other language, although I keeping looking at the other languages. I think the operational definition of a "zealot" is som

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Ivan Van Laningham
Hi All-- Larry Bates wrote: > > Secondly, Python "nudges" me into writing better > (easier to maintain and clearer to understand) code by > influencing me towards splitting my code into smaller > functions/classes. If I find myself with more than 3-4 > levels of indentation, I probably need to

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Larry Bates
Python's way of grouping is VERY good. Over the last 30+ years I've seen a lot of code (good and bad) in many languages. IMHO good code (independent of language) always uses indentation, even when other block constructs (like braces) is available. Python developers thought that this was redundant

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Diez B. Roggisch
> Normally one is the project leader. He decides. Whishful thinking. Another problem I have with code that is _not_ layouted the way I'm used to it is that the perception of what very code does gets more difficult to me. You seem to have the same troubles, I take that from your desire to reflect

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Antoon Pardon
Op 2005-03-25, Diez B. Roggisch schreef <[EMAIL PROTECTED]>: >> Structure/Disciplined programming is a burden in general. I have >> never found putting braces or what ever delimiter such a problem. >> I don't see people argueing that putting the right number of parenthesis >> and or brackets is an

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Diez B. Roggisch
> Structure/Disciplined programming is a burden in general. I have > never found putting braces or what ever delimiter such a problem. > I don't see people argueing that putting the right number of parenthesis > and or brackets is an extra burden. Oh, not the right number. But I have seen wars wag

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Carl Banks
Tim Tyler wrote: > What do you guys think about Python's grouping of code via indentation? > > Is it good - perhaps because it saves space and eliminates keypresses? It's good, but this is only a minor reason. The reason this is good is because it exactly reflects the way human beings mentally g

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Antoon Pardon
Op 2005-03-25, Carl Banks schreef <[EMAIL PROTECTED]>: > > Tim Tyler wrote: >> What do you guys think about Python's grouping of code via > indentation? >> >> Is it good - perhaps because it saves space and eliminates > keypresses? > > It's good, but this is only a minor reason. > > The reason this

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread projecktzero
Tim Tyler wrote: > What do you guys think about Python's grouping of code via indentation? > > Is it good - perhaps because it saves space and eliminates keypresses? > > Or is it bad - perhaps because it makes program flow dependent on > invisible, and unpronouncable characters - and results in mor

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Antoon Pardon
Op 2005-03-25, John Roth schreef <[EMAIL PROTECTED]>: > > "Antoon Pardon" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Op 2005-03-25, Tim Tyler schreef <[EMAIL PROTECTED]>: >>> What do you guys think about Python's grouping of code via indentation? >>> >>> Is it good - perhaps

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Kent Johnson
Tim Tyler wrote: What do you guys think about Python's grouping of code via indentation? Is it good - perhaps because it saves space and eliminates keypresses? Or is it bad - perhaps because it makes program flow dependent on invisible, and unpronouncable characters - and results in more manual al

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread John Roth
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Op 2005-03-25, Tim Tyler schreef <[EMAIL PROTECTED]>: What do you guys think about Python's grouping of code via indentation? Is it good - perhaps because it saves space and eliminates keypresses? I think it was a mistake,

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Antoon Pardon
Op 2005-03-25, Tim Tyler schreef <[EMAIL PROTECTED]>: > What do you guys think about Python's grouping of code via indentation? > > Is it good - perhaps because it saves space and eliminates keypresses? I think it was a mistake, but I'm probably in the minority here. -- Antoon Pardon -- http://

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Skip Montanaro
>> What do you guys think about Python's grouping of code via >> indentation? Peter> This is a Python newsgroup. Assume that we all have been Peter> brainwashed. +1 QOTW. Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Peter Otten
Tim Tyler wrote: > What do you guys think about Python's grouping of code via indentation? This is a Python newsgroup. Assume that we all have been brainwashed. > How would you have dealt with the issue of how to group statements? Off the top of my head I can think of one other way: associate a

Grouping code by indentation - feature or ******?

2005-03-25 Thread Tim Tyler
What do you guys think about Python's grouping of code via indentation? Is it good - perhaps because it saves space and eliminates keypresses? Or is it bad - perhaps because it makes program flow dependent on invisible, and unpronouncable characters - and results in more manual alignment issues