A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-May/024761.html below:

[Python-Dev] deprecating string module?

[Python-Dev] deprecating string module?Fredrik Lundh fredrik@pythonware.com
Fri, 31 May 2002 10:19:18 +0200
Guido van Rossum wrote:

> IOW, if I write a function that calls s.lower() for an argument s, I
> can write a custom string type (e.g. UserString) that will work with
> f.  If I wrote the same function using string.lower(s), I have no hope
> (short of modifying the string module).

unless the functions in the string module delegate everything
to the object (just like len(), getattr(), and others), and you
make sure that your type behaves well when mixed with basic
strings.

something like, say:

    def lower(s):
        return s.lower()

or

def capwords(s, sep=3DNone):
    return join(map(capitalize, s.split(sep)), sep or ' ')

Cheers /F





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4