Would Anonymous Functions Help in Learning Programming/Python?

Kay Schluehr kay.schluehr at gmx.net
Sat Sep 22 02:49:08 EDT 2007


On 22 Sep., 00:36, Cristian <super.sgt.pep... at gmail.com> wrote:

> Yeah, I agree, that does look pretty ugly. Correct me if I'm wrong,
> but I thought the way Python determines a block is by the whitespace
> of the first line. So, as long as the spacing (or !tabbing!) is
> consistent from line to line the parser will know it's part of the
> same block. From that I don't think the parser would have much trouble
> extracting the function definition from the above example. I would
> change the word "def". That's never been informative enough for me.

Here is the grammar:

http://svn.python.org/projects/stackless/tags/python-2.5/Grammar/Grammar

If you feel you can transform it into another unambigous grammar
mixing statements and expressions it's up to you. Guido at least does
not seem to show interest:

http://www.artima.com/weblogs/viewpost.jsp?thread=147358

When you are working on it you'll need a parser generator that also
checks your changes.
EasyExtend might help

http://www.fiber-space.de/EasyExtend/doc/EE.html

You can use it with Python 2.5, create a new fiber and a Grammar.ext
file. Note that the parser generator is LL(1) so it is not all
powerfull but *very* efficient. Tokenization is performed separately.
INDENT, DEDENT are indentation token used within the definition of the
suite nonterminal. I'd provide additional help when you get stuck.

Finally the standard response to your claims: "this is all open
source". This advice might be annoying and uncomfortable and maybe you
just want to talk about some problems and make a few guesses instead
of solving them actually. We are all Web 2.0 now and discussing issues
and doing socialization might be more important than everything else
even among geeks. This can be confusing however for people who believe
that softskills are not everything.

Regards, Kay








More information about the Python-list mailing list