On Jun 11, 2010, at 6:57 PM, Brett Cannon wrote: > On Fri, Jun 11, 2010 at 18:30, Guido van Rossum <gu...@python.org> wrote: >> On Fri, Jun 11, 2010 at 5:41 PM, Benjamin Peterson <benja...@python.org> >> wrote: >>> 2010/6/11 Brett Cannon <br...@python.org>: >>>> This "magical" ignoring of self seems to extend to any PyCFunction. Is >>>> this dichotomy intentional or just a "fluke"? Maybe this is a >>>> hold-over from before we had descriptors and staticmethod, but now >>>> that we have these things perhaps this difference should go away. >>> >>> There are several open feature requests about this. It is merely >>> because PyCFunction does not implement __get__. >> >> Yeah, but this of course is because before descriptors only Python >> functions were special-cased as methods, and there was known code that >> depended on this. I'm sure there's even more code that depends on this >> today (because there is just more code, period :-). >> >> Maybe we could offer a decorator that adds a __get__ to a PyCFunction though. > > Well, staticmethod seems to work just as well. > > I'm going to make this my first request for what to change in Py4K. =)
+1 on changing this, it's annoying for alternate implementations. They oftentimes implement functions in pure Python whereas user code might be expecting the PYCFunction behavior. Jython's had a couple cases of this incompatibility reported. It's a rare occurrence but it's very mysterious to the user when it happens. -- Philip Jenvey _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com