Re:Python 3 Types in the Wild: A Tale of Two Type Systems [pdf]
by lmm on Thursday April 15, 2021 @01:49AM
(#26816565)
There's no such thing as "dynamic types". A type is by definition associated with an expression in a language, but those expressions are part of the program's static source code. Python has some kind of checking of the runtime values involved in certain operations, but that's not typing.
[ Parent
| on HN ]
Re:Python 3 Types in the Wild: A Tale of Two Type Systems [pdf]
by HelloNurse on Thursday April 15, 2021 @06:05AM
(#26818449)
Types are not associated with expressions in Python: evaluating an expression produces a typed value, whose type, and not only its value, depends on the type and/or values of the inputs. Example:
def comparativeInsult(a,b):
if b>a:
return "try again"
if a>b:
return a/b
else:
return None
The type is, for all practical purposes, a part of the value of a Python object.