Re: Python sed

"Tim Chase [email protected] [sed-users]" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
On 2014-11-02 02:56, [email protected] [sed-users] wrote:
>> is it feasible to allow multiple -e / -f options
> 
> Yes, sure, this is missing.
[snip]  
>> Does sed.py allow -i flag?
> 
> No. Should it be added?

Command-line arguments are part of sed, so they'd need to be
implemented.  I use all three flags on a regular basis.  Fortunately,
if you've got multi-line sed commands working, both -e and -f should
be fairly easy to do as well.

The -i flag is fairly straight-forward to implement, but I'd look at
GNU-sed's source to make sure you replicate its behavior in various
aspects:

 - taking a backup-extension to keep the original around

 - not overwriting in the event something goes wrong (atomicity)

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

That would be my first guess as well -- though I don't know how well
GNU sed handles Unicode, so a Unicode-aware sed could be a big plus
for you.

>> From within python, is there an advantage of using sed.py vs GNU
>> sed?

"bragging rights that you made it" ;-)

Again, great project!

-tim
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.