From: Austin Ziegler Date: 2004-12-02T00:34:15+09:00 Subject: Re: [OFF] Python 2.4 released On Wed, 1 Dec 2004 19:14:25 +0900, Michael Neumann wrote: > If the Ruby parser could determine, whether a "def" statement is used inside > another expression (e.g. "public def"), then it would be great if it would > return a Method object. If it's in no expression (plain class/module scope), > it should return nil. Not sure, if this is possible at all. A Method object > is much better than a Symbol! Why? I ask this in all seriousness, because just about the only thing (currently) that you can get from a Method and not from a Symbol is #arity. While I certainly wish I could get other information, there's little value in returning a heavyweight object. Beyond that, I don't think that it's useful to have a dynamic return (similar to Perl's "wantsarray" -- ick!). Most operations where this is desired are things that work better with the name of the method than the Method or UnboundMethod itself. As far as I can tell, there's no method to get the name of the Method or UnboundMethod, so you're stuck with parsing #inspect. I do think that we have to figure out what "def self.foo; ... ; end" should return if we do this and have commented such on RCR 277. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca