macro in python

Terry Reedy tjreedy at udel.edu
Wed Feb 27 15:48:17 EST 2008


"Guilherme Polo" <ggpolo at gmail.com> wrote in message 
news:ac2200130802270508j4d16fb05n15312adec71f2dcd at mail.gmail.com...
| 2008/2/27, bharath venkatesh <bharathv6 at gmail.com>:

| >     how to create macro in python for set of instruction that is done
| > frequently but too less in number to ignore the overhead of function 
call

You can't in Python.  Use an external macro program or cut/repeated paste 
in an editor.

| There is lambda, not exactly a macro.

Not at all a macro.  Purely an abbreviation for def ...

| But every program uses functions why cant yours ?

Yes, function call overhead is seldom the major slowdown except possibly in 
inner loops, where code can be written inline just once.

tjr






More information about the Python-list mailing list