Is there any substantial difference between operators and methods?
The only difference I see is the way the are called, do they have other differences?
For
If I understand question currectly...
In nutshell, everything is a method of object. You can find "expression operators" methods in python magic class methods, in the operators.
So, why python has "sexy" things like [x:y]
, [x]
, +
, -
? Because it is common things to most developers, even to unfamiliar with development people, so math functions like +
, -
will catch human eye and he will know what happens. Similar with indexing - it is common syntax in many languages.
But there is no special ways to express upper
, replace
, strip
methods, so there is no "expression operators" for it.
So, what is different between "expression operators" and methods, I'd say just the way it looks.