Patches item #1607548, was opened at 2006-12-02 15:53 Message generated for change (Comment added) made by gvanrossum 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: Guido van Rossum (gvanrossum) Date: 2006-12-19 20:22 Message: Logged In: YES user_id=6380 Originator: NO Applying the patch fails, probably due to recent merge activities in the p3yk branch. Can I inconvenience you with a request to regenerate the patch from the branch head? ---------------------------------------------------------------------- Comment By: Jim Jewett (jimjjewett) Date: 2006-12-11 12:29 Message: Logged In: YES user_id=764593 Originator: NO Could you rename it to "argument annotations"? "optional argument" makes me think of the current keyword arguments, that can be but don't have to be passed. -jJ ---------------------------------------------------------------------- Comment By: Tony Lownds (tonylownds) Date: 2006-12-03 20: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