On Wed, 29 May 2013 08:08:14 +0200 Antoine Pitrou <solip...@pitrou.net> wrote: > On Wed, 29 May 2013 12:40:32 +1000 > Nick Coghlan <ncogh...@gmail.com> wrote: > > On Wed, May 29, 2013 at 5:41 AM, Russell E. Owen <ro...@uw.edu> wrote: > > > In article <c9841b1f-80f3-4e77-83e6-f71859524...@langa.pl>, > > > Łukasz Langa <luk...@langa.pl> wrote: > > > > > >> Hello, > > >> Since the initial version, several minor changes have been made to the > > >> PEP. The history is visible on hg.python.org. The most important > > >> change in this version is that I introduced ABC support and completed > > >> a reference implementation. > > >> > > >> No open issues remain from my point of view. > > > > > > Is it true that this cannot be used for instance and class methods? It > > > dispatches based on the first argument, which is "self" for instance > > > methods, whereas the second argument would almost certainly be the > > > argument one would want to use for conditional dispatch. > > > > Correct. OO and generic functions are different development paradigms, > > and there are limitations on mixing them. Generic functions are for > > stateless algorithms, which expect to receive all required input > > through their arguments. By contrast, class and instance methods > > expect to receive some state implicitly - in many respects, they > > *already are* generic functions. > > There are actual use cases for generic methods, think pickle.py.
That said, I admit this is a case where the generic method use is private, i.e. is not exposed for other code to extend. (the public extension protocol being in the form of plain methods: __getstate__, etc.) Regards Antoine. _______________________________________________ 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