[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
# return
I had an idea on some new functionality I'd like to see offered
in the python object class. I did some searching on the list
but I wouldn't doubt that someone has proposed something
like this before as chaining method calls seems like something
folks would want to do.
Specifically, I'd like to
Michael O'Keefe mokeefe at 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
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
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:
[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
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)
My
[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 deliberate
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