[Python-ideas] PEP 505 (None coalescing operators) thoughts

Sven R. Kunze srkunze at mail.de
Tue Sep 29 18:35:16 CEST 2015


On 29.09.2015 02:38, Terry Reedy wrote:
> On 9/28/2015 5:48 PM, Luciano Ramalho wrote:
>> Glyph tweeted yesterday that everyone should watch the "Nothing is
>> Something" 35' talk by Sandi Metz at RailsConf 2015. It's great and,
>> in a way, relevant to this discussion.
>>
>> https://www.youtube.com/watch?v=29MAL8pJImQ
>
> I understood Metz as advocation avoidig the nil (None) problem by 
> giving every class an 'active nothing' that has the methods of the 
> class.  We do that for most builtin classes -- 0, (), {}, etc. She 
> also used the identity function with a particular signature in various 
> roles.
>

I might stress here that nobody said there's a single "active nothing". 
There are far more "special case objects" (as Robert C. Martin calls it) 
than 0, (), {}, etc. I fear, however, the stdlib cannot account for 
every special case object possible. Without None available in the first 
place, users would be forced to create their domain-specific special 
case objects.

None being available though, people need to be taught to avoid it, which 
btw. she did a really good job of.

Best,
Sven


More information about the Python-ideas mailing list