15 Aug
2014
15 Aug
'14
6:57 p.m.
Petr Viktorin wrote:
Instead of
def optional(t): return t | None
it's now:
def optional(t): if t is None: return t else: return t | None
I don't think so. Code that's manipulating types shouldn't be using None as a stand-in for NoneType in the first place. Think of it this way: None is *not* a type, just a special-case value of x in "<type> | x". So optional(None) is an error, just as much as optional(42) would be. -- Greg