[Python-checkins] CVS: python/dist/src/Grammar Grammar,1.34,1.35

Jeremy Hylton python-dev@python.org
Tue, 28 Mar 2000 18:49:03 -0500


Update of /projects/cvsroot/python/dist/src/Grammar
In directory goon.cnri.reston.va.us:/home/jhylton/python/src/Grammar

Modified Files:
	Grammar 
Log Message:
slightly modified version of Greg Ewing's extended call syntax patch

executive summary:
Instead of typing 'apply(f, args, kwargs)' you can type 'f(*arg, **kwargs)'.
Some file-by-file details follow.

Grammar/Grammar:
    simplify varargslist, replacing '*' '*' with '**'
    add * & ** options to arglist

Include/opcode.h & Lib/dis.py:
    define three new opcodes
        CALL_FUNCTION_VAR
        CALL_FUNCTION_KW
        CALL_FUNCTION_VAR_KW

Python/ceval.c:
    extend TypeError "keyword parameter redefined" message to include
        the name of the offending keyword 
    reindent CALL_FUNCTION using four spaces
    add handling of sequences and dictionaries using extend calls
    fix function import_from to use PyErr_Format


Index: Grammar
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Grammar/Grammar,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** Grammar	1998/04/09 21:36:51	1.34
--- Grammar	2000/03/28 23:49:00	1.35
***************
*** 24,28 ****
  funcdef: 'def' NAME parameters ':' suite
  parameters: '(' [varargslist] ')'
! varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' ('**'|'*' '*') NAME] | ('**'|'*' '*') NAME) | fpdef ['=' test] (',' fpdef ['=' test])* [',']
  fpdef: NAME | '(' fplist ')'
  fplist: fpdef (',' fpdef)* [',']
--- 24,28 ----
  funcdef: 'def' NAME parameters ':' suite
  parameters: '(' [varargslist] ')'
! varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' '**' NAME] | '**' NAME) | fpdef ['=' test] (',' fpdef ['=' test])* [',']
  fpdef: NAME | '(' fplist ')'
  fplist: fpdef (',' fpdef)* [',']
***************
*** 87,90 ****
  classdef: 'class' NAME ['(' testlist ')'] ':' suite
  
! arglist:  argument (',' argument)* [',']
  argument: [test '='] test	# Really [keyword '='] test
--- 87,90 ----
  classdef: 'class' NAME ['(' testlist ')'] ':' suite
  
! arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test)
  argument: [test '='] test	# Really [keyword '='] test