how to convert string function to string method?
Peter Otten
__peter__ at web.de
Mon Dec 7 03:25:33 EST 2009
Dr. Phillip M. Feldman wrote:
> I wrote a handy-dandy function (see below) called "strip_pairs" for
> stripping
> matching pairs of characters from the beginning and end of a string. This
> function works, but I would like to be able to invoke it as a string
> method
> rather than as a function. Is this possible?
This requires a feature called "open classes" (Ruby has them). It is not
possible in Python, at least for built-in types like str.
Peter
More information about the Python-list
mailing list