[Python-ideas] Experiment: Adding "re" to string objects.

Steven D'Aprano steve at pearwood.info
Sun Jul 19 13:39:04 CEST 2009


On Sun, 19 Jul 2009 12:30:19 am Christian Heimes wrote:
> Nick Coghlan wrote:
> > The idea of adding a mutable attribute to strings (even if it plays
> > no part in string equality) sends shivers down my spine. It also
> > seems like it would be difficult to do this in a way that didn't
> > increase the size of all strings by at least one pointer slot.
>
> I've more arguments against the re idea:
[snip]

Apologies for the Metoo, but I'm with Nick and Christian on this. It 
sounds like a terrible idea to me, just to avoid a temporary name in 
the standard idiom:

m = re.match(r'whatever(.*)', s)
if m:
    m.group(1)


-1 on the suggestion.



-- 
Steven D'Aprano



More information about the Python-ideas mailing list