[Python-3000] Use cases for type annotations?
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Sat May 20 07:24:26 CEST 2006
"Steven Bethard" <steven.bethard at gmail.com> writes:
> Which brings me to my comment about the current discussion. Can't we
> drop the syntax discussion for a while and have someone motivate it
> with some use-cases first? Sure, I can figure out what ``dict[str,
> str|int]`` means, but I still have no idea what you'd gain by
> declaring a parameter to have such a type. Should it add checks every
> time __getitem__ or __setitem__ is called?
Indeed. And if passes through a variable with a declared type multiple
times in a loop, would it accumulate multiple checking layers?
If "mapping" is substituted for "dict", is it wrapped while preserving
the class? How?
IMHO any type checking which would require wrapping in a checking
layer makes no sense; besides the risk of accumulating checking
layers, it doesn't detect type violation at the time of the check
anyway.
--
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
More information about the Python-3000
mailing list