pre-PEP: Suite-Based Keywords

Kent Johnson kent37 at tds.net
Fri Apr 15 22:58:03 EDT 2005


Brian Sabbey wrote:
> Here is a pre-PEP for what I call "suite-based keyword arguments". The 
> mechanism described here is intended to act as a complement to thunks. 
> Please let me know what you think.
> 
> Suite-Based Keyword Arguments
> -----------------------------
> 
> Passing complicated arguments to functions is currently awkward in 
> Python. For example, the typical way to define a class property winds up 
> polluting the class's namespace with the property's get/set methods.  By 
> allowing keyword arguments to be defined in a suite following a function 
> call, complicated arguments can be passed in a cleaner, easier way.
> 
> Examples
> ========
> 
> Using suite-based keyword arguments, the code
> 
> f(x = 1)
> 
> is equivalent to
> 
> f():
>    x = 1

ISTM the syntax is ambiguous. How do you interpret
if f():
   x = 1
?

Is a suite alllowed only when a block could not be introduced in the current syntax?

Kent



More information about the Python-list mailing list