> > Mr. Meyers presents some very well-reasoned arguments > > against the everything-should-be-a-method mentality. > > Note that the motivation for turning to string methods was > that of migrating from strings to Unicode. Adding Unicode > support to the strop C module would have caused very complicated > code -- methods helped by enabling polymorphic code which is > one of the great advantages of writing software for an interface > rather than an implementation. Of course. Meyers starts by saying that if it needs implementation details it must be a method. This is true (if only for efficiency reasons) for most string methods. > Note that functions can make very good use of methods and > thus implement polymorphic functionality -- this is not > about methods vs. functions it's about methods to enable > polymorphic functions. Meyers also says that if it needs to be virtual it needs to be a method. Polymorphism is roughly equivalent to virtual in this context, and this alone justifies the move to methods. But join() is special: it is polymorphic in two arguments, and making it a method of the separator argument doesn't help. --Guido van Rossum (home page: http://www.python.org/~guido/)
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