Patches item #1607548, was opened at 2006-12-02 20:53 Message generated for change (Comment added) made by tonylownds You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1607548&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core (C code) Group: Python 3000 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Tony Lownds (tonylownds) Assigned to: Nobody/Anonymous (nobody) Summary: Optional Argument Syntax Initial Comment: This patch implements optional argument syntax for Python 3000. The patch still has issues; I am posting so that Collin Winters can add a link to the PEP. The syntax implemented is roughly: def f(arg:expr, (nested1:expr, nested2:expr)) -> expr: suite The function object has a new attribute, func_annotations that maps from argument names to the result of the expression. The return annotation is stored with a key of 'return'. Lambda's syntax doesn't support annotations. This patch alters the MAKE_FUNCTION opcode. I have an implementation that built the func_annotations dictionary in bytecode as well but it was bigger and slower. ---------------------------------------------------------------------- >Comment By: Tony Lownds (tonylownds) Date: 2006-12-04 01:24 Message: Logged In: YES user_id=24100 Originator: YES This patch implements optional argument syntax for Python 3000. The patch still has issues: 1. test_ast and test_scope fail. 2. Running the test suite after compiling the library with the compiler package causes failures 3. no docs 4. C-code reference counts and error checking needs a review The syntax implemented is roughly: def f(arg:expr, (nested1:expr, nested2:expr)) -> expr: suite The function object has a new attribute, func_annotations that maps from argument names to the result of the expression. The return annotation is stored with a key of 'return'. Lambda's syntax doesn't support annotations. The ast format has changed for the builtin compiler and the compiler package. A new token was added, '->' (called RARROW in token.h). token.py lost ERRORTOKEN after re-generating, I don't know why. I added it back manually. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1607548&group_id=5470 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches