gah! I hate the new string syntax
Greg Ewing
greg at cosc.canterbury.ac.nz
Sun Mar 4 21:15:44 EST 2001
Amit Patel wrote:
>
> But certainly not capitalize or center.
> They feel like a user definable function that are in the string module
> for convenience. At least in my mind, capitalize is NOT part of the
> basic functionality of a string class.
I second that. Capitalising, splitting, joining, etc. are
things that you do *to* strings, not things that strings
themselves do.
Another thing I'd like to mention is that, by keeping
as many things as possible *not* being methods, the modularity
of the core Python system is improved.
Suppose one day I wanted to make a cut-down version of
the Python interpreter for some specialised application
in which string processing wasn't going to be of much
importance. I might decide that I wanted to remove
most of the standard string-processing functions to
keep the size down.
If the string functions live in a separate module, I can
just recompile Python with that module disabled or replace
it with my own cut-down version.
But if they're methods of the string object, I have to
do surgery on one of the most basic built-in types, which
is a much hairier proposition.
--
Greg Ewing, Computer Science Dept, University of Canterbury,
Christchurch, New Zealand
To get my email address, please visit my web page:
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list