Re: Python Macros

Discussion in 'Python' started by Josiah Carlson, Oct 4, 2004.


  1. > How hard/easy is it to extend the Python syntax? Perhaps there are


    Check out the tokenizer module.


    > macro facilities for this?


    Python has no macro facilities.


    > I'd like to add messages and message
    > passing, for example.


    Macros are not necessary for message passing. There are at least a
    dozen message passing libraries for inter and intra-machine
    communications, including versions that work with DCOM, Corba, MPI, and
    I'm sure just about anything else you could want to do.

    Heck, writing message passing with TCP sockets is even quite easy, if
    you have experience with writing network protocols.

    If you are just wanting to pass messages in your program, and you are
    using threads, use the Queue module (in 2.4 it will be faster).

    - Josiah
     
    Josiah Carlson, Oct 4, 2004
    #1
    1. Advertisements

  2. Josiah Carlson <> wrote in message news:<>...
    > > How hard/easy is it to extend the Python syntax? Perhaps there are

    >
    > Check out the tokenizer module.


    Sort of OT for this thread, but I've found that tokenize isn't well
    suited to extending syntax, unless you actually want to copy and edit
    the module's source.

    The module has a bunch of code to generate its regular expressions
    that executes in its global scope at import time, so you'd have to
    duplicate that code in order to modify these expressions.

    One might expect something a little more object-oriented out of Python
    (e.g. a Tokenizer class that can be inherited and behavior of the
    subclass modified), but that's not how it's currently set up.
     
    Lonnie Princehouse, Oct 5, 2004
    #2
    1. Advertisements

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. Jason Whitlark
    Replies:
    0
    Views:
    379
    Jason Whitlark
    Jul 15, 2003
  2. Replies:
    80
    Views:
    3,143
    Stephen J. Bevan
    Nov 7, 2003
  3. Replies:
    1
    Views:
    668
    Marco Antoniotti
    Oct 7, 2003
  4. Replies:
    5
    Views:
    699
  5. Arich Chanachai

    Python Macros

    Arich Chanachai, Oct 4, 2004, in forum: Python
    Replies:
    48
    Views:
    1,304
    Greg Ewing
    Oct 11, 2004
  6. Andrew Arro

    macros-loop? calling macros X times?

    Andrew Arro, Jul 23, 2004, in forum: C Programming
    Replies:
    2
    Views:
    633
    S.Tobias
    Jul 24, 2004
  7. Anthony de Almeida Lopes

    Macros within function-like macros?

    Anthony de Almeida Lopes, Dec 26, 2005, in forum: C Programming
    Replies:
    13
    Views:
    974
  8. Thant Tessman

    macros that build macros

    Thant Tessman, Sep 11, 2007, in forum: C Programming
    Replies:
    6
    Views:
    506
    Dave Hansen
    Sep 11, 2007
Loading...