[ZPatterns] update to SkinScript for Python 2: list comprehensions
Steve Alexander
[email protected]
Mon, 09 Jul 2001 15:55:20 +0100
This is a multi-part message in MIME format.
--------------C4A24680FEE5D19556F5B6F4
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
With Zope 2.4 and Python 2.1, you can now use list comprehensions in
PythonScripts and in DTML.
Here's a patch to allow list comprehensions from SkinScript too.
While I was looking into this patch, I noticed that you can define
lambdas in SkinScript. You can't use map/reduce/filter though, because
they are functions, and are not in the namespace.
--
Steve Alexander
Software Engineer
Cat-Box limited
--------------C4A24680FEE5D19556F5B6F4
Content-Type: text/plain; charset=us-ascii;
name="diffs.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="diffs.txt"
*** ZPatterns/SkinScript/Compiler.py.original
--- ZPatterns/SkinScript/Compiler.py
***************
*** 523,529 ****
atom ::= ( testlist )
atom ::= ( )
! atom ::= [ testlist ]
atom ::= [ ]
atom ::= { dictmaker }
atom ::= { }
--- 523,529 ----
atom ::= ( testlist )
atom ::= ( )
! atom ::= [ listmaker ]
atom ::= [ ]
atom ::= { dictmaker }
atom ::= { }
***************
*** 566,571 ****
--- 566,581 ----
bare_dictmaker ::= bare_dictmaker , test : test
bare_dictmaker ::= test : test
+ listmaker ::= testlist
+ listmaker ::= testlist list_for
+ list_iter ::= list_for
+ list_iter ::= list_if
+ list_for ::= for testlist in testlist opt_list_iter
+ list_if ::= if test opt_list_iter
+ opt_list_iter ::= list_iter
+ opt_list_iter ::=
+
+
arglist ::= bare_arglist opt_comma
bare_arglist ::= bare_arglist , argument
--------------C4A24680FEE5D19556F5B6F4--