[Python-Dev] PEP 362 Third Revision (original) (raw)

Ethan Furman ethan at stoneleaf.us
Thu Jun 14 21:46:38 CEST 2012


Antoine Pitrou wrote:

On Thu, 14 Jun 2012 09:32:59 -0700 Benjamin Peterson <benjamin at python.org> wrote:

How about adding 'kind' and keeping 'is*' attributes, but making them read-only dynamic properties, i.e.:

class Parameter: ... @property def isvararg(self): return self.kind == 'vararg' ... ? Seems a bit bloatly to me. (One way to do it.) Agreed with Benjamin. Also, the "is*" attributes are misleading: it looks like they are orthogonal but only one of them can be true at any time.

This is no different from what we have with strings now:

--> 'aA'.islower() False --> 'aA'.isupper() False --> 'a'.islower() True --> 'A'.isupper() True

We know that a string cannot be both all-upper and all-lower at the same time; likewise we know a variable cannot be both positional and kwargs.

Ethan



More information about the Python-Dev mailing list