On Wed, 31 Oct 2007 07:59:58 -0700, Carl Banks wrote: > Python considers len to be an operator for all intents and purposes. > Python chose to spell this operator like a regular function, but it > could easily have given a special syntax to the length operation (for > instance, $#x).
I hope you're not serious that $# would make a good operator. Apart from conflicting with the comment marker, it is u-g-l-y. That's the problem with operators... all the good ones are taken. > Do you think that, if the length operation had its own syntax, people > would be saying "No, length shouldn't be an operator, it should be a > method"? I don't think so; length is a fundamental and ubiquitous > operation and it wouldn't be unreasonable to give it its own syntax. I think they would. You seem to have missed the context of the thread. The Original Poster was complaining that len() should be a method, because that is more purely Object Oriented. If len() were an operator, that too would be a compromise to the ideal of "every function is an object method". I'm sure there are OO fan[atic]s who dislike operators too. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list