[Python-ideas] function defaults and an empty() builtin

Nick Coghlan ncoghlan at gmail.com
Fri May 20 17:03:04 CEST 2011


I share Steve's puzzlement as the intended use case.

To get value from the magic empty immutable list, you will have to
explicitly test that calling your function with the default value does
the right thing.

But if you're writing an explicit test, having that test call the
function *twice* to confirm correct use of the 'is None' idiom will
work just as well.

There are limits to how much we can help people that don't test their code.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list