J. Cliff Dyer wrote: > On Tue, 2009-02-03 at 08:33 -0700, Joe Strout wrote: >> J. Cliff Dyer wrote: >> >>> But what if your language allows functions to be used as first class >>> objects? (Mine does :)) >>> >>> x = Beep >>> >>> Does that assign the name x to the Beep object or does it assign the >>> result of a Beep call to x? >> It assigns the result. To assign the name to the Beep object requires a >> bit of additional syntax; in RB, this would be >> >> x = AddressOf Beep >> >>> There's no virtue in making ridiculously simple things even simpler if >>> it makes the interesting things impossible. >> Of course. The goal is (or should be) to make the common things >> ridiculously simple, and make the uncommon things only somewhat less so. >> Even in Python, it is far more common to invoke a function than to >> need a reference to it. So invoking a function should be the thing that >> requires no extra syntax (even including "()"). Getting a reference to >> it, which is less common, should be the thing that requires more syntax. >> > > Except that now you have introduced an inconsistency into python. What > does the following mean? > > my_object = MyObject() > x = my_object > > What if MyObject defines a method named __call__? > > Now some objects are passed around using > > x = my_object > > while others require > > x = AddressOf my_object > > and the only way to tell which is which is to check the object for the > presence of a __call__ method. > > This seems like a serious inconsistency to me. > Time for my annual comment on the apparent requirement for DWIM-mode Python.
regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list