[EMAIL PROTECTED] a écrit :
> Hey,
> 
> I'm writing a script to generate code. I'm a bit tired of typing
> outfile.write(....). Does python have a way to c-like macros? Every
> instance of o(...) in the code will be replaced by outfile.write(...)?

First: Python has no macro facility.

But in this particular case, it is very simple. Just add:
    o = outfile.write
after the variable outfile is initialized.
It is not a macro (just another name for a function object)
but it looks the same...

-- 
Amaury
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to