code blocks in Python

Hung Jung Lu hungjunglu at
Tue Nov 25 05:41:57 CET 2003

"John Roth" <newsgroups at> wrote in message news:<vs56mue8hmdob1 at>...
> I'm probably representative. If you don't manage a compelling
> case for why dynamic binding is a useful option, then you're not going
> to get anywhere with this proposal.

Wow, I did not even know there was a proposal. :)

I thought the purpose of my message was to find out whether there have
been previous attempts. I still have not gotten an answer, and I see
already lots of fire. For no good reason.

As I have said, I refuse to believe I am the first person to bring up
this topic. Because it seems such a simple issue, such a simple
feature. (Bear in mind that the compile() function exists since a long
long time ago.) So, I am prepared to listen to experts comment on why
everything is wrong and un-doable, and that the topic has been covered
many times before and is dead since a long time ago. So that I can
simply stop. Yet, I have heard none to the effect.


Like someone said once about metaclasses: if you need to ask if you
need to use metaclasses, the answer is "you don't". Same thing with
metaprogramming. If you need to ask whether you need metaprogramming,
the answer is: "you don't". People that get into metaclasses and
metaprogramming know what they want to do.

If you have really read and digested my comment about thinking first
on compile() function and post later, you wouldn't have posted your

There are two issues here:

(1) The usefulness of meta-programming.
(2) Codeblock feature.

You are asking the question about (1), not (2). My impression is that
you have no experience using compile() function, nor general idea
about metaprogramming. (Feel free to correct me.) But you decide to
use it as an argument to attack (2) anyway, instead of (1). Your
firepower is misplaced, and causes only colateral damages.

Usefulness of meta-programming (in particular, linear
meta-programming) is a completely different subject. If you don't like
metaprogramming, you should have attacked Guido a long time ago, when
the compile() function and code object appeared in Python. That's what
I mean by you need to keep the compile() function in mind before you
make senseless comments about dynamic binding and linking it to (2).

You need to first make that distinction in mind. Your mistake and of
the others comes from your unfamiliarity with the usage of code
objects. Your questions are not regarding codeblock implementation.
Your questions are about metaprogramming in general.

Sure, I'm more than glad to discuss about linear metaprogramming,
despite of having discussed with tons of other Python regulars lots of
times before. But before that, I'd like to make sure about my original
point: has the idea of codeblock ever been discussed in Python? When
and where and the URL links. I am still waiting.


Hung Jung

More information about the Python-list mailing list