Global Feed Post Login
Replying to Avatar Karsten Johansson

Why doesn't #Python have #Lisp style macros?

For example, here is something that should be able to be used in code generation:

s = "This is a string that I want to turn into a list"

print(s.split(' ', -1))

It's a lame example, but it shows the point cleanly. With a Lisp style macro, I would be able to compile this as a list, instead of creating the lisp at runtime every time.

There doesn't really seem to be anything stopping Python from being able to do this, except the lack of implementation.

Or is it there, and I just don't know about it yet?

Maybe a related question: Does Python have something like Lisp's (compile ....) because that would immediately call for Lisp style macros!

02
Noitpexce 2y ago

Doesn't that kind of defeat the purpose of any interpreted language? For compiled languages I totally agree.

Reply to this note

Please Login to reply.

Discussion

No replies yet.