pre-PEP: Suite-Based Keywords

Brian Sabbey sabbey at u.washington.edu
Sun Apr 17 17:15:57 EDT 2005


Oren Tirosh wrote:
> Take a look at Nick Coglan's "with" proposal:
>
> http://groups.google.co.uk/groups?selm=mailman.403.1105274631.22381.python-list%40python.org
>
> It addresses many of the same issues (e.g. easy definition of
> properties). It is more general, though: while your proposal only
> applies to keyword arguments in a function call this one can be used
> to name any part of a complex expression and define it in a suite.
>
> I think that a good hybrid solution would be to combine the "with"
> block with optional use of the ellipsis to mean "all names defined in
> the with block".
>
> See also the thread resulting from Andrey Tatarinov's original
> proposal (using the keyword "where"):
>
> http://groups.google.co.uk/groups?selm=3480qqF46jprlU1%40individual.net

Thanks for the links.  I wasn't aware of that proposal.

I agree that a hybrid solution is probably the way to go.

Does anyone know if the 'where' keyword is only for readability (or does 
it disambiguate the syntax in some situations)?  I think I prefer leaving 
it off.

Maybe using '**' would be better than '...' since it already is used to 
indicate keyword arguments.  Example:

class C(object):
     x = property(**):
        doc = "I'm the 'x' property."
        def fget(self):
           return self.__x
        def fset(self, value):
           self.__x = value
        def fdel(self):
           del self.__x


-Brian



More information about the Python-list mailing list