[Michael O'Keefe]
> def desired():
>pass
># IF we had a --> operator which would execute the method at
># left but return a ref to object
>#return [8,9,7,1].sort()-->reverse()-->pop(0)--> # returns [8,7,1]
># return [8,9,7,1].sort()-->reverse()-->pop(0) # returns 9
># r
Michael O'Keefe wrote:
> I'm sure there are other ways to do this as well but what do people
> think? Has something like this come up before?
Yes, this has come up before, and list.sort and list.reverse were
identified as the methods people were most likely to want to chain. The
sorted() and rev
Greg Ewing wrote:
> Michael O'Keefe wrote:
>
>> I'd like to see a built-in shorthand to allow me to
>> chain method calls even when a method call does not explicity
>> return a reference to the instance of the object (self).
>>
>
>
>> def newFunc02():
>> return NewList([8,9,7,1]).s
[EMAIL PROTECTED] wrote:
> I think there's room
> for debate on whether specific list methods that currently return None should
> instead return the list, although I would definitely consult the archives
> before entering that fray.
Indeed. It's been discussed many times before.
It was a delibera
Michael O'Keefe wrote:
> I'd like to see a built-in shorthand to allow me to
> chain method calls even when a method call does not explicity
> return a reference to the instance of the object (self).
> def newFunc02():
> return NewList([8,9,7,1]).self_('sort').self_('reverse').self_('pop',0)
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| On Sat, Feb 03, 2007 at 07:01:47PM +, Michael O\'Keefe wrote:
| I haven't been on the list long enough to know, but I would expect that
this
| idea and its relatives have been batted around at least once before.
Of course.
| I t
Cool! A way to write big one-liners and break the law of Demeter.
Also, this should be a Python-ideas, not a Python-dev Post.
--
EduardoOPadoan (eopadoan->altavix::com)
Bookmarks: http://del.icio.us/edcrypt
Blog: http://edcrypt.blogspot.com
Jabber: edcrypt at jabber dot org
ICQ: 161480283
GTalk:
On Sat, Feb 03, 2007 at 07:01:47PM +, Michael O\'Keefe wrote:
> Anyhow, just curious for ideas and sparking discussion.
...
I haven't been on the list long enough to know, but I would expect that this
idea and its relatives have been batted around at least once before. I think a
lot of people
Michael O'Keefe okeefecreations.com> writes:
I kept playing with this since my last post went live and here is a
little more thought on these ideas. After sitting with the "Zen of
Python" document (>>> import this), I'm maybe waffling on my
previous post already so I came up with a few more opti