[Python-ideas] PEP 484 (Type Hints) -- first draft round

Petr Viktorin encukou at gmail.com
Fri Jan 16 23:37:01 CET 2015


On Fri, Jan 16, 2015 at 10:47 PM, Guido van Rossum <guido at python.org> wrote:
> On Fri, Jan 16, 2015 at 1:08 PM, Petr Viktorin <encukou at gmail.com> wrote:
>>
>> "On Fri, Jan 16, 2015 at 6:17 PM, Guido van Rossum <guido at python.org>
>> wrote:
>> [...]
>> > * Tuple, used as ``Tuple[index0_type, index1_type, ...]``.
>> >   Arbitrary-length tuples might be expressed using ellipsis, in which
>> >   case the following arguments are considered the same type as the last
>> >   defined type on the tuple.
>>
>> How would Tuple[...] or Tuple[t1, ..., t2] work? The PEP should say
>> such shenanigans are undefined, rather than leave it to
>> interpretation.
>
>
> Good point. This needs to be elaborated. See
> https://github.com/ambv/typehinting/issues/30. (Wanna submit a pull
> request?)

Yes.


>> [...]
>> > * WINDOWS
>> >
>> > * UNIXOID, equivalent to ``not WINDOWS``
>>
>> I wonder what the use cases are here. Is this useful, as a dichotomy,
>> outside of asyncio (or other low-level stdlib code)?
>
>
> The stdlib is full of things that work differently on Windows. Consequently
> application code will also often contain things like
>
>     if <windows>:
>         <do it the Windows way>
>     else:
>         <do it the other way>
>
> Typically each branch can only be type-checked if the stdlib for that
> particular platform is accessible. So it makes sense to standardize on a way
> of spelling the test in a way that static checkers can understand.

So "unixoid" just means "not Windows"?
Any new platform Python will be ported to (looking at Micropython for
example) is expected to be "unixoid"?
Can it just be spelled ``not WINDOWS``?


More information about the Python-ideas mailing list