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
"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
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
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
"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
"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
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
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
"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
> 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
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
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
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
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
"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
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,
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
"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
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
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
"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
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).
>
"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.
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
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?
>>
>>
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
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
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
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
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
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'
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
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
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
>> 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
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
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
"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
>
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
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
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
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
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
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
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
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;-)
"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
"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
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
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
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
> 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
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
> 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
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
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
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
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
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
"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,
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://
>> 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
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
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
64 matches
Mail list logo