pre-PEP: Suite-Based Keywords
Steven Bethard
steven.bethard at gmail.com
Sat Apr 16 17:20:13 EDT 2005
Shane Hathaway wrote:
> I like this PEP a lot, but your concern is valid. Maybe Brian could
> modify the PEP slightly to disambiguate. How about using an ellipsis in
> the argument list to signify suite-based keywords? Examples:
>
> f(...):
> x = 1
>
> 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
>
> d = dict(...):
> a = 1
> b = 2
I also like the ellipsis idea much better than the original proposal.
While I figured out what the original syntax meant after half a minute
of staring at it (unlike the thunk proposal which I still can't decode),
I couldn't help but feel that I'd like a visual cue that arguments had
been omitted. Seeing
f():
gives me only ':' as a tiny clue that arguments have been omitted. And
':' is used in all Python suites, so it doesn't have a good intuition
associated with it. Using ellipsis or something similar to indicate
that keyword arguments have been omitted would make this much easier for
me to read.
STeVe
More information about the Python-list
mailing list