[Python-Dev] What's missing in PEP-484 (Type hints)
Dima Tisnek
dimaqq at gmail.com
Thu May 7 16:28:37 CEST 2015
>> # plain data
>> user1 = dict(id=123, # always int
>> name="uuu", # always str
>> ...) # other fields possible
>> smth = [42, "xx", ...]
>> (why not namedtuple? b/c extensible, mutable)
>> At least one PHP IDE allows to annotate PDO.
>> Perhaps it's just bad taste in Python? Or is there a valid use-case?
>
> Most (all?) of this is actually mentioned in the PEP:
> https://www.python.org/dev/peps/pep-0484/#type-comments
The question was about mixed containers, e.g.:
x = [12, "Jane"]
y = [13, "John", 99.9]
There first element is always int, second always str, and rest is variable.
More information about the Python-Dev
mailing list