code blocks in Python
skip at pobox.com
Tue Nov 25 04:26:07 CET 2003
hjl> Skip: being you a Python old timer, I think you are just grumbling
hjl> for no good reason. :)
hjl> Before anything else, people are already jumping into
hjl> implementation details, optimization, syntax, etc. I am barely
hjl> starting to look at whether there have been previous existing
hjl> efforts, and if so, why were they discarded, etc.
I'm not asking about implementation details, optimization, syntax. All
you've told me is "the compile() function already exists and works in
Python". I understand that. I am completely missing the connection between
"I would like to see code blocks added to Python" and "the compile()
function already exists and works in Python". Just because you have one
doesn't mean you need the other.
Are you just looking for syntactic sugar for the compile() function? If so,
I'm going to have to vote against it. I've been using Python for about 10
years and can't ever remember using the builtin compile() function in my own
code. In fact, for the first year or two I programmed in Python I wasn't
even aware it existed and used to import the compile function from the old
regex module as "from regex import compile".
hjl> (d) Aha! So by analogy, there is no need for the compile() function
hjl> in Python. I get it now!
Fine with me. I've never used it. ;-)
hjl> (e) Wait a second... searching through the Python newsgroup archive
hjl> I find hundreds if not thousands of messages related to
hjl> the usage of the compile() function. So the compile() function
hjl> can't be useless. Either thousands of Python users are wrong,
hjl> or I have not been careful in my thinking process.
I think you're dreaming here.
hjl> Bingo! Now you get it.
I think you built your logic on a false premise: namely that lots of people
use the compile() builtin. If you google for something like "Python
compile", I'll wager almost every hit will be about:
1. compiling Python itself,
2. the Python byte code compiler (to which the compile() function is
only a rarely used interface), or
3. compiling regular expressions
and most of the hits which are actually about the compile() builtin will be
links to pages which document it.
More information about the Python-list