[Python-Dev] PEP 340 -- loose ends

holger krekel hpk at trillke.net
Tue May 3 22:14:00 CEST 2005


Hi Guido, 

On Mon, May 02, 2005 at 17:55 -0700, Guido van Rossum wrote:
> These are the loose ends on the PEP (apart from filling in some
> missing sections):
> 
> 1. Decide on a keyword to use, if any.

I just read the PEP340 basically the first time so bear with me. 

First i note that introducing a keyword 'block' would break
lots of programs, among it half of PyPy.  Unlike many other
keywords 'block' is a pretty common variable name.  For
invoking blocktemplates i like the no-keyword approach, instead. 

However, i would find it much clearer if *defining* blocktemplates 
used a new keyword, like: 

    blocktemplate opening(filename, mode="r"): 
        ... 

because this immediately tells me what the purpose and semantics
of the folowing definition is.   The original overloading of 'def' to 
mean generators if the body contains a yield statement was already a 
matter of discussion (ASFAIK).  When i came to Python it was at 2.2
and i remember wondering about this "def" oddity. 

Extending poor old 'def' functions now to possibly mean block
templates gives me semantical overload even if it is justified
from an implementation point of view.  I am talking purely 
about (my sense of) code readability here not about implementation. 

cheers, 

    holger


More information about the Python-Dev mailing list