A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-July/046383.html below:

[Python-Dev] sre.split question

[Python-Dev] sre.split question [Python-Dev] sre.split questionChris King colanderman at gmail.com
Tue Jul 20 19:13:49 CEST 2004
I'm curious as to this bit of code in pattern_split() in Modules/_sre.c:

        if (state.start == state.ptr) {
            if (last == state.end)
                break;
            /* skip one character */
            state.start = (void*) ((char*) state.ptr + state.charsize);
            continue;
        }

This precludes use of patterns that can successfully match zero-length
strings (e.g. r'(?<=[A-Za-z])(?=[^A-Za-z])'.  Skipping one character
is of course the correct behaviour, but what purpose do the break and
continue serve?  The only one I can think of is to stop silly patterns
like r'\s*' from returning a list of characters, but there may be
other reasons I haven't thought of.

(Yes, I know I can get the effect I want by using finditer() ;))
More information about the Python-Dev mailing list

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