<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Aug 15, 2014 at 10:19 AM, Petr Viktorin <span dir="ltr"><<a href="mailto:encukou@gmail.com" target="_blank">encukou@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Aug 15, 2014 at 7:00 PM, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br>
> On Fri, Aug 15, 2014 at 9:48 AM, Petr Viktorin <<a href="mailto:encukou@gmail.com">encukou@gmail.com</a>> wrote:<br>
>><br>
>> On Fri, Aug 15, 2014 at 5:55 PM, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>><br>
>> wrote:<br>
>> ...<br>
>> >> Also... Does None magically mean NoneType in type definitions?<br>
>> ><br>
>> > Yes.<br>
>><br>
>> This would mean either that `(None | None) is None`, or that (x |<br>
>> None) is not always "optional x".<br>
>> And if type objects grow any other common functionality, None will<br>
>> have to support that as well.<br>
><br>
><br>
> Perhaps None itself should not implement any of this, and the __ror__ method<br>
> on ABCs should implement it. That way, None|Mapping and Mapping|None would<br>
> both work, yet None|None would still be the TypeError it is today.<br>
<br>
</div></div>... and that (x|None) does not always mean "optional x".<br>
Is this case special enough?<br>
</blockquote></div><br></div><div class="gmail_extra">I'm not following. The proposal seems to be to add __or__ and __ror__ methods to type itself requiring the other argument to be also a type, or the special case None (which is a value, not a type).<br clear="all">
</div><div class="gmail_extra"><br>-- <br>--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)
</div></div>