brad wrote: > Not complaining. len is simple and understandable and IMO fits nicely > with split(), strip(), etc... that's why I used it as an example, but > list(), etc. could be used as examples as well: > > a_string.list() instead of list(a_string)
This is a great example of why list() needs to be a singleton and *not* a method of any particular class. Consider the following contrived object (yes object): def foo(): for x in xrange(6): yield x If we eliminated list() as a first class singleton and forced it to be a method call, how would it work with this generator object? Right now I can say: mylist=list(foo()) Saying list() should be a method only of something iterable is not only foolish, but wasteful. Why should I burden every iterable object with redundant code? And how would you deal with generators in your scenario? In short, making list() a method is wrong-thinking. Reminds me of java. Ugg. > >> And to answer the question. In OO programming generic functions >> are no less important than classes and objects. > > Do they not take away from the OOness of the overall language and > introduce inconsistencies? If find Python to be more OO through and through than Java. Once you understand that functions are objects, and duck-typing, things like len() being a function rather than a method make perfect sense. -- http://mail.python.org/mailman/listinfo/python-list