code is data

Ravi Teja webraviteja at gmail.com
Sun Jun 18 00:48:38 EDT 2006


BJörn Lindqvist wrote:
> > Personally, I would like to see macros in Python (actually Logix
> > succeeding is good enough). But I am no language designer and the
> > community has no interest in it. When I absolutely need macros, I will
> > go elsewhere.
>
> One must wonder, when is that? When do you absolutely need macros?

Whenever there is significant boiler plate code that functions and
classes cannot eliminate alone.
Whenever there is a more elegant way to express your code.

Python 2.5 introduced conditional expressions and with statement. With
macros, one would not have to wait for the language team to implement
them. More so for features which only a small part of the community has
an interest in.

I *like* 1..5 (ada, ruby) instead of range(5). If I had macros, I would
have done it myself for *my* code.

I would like special behaviour code blocks in my programs, for say DBC
(I am aware of the work arounds).




More information about the Python-list mailing list