Re: Consistency in Python

2006-08-26 Thread Hendrik van Rooyen
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote, oder schrieb, of het geskryf: | Hendrik van Rooyen schrieb: | > Hi, | > | > for S where S is a Standard Python type: | > The slice notation S[n] returns either: | > The n'th element of S, or | > The value of the dictionary entry who

Re: Consistency in Python

2006-08-26 Thread Hendrik van Rooyen
"Paul Boddie" <[EMAIL PROTECTED]> Wrote: | Hendrik van Rooyen wrote: | > | > There seems to be no common methods such as- | > "prepend" - for adding something to the beginning | > "append" - for adding something to the end | > "insert[j]" - for adding something somewhere in the middle

Re: Consistency in Python

2006-08-25 Thread Fredrik Lundh
Brendon Towle wrote: >> b) http://pyfaq.infogami.com/why-doesn-t-list-sort-return-the-sorted-list >>(this also explains how to handle your specific use case) > > Well, I posted working code, so I thought it should have been obvious > that I knew how to handle my use case, and was (am) lookin

Re: Consistency in Python

2006-08-25 Thread Fredrik Lundh
Brendon Towle wrote: > My third response is that it's *always* possible to shoot yourself in > the foot. Protecting a naive user from one particular metatarsal > projectile insertion at the expense of letting the power-user write more > concise code seems a bad tradeoff to me -- but, I'm not in

Re: Consistency in Python

2006-08-25 Thread Terry Reedy
  "Brendon Towle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... Message: 3 Date: Fri, 25 Aug 2006 15:28:46 +0200 From: "Fredrik Lundh" <[EMAIL PROTECTED]> Subject: Re: Consistency in Python Brendon Towle wr

Re: Consistency in Python

2006-08-25 Thread Brendon Towle
Message: 3 Date: Fri, 25 Aug 2006 15:28:46 +0200 From: "Fredrik Lundh" <[EMAIL PROTECTED]> Subject: Re: Consistency in Python Brendon Towle wrote: So, my question is: Someone obviously thought that it was wise and proper to require the longer versions that I write above. Why? a

Re: Consistency in Python

2006-08-25 Thread Fredrik Lundh
Brendon Towle wrote: > So, my question is: Someone obviously thought that it was wise and > proper to require the longer versions that I write above. Why? a) maybe they had a working carriage return key ? b) http://pyfaq.infogami.com/why-doesn-t-list-sort-return-the-sorted-list (this also exp

Re: Consistency in Python

2006-08-25 Thread Brendon Towle
Date: 25 Aug 2006 04:22:37 -0700From: "Paul Boddie" <[EMAIL PROTECTED]>Subject: Re: Consistency in PythonTo: [email protected]: <[EMAIL PROTECTED]>Content-Type: text/plain; charset="iso-8859-1"Paul McGuire wrote: But with mutators that return self, a client could write any of these:b

Re: Consistency in Python

2006-08-25 Thread Paul Boddie
Paul McGuire wrote: > > There's nothing wrong with returning self from a mutator. This was a common > idiom in Smalltalk (the syntax for this was "^self", which was probably the > most common statement in any Smalltalk program), and permitted the chaining > of property mutators into a single line,

Re: Consistency in Python

2006-08-25 Thread Paul McGuire
"Paul Boddie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Moreover, append and insert return > no result because the change occurs within an existing object - if you > were to return a reference to the changed object, it would be the same > reference as the one you already had.

Re: Consistency in Python

2006-08-25 Thread Paul Boddie
Hendrik van Rooyen wrote: > > There seems to be no common methods such as- > "prepend" - for adding something to the beginning > "append" - for adding something to the end > "insert[j]" - for adding something somewhere in the middle > > Or have I missed something ? [...] > BTW - I und

Re: Consistency in Python

2006-08-25 Thread Diez B. Roggisch
Hendrik van Rooyen schrieb: > Hi, > > for S where S is a Standard Python type: > The slice notation S[n] returns either: > The n'th element of S, or > The value of the dictionary entry whose key is n. > > This is beautiful because as a programmer you don't have to worry what S