Re: Python sed

"Daniel Goldman [email protected] [sed-users]" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Gilles Arcas wrote:

>   > Does sed.py allow \< and \> regular expressions?
>
> No. By the way, they are not described in the manual page.
>

You are right, \< \> is not described in the man page or sed manual. But 
I think \< \> is important to add, because it's so useful. I was not 
aware, but \< \> is a GNU extension for \b syntax, so if you already did 
\b that's perhaps good enough. OTOH, I think \< \> is better than \b 
because (to me) it's easier to read.

Looking at some references, it's not even clear \b is an "official" 
Regex, so maybe you don't need to include it. But I couldn't hardly do 
real work without it. And there is also \B which I seem to hardly ever 
or never use.

http://www.regular-expressions.info/wordboundaries.html
http://www.unix.com/man-page/linux/7/regex/

>   > Does sed.py allow -i flag?
>
> No. Should it be added?
>

Totally up to you. It's useful, it helps make scripts easier to read. 
But it is a GNU extension, and of course is never required, can always 
save output to intermediate file. In contrast, \< \> (or \b) seems 
required to me. I think we could live without -iSuffix option.

>   > Is 3.4 slower in general?
>
> Could be due to the fact that Python 3 uses Unicode as a default.
>

If GNU sed does not do unicode, as Tim suggests, and sed.py does do 
unicode, I would agree that would be a big plus, as Tim says.

Anyone know how to test sed for unicode compliance? My sed work is 
always English language, so I've never gotten into that. But I'm 
interested to know, especially to see an example.

>   > PS - functionnality -> functionality
>
> Fixed, thanks!
>

If there was a "sed Hall of Fame", I would vote for you! Regardless of 
the usefulness or lack thereof, writing sed.py must require an 
incredible mastery of both sed and python. If I ever learn python, I 
will take care to look at your source code to learn some.

FWIW, I prefer sed.py name over sedpython name

Daniel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.