useful tool for c.l.p

Discussion in 'Python' started by Behrang Dadsetan, Aug 2, 2003.

  1. I just read through a few posts and something striked me.

    Many people, just like myself, are too lazy to test the python code they
    post here. Most of the time, of course, the code either runs well or the
    person asking at least understands what is meant and can fix eventual bugs.

    Would it not be wonderful to have some kind of integrated python
    interpreter within the news agent/email program, so one could kinda
    select the concerned code (or better, it is automaticly spotted) and
    just let it run within the mail? :)

    Sorry.. it is late here (past 3am) and since a few weeks I really wonder
    what the point is being in 2003.. somehow I so often feel that we are in
    stone age... Especially we, in the IT world, are really late in
    Information Technology.. :)

    Regards,
    Ben.

    PS: Yes I know.. making a super-addin working with all email/news agents
    of the planet does not seem neither worth the effort nor very easily
    implemented.
    PPS: No, do not worry. I am going to sleep right now and will stop
    complaining about why the world is so annoying by the end of this sentence.
    Behrang Dadsetan, Aug 2, 2003
    #1
    1. Advertising

  2. Behrang Dadsetan

    Terry Reedy Guest

    "Behrang Dadsetan" <> wrote in message
    news:bgf3p5$2as$...
    > I just read through a few posts and something striked me.
    >
    > Many people, just like myself, are too lazy to test the python code

    they
    > post here. Most of the time, of course, the code either runs well or

    the
    > person asking at least understands what is meant and can fix

    eventual bugs.

    Careful people, like myself, have learned, often through embarrassing
    experience, to either note <untested> or test, cut, and paste. I
    recommend this to everyone for anything much beyond the truely
    obvious.

    > Would it not be wonderful to have some kind of integrated python
    > interpreter within the news agent/email program, so one could kinda
    > select the concerned code (or better, it is automaticly spotted)

    and
    > just let it run within the mail? :)


    I usually find it easy enough to start up the interpreter and cut and
    paste from the draft post. It is a feature of Python that one can do
    so so easily.

    Terry J. Reedy
    Terry Reedy, Aug 2, 2003
    #2
    1. Advertising

  3. Behrang Dadsetan

    Dave Brown Guest

    In article <bgf3p5$2as$>,
    Behrang Dadsetan <> wrote:
    : Would it not be wonderful to have some kind of integrated python
    : interpreter within the news agent/email program, so one could kinda
    : select the concerned code (or better, it is automaticly spotted) and
    : just let it run within the mail? :)

    But but but...we already have VBScript for that!

    However, the Unix world has been kind of lagging in the viruses
    department....

    --Dave
    --
    "Not Dave! It must have been somebody evil forging a post from him. I don't
    believe Dave is even capable of threatening, abusive or insulting language."
    "And so say all of us!"
    -- Chris Reuter and Matthew Skala
    Dave Brown, Aug 2, 2003
    #3
  4. Behrang Dadsetan

    Bruce Sass Guest

    On Sat, 2 Aug 2003, Alan Kennedy wrote:

    > [Behrang Dadsetan wrote]
    > > Would it not be wonderful to have some kind of integrated python
    > > interpreter within the news agent/email program, so one could kinda
    > > select the concerned code (or better, it is automaticly spotted) and
    > > just let it run within the mail? :)

    >
    > That's a nice idea.
    >
    > However, were you to actually go ahead and implement this idea, we
    > would then be exposing ourselves to serious security risks, since
    > people could post malicious code in their posts.


    As long as the code is not automatically executed it would not be much
    more of a security issue...

    > As Terry Reedy pointed out, it's not hard to fire up the interpreter
    > and paste the script into it. Python's conciseness makes that very
    > easy, even if the whitespace issue sometimes results in mangled code.


    ....because I don't see a difference between selecting code then
    executing it and select, cut'n'paste then execute.

    A standard [or] tool could include a sandbox, which you don't get
    with a simple cut'n'past into an interpreter.

    > And I always like to cast an eye over code before I run it, as a quick
    > sanity check that its not going to do anything I don't want or like
    > the look of.


    Always a good idea.


    While playing with Literate Programing (LP) and generally exploring
    Python awhile back I put together a proof-of-concept which lets you
    place code (noweb markup, can handle multiple files) in an email, have
    it automatically extracted when it hits the mail reader, then sent to
    an editor or IDE. Executing the code is just a click or keypress
    away.

    I figured that noweb markup was simple and unobtrusive, and treating
    the message as LP (with its "flexible order of elaboration") would be
    a good way to include programs, especially long examples, in email.
    However, since that sorta thing doesn't happen very often and it is
    easy to cut'n'paste, I didn't bother to develop it further.


    --- message body example ---

    lpmail: label1 label2

    ....text...

    <<label1>>=
    ....code...
    @

    ....more text...

    <<label2>>=
    ....code...
    @

    -----

    The code is on the 'net at:
    http://home.edmc.net/~bsass/lpmail.py

    Beware: it is a couple of years old and was a
    stream-of-conciousness project... but it works and should only be a
    security problem if the code text can tell the editor or IDE to
    automatically execute a buffer.


    - Bruce
    Bruce Sass, Aug 2, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ben cohen
    Replies:
    0
    Views:
    1,074
    ben cohen
    Aug 20, 2003
  2. Andreas Klemt
    Replies:
    1
    Views:
    400
    Cowboy \(Gregory A. Beamer\)
    Jan 14, 2004
  3. Yann Laviolette

    Very useful tool for RestEasy

    Yann Laviolette, Aug 20, 2009, in forum: HTML
    Replies:
    1
    Views:
    634
    Travis Newbury
    Aug 20, 2009
  4. lolo
    Replies:
    0
    Views:
    275
  5. Yann Laviolette

    Very useful tool for RestEasy

    Yann Laviolette, Aug 20, 2009, in forum: Javascript
    Replies:
    1
    Views:
    134
    Thomas 'PointedEars' Lahn
    Aug 20, 2009
Loading...

Share This Page