NoneType and new instances

Ethan Furman ethan at stoneleaf.us
Thu Jul 28 18:10:02 EDT 2011


Chris Angelico wrote:
> On Fri, Jul 29, 2011 at 7:03 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
>> I'll use a lambda to get around it, but that's not very elegant.  Why
>> shouldn't NoneType be able to return the singleton None?
> 
> Why a lambda?
> 
> def ThisFunctionWillReturnNone():
>     pass
> 
> Although, since the returning of None is crucial to it, it'd probably
> be better to explicitly "return None". But minimalist useful functions
> are amusing.

More amusing still:

def NoneType():
     "Returns None"

~Ethan~



More information about the Python-list mailing list