[Python-3000] Type parameterization

Collin Winter collinw at gmail.com
Fri May 19 20:45:46 CEST 2006


On 5/19/06, Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> wrote:
> "Collin Winter" <collinw at gmail.com> writes:
> > 2. Similarly, annotation classes might want to do more complex
> > parameter validation. Or(), for instance, might want to assert that it
> > needs at least two distinct parameters (that is, Or(int, int, int)
> > simplifies to Or(int), which makes no sense and is an error).
>
> It does make sense. Or(int) denotes the same set of values as int.
>
> You could as well complain that x+0 makes no sense and a language
> should refuse to compute it, asking the programmer to use x instead.

I have yet to see a case where the type of a function wasn't specified
by the user writing it out by hand. Given this, it's highly unlikely
that the user intentionally wrote Or(int) instead of int; they've
accidentally left out a type somewhere, and it should be brought to
their attention.

Since Python 3000 will support things like "ClassA | ClassB", would
you claim that "ClassA |" isn't an error (albeit a syntax error
instead of a call error)?

Collin Winter


More information about the Python-3000 mailing list