[Python-Dev] PEP 340 -- loose ends

Guido van Rossum gvanrossum at gmail.com
Tue May 3 22:20:38 CEST 2005

> > 1. Decide on a keyword to use, if any.
> I just read the PEP340 basically the first time so bear with me.

Thanks for reviewing!

> 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.

Good point (the code from Queue.py quoted by Jim Jewett also uses
block as a variable name :-). There has been much argument on both
sides. I guess we may need to have a subcommittee to select the
keyword (if any) ...

Maybe if we can't go without a keyword, 'with' would be okay after
all; I'm not so strongly in favor of a Pascal/VB-style with-statement
after reading the C# developers' comments (see reference in the PEP).

> 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.

Hm... Maybe you also want to have separate function and procedure
keywords? Or static typing? 'def' can be used to define all sorts of
things, that is Python's beauty!

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list