Re: [Python-Dev] Shortcut Notation for Chaining Method Calls

2007-02-03 Thread Nick Coghlan
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

Re: [Python-Dev] Shortcut Notation for Chaining Method Calls

2007-02-03 Thread Michael Foord
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

Re: [Python-Dev] Shortcut Notation for Chaining Method Calls

2007-02-03 Thread Greg Ewing
[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

Re: [Python-Dev] Shortcut Notation for Chaining Method Calls

2007-02-03 Thread Greg Ewing
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)

Re: [Python-Dev] Shortcut Notation for Chaining Method Calls

2007-02-03 Thread Terry Reedy
<[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

[Python-Dev] __dir__ and __all__

2007-02-03 Thread Giovanni Bajo
Hello, I could not find a PEP for __dir__. I was thinking today that if __dir__ was added, I would find it useful if modules implemented it by returning __all__ (when __all__ is defined). Or even better, to return the same names that would be imported by a star-import (so, if __all__ is not def

Re: [Python-Dev] Shortcut Notation for Chaining Method Calls

2007-02-03 Thread Eduardo \"EdCrypt\" O. Padoan
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:

Re: [Python-Dev] Shortcut Notation for Chaining Method Calls

2007-02-03 Thread dustin
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

Re: [Python-Dev] Shortcut Notation for Chaining Method Calls

2007-02-03 Thread Michael O\'Keefe
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

[Python-Dev] Shortcut Notation for Chaining Method Calls

2007-02-03 Thread Michael O'Keefe
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