pre-PEP: Suite-Based Keywords
Reinhold Birkenfeld
reinhold-birkenfeld-nospam at wolke7.net
Sat Apr 16 04:39:46 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
Pretty cool, but it interferes with current suites.
How would you write
if f(x=1):
print "yes"
using suite-based keyword args?
Reinhold
More information about the Python-list
mailing list