Re: Howto MACRO in python ?

Discussion in 'Python' started by Bill Loren, Aug 12, 2003.

  1. Bill Loren

    Bill Loren Guest

    Welp, I'm trying to implement some kind of tracing mechanism which will
    announce every function entrance
    in Run-Time.
    I wrote a trace function:

    DEBUG_LVL = 50

    def trace(level, message):
    if DEBUG_LVL >= level:
    print message

    to which I will call with:

    trace(40, "%s.%s: entrance" % (__name__, <function_name>) )

    upon every function entrance.
    (btw I couldn't find any built-in name which correspands to the current
    function name so
    I type it myslef every trace call)

    my wish was to create a MACRO that will save me some text in the code.
    something like:
    TRACE(40, "entrance")

    that will expand into the trace call.

    what do you think ?

    thanks so much !
    ~B




    ----- Original Message -----
    From: "Peter Hansen" <>
    Newsgroups: comp.lang.python
    To: <>
    Sent: Tuesday, August 12, 2003 1:32 PM
    Subject: Re: Howto MACRO in python ?


    > Bill Loren wrote:
    > >
    > > I was looking for a guidance about how to code MACROs in python.
    > > any offer ?

    >
    > A few alternative responses to Irmen's to-the-point answer:
    >
    > 1. Nobody does.
    >
    > 2. Those who do, probably use a macro language, like maybe M4.
    >
    > 3. Nobody does.
    >
    > 4. What are you actually trying to accomplish, specifically?
    >
    > -Peter
    > --
    > http://mail.python.org/mailman/listinfo/python-list
     
    Bill Loren, Aug 12, 2003
    #1
    1. Advertising

  2. Bill Loren

    Sean Ross Guest

    Sean Ross, Aug 12, 2003
    #2
    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. Dead RAM
    Replies:
    20
    Views:
    1,172
    John Harrison
    Jul 14, 2004
  2. D Senthil Kumar

    macro name from macro?

    D Senthil Kumar, Sep 20, 2003, in forum: C Programming
    Replies:
    1
    Views:
    603
    Jack Klein
    Sep 21, 2003
  3. Bob Gailer

    Re: Howto MACRO in python ?

    Bob Gailer, Aug 12, 2003, in forum: Python
    Replies:
    0
    Views:
    933
    Bob Gailer
    Aug 12, 2003
  4. Christian Tismer

    Re: Howto MACRO in python ?

    Christian Tismer, Aug 12, 2003, in forum: Python
    Replies:
    3
    Views:
    485
    Christian Tismer
    Aug 13, 2003
  5. Richard Meister

    Howto check value of constants in a macro

    Richard Meister, Nov 22, 2005, in forum: C Programming
    Replies:
    11
    Views:
    482
    Michael Mair
    Nov 23, 2005
Loading...

Share This Page