On Fri, Jul 16, 2010 at 6:08 PM, Georg Brandl <g.bra...@gmx.net> wrote:
> Nevertheless, the authoritative reference for our regex engine is its
> docs, i.e. http://docs.python.org/library/re.html -- and that states
> clearly that inline flags apply to the whole regex.
>
>> I think with a new regex implementation, not all of this "historical"
>> semantics must be copied, unless there are major real usecases, which
>> would be affected by this.
>
> As I already said, I *have* seen this in real code.  As MRAB indicated,
> this was the only silent change in semantics as compared to the old
> regex engine.  If we replace re by regex, which I think is the only
> way to get the new features in the stdlib, changing this one aspect is
> a) not backwards compatible and b) in a subtle way that forces everyone
> to review his/her regular expressions.  That's definitely not
> acceptable.

I wonder if the solution could be a new flag that you have to specify
if you want the flags to apply locally only. Let's say add 'L' to the
flags. Then for existing code (not using 'L') the flags should apply
globally, while someone wanting flags to apply to only part of a regex
can add 'L' to the flags syntax.

Is that acceptable?

-- 
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to