[Python-ideas] Conventions for function annotations

random832 at fastmail.us random832 at fastmail.us
Thu Dec 6 20:56:07 CET 2012


On Thu, Dec 6, 2012, at 3:43, Masklinn wrote:
> Why would Optional not be a type? It's coherent with Option or Maybe
> types in languages with such features, or C#'s Nullable.

C#'s Nullable doesn't really work outside a static typing system - when
you assign a Nullable to an 'object' or a 'dynamic', you get either the
original type (e.g. Int32) or a null reference (which has no type). It's
a real type only as far as the static typing system goes: it can be the
type of a field or a local variable, it _cannot_ be the type of an
object on the heap.

And since python doesn't have static typing...



More information about the Python-ideas mailing list