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/2001-May/014584.html below:

[Python-Dev] "".tokenize() ?

[Python-Dev] "".tokenize() ?Fredrik Lundh fredrik@pythonware.com
Fri, 4 May 2001 11:57:19 +0200
mal wrote:


> Gustavo Niemeyer submitted a patch which adds a tokenize like
> method to strings and Unicode:
>
> "one, two and three".tokenize([",", "and"])
> -> ["one", " two ", "three"]
>
> I like this method -- should I review the code and then check it in ?

-1.  method bloat.  not exactly something you do every day, and
when you do, it's a one-liner:

def tokenize(string, ignore):
    [word for word in re.findall("\w+", string) if not word in ignore]

> PS: Haven't gotten any response regarding the .decode() method yet...
> should I take this as "no objections" ?

-0.  method bloat.  we don't have asfloat methods on integers and
asint methods on strings either...

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