python equivalent to perl's inplace edit mechanism

Michael Mabin d3vvnull at gmail.com
Thu May 8 10:28:37 EDT 2008


I miswrote my question.  But I still completely understand.  What I really
wanted to know was whether there was something equivalent to how perl can
perform inplace edits of a file with something like the magic $^I variable.


I see from Gabriel that you can use the fileinput module to  achieve this.
Very cool.

And yeah, I think ruby is very perl-like, in that like perl, which looks
like someone duct-taped shell, sed, awk and c into a scripting language,
ruby duct-taped perl, Smalltalk and Python together.

On Thu, May 8, 2008 at 7:49 AM, David <wizzardx at gmail.com> wrote:

> On Thu, May 8, 2008 at 2:11 PM, Michael Mabin <d3vvnull at gmail.com> wrote:
> > Does python have an equivalent to Perl's inplace-edit variable $^I?
> >
>
> I misread your question.
>
> No, Python eschews magic characters and symbols. They make code ugly
> and harder to read and maintain.
>
> The first 3 lines of the Zen of Python:
>
> Beautiful is better than ugly.
> Explicit is better than implicit.
> Simple is better than complex.
>
> You might find a variable like that in Ruby, which has strong Perl
> influences.
>
> David.
>



-- 
| _ | * | _ |
| _ | _ | * |
| * | * | * |
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080508/c5e93b0a/attachment-0001.html>


More information about the Python-list mailing list