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. 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
    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. Replies:
    Stephen J. Bevan
    Nov 7, 2003
  2. Replies:
    Marco Antoniotti
    Oct 7, 2003
  3. Replies:
  4. Michael T. Babcock

    Re: Explanation of macros; Haskell macros

    Michael T. Babcock, Nov 3, 2003, in forum: Python
    Michael T. Babcock
    Nov 3, 2003
  5. Andrew Arro

    macros-loop? calling macros X times?

    Andrew Arro, Jul 23, 2004, in forum: C Programming
    Jul 24, 2004

Share This Page