<div dir="ltr"><div><div><div><div>There is a discrepancy now between PEP 484 and PEP 526:<br><br></div>def f(x: int = None): ... # OK<br></div>x: int = None     # Error<br><br></div>I think the two rules should be "in sync", in view of this I agree with the proposal.<br><br></div><div>Concerning verbosity and a long name Optional there are many reasonable workarounds.<br></div><div>One is already mentioned from typing import Optional as O. Another (unrelated to `` = None`` pattern)<br>is <a href="https://github.com/python/typing/issues/420">https://github.com/python/typing/issues/420</a> that allows to avoid Optional altogether in patterns like this:<br><br><div>def func(x: Optional[X]) -> Optional[Y]:<br>    if x is None:<br>        return None<br>    # do some stuff with 'x'<br><br>With @maybe decorator proposed in <a href="https://github.com/python/typing/issues/420">https://github.com/python/typing/issues/420</a><br></div><div>this will be simplified to:<br><br></div><div>@maybe<br></div>def func(x: X) -> Y:<br>    if x is None:<br>        return None<br>    # do some stuff with 'x'<br></div><div><br></div><div>Even if @maybe will not make it to typing, one still can define such (or similar) decorators<br></div><div>(especially with @decorated_type and extended Callable syntax).<br></div><div><br></div><div>In view of this, I think verbosity is not a problem at all.<br></div><div><br>--<br></div>Ivan<br><div><div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div></div></div>