In python, you don't need overloading, you have a variety of optional parameter mechanisms. I think the "member functions" issues from C++ don't apply to Python becuase C++ is strongly typed, meaning that many similar functions have to be written with slightly different type signatures. The lack of strong typing makes it practical to write generic operations. I find that use of free functions defeats good object-oriented design and leads to functionality being informally bound by a cluster of free functions that have similar names. I'm suspicious of this, finding it tiresome to maintain and debug. --- "Martin v. Loewis" <martin@v.loewis.de> wrote: > Guido van Rossum <guido@python.org> writes: > > > Is this still relevant to Python? Why are C++ member > functions > > difficult to generic programs? Does the same apply to > Python methods? > > In a generic algorithm foo, you can write > > def foo1(x): > bar(x) > > if you have global functions. With methods, you need to write > > def foo1(x): > x.bar() > > which means that bar must be a method of x. This might be > difficult to > achieve if x is of a class that you cannot control. In C++, it > is then > still possible to define a function > > def bar(x of-type-X): > pass > > which, by means of overload resolution, will be found from > foo1 > automatically. > > In Python, this is not so easy since you don't have > overloading. > > Regards, > Martin > > > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev ===== -- S. Lott, CCP :-{) S_LOTT@YAHOO.COM http://www.mindspring.com/~slott1 Buccaneer #468: KaDiMa Macintosh user: drinking upstream from the herd. __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4