checking if a list is empty

Chris Angelico rosuav at gmail.com
Sat May 21 22:56:03 EDT 2011


On Sun, May 22, 2011 at 11:02 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Sat, 21 May 2011 15:46:01 +0100, John J Lee wrote:
>
> Er, yes? But in any realistic example (your trivial function xyzzyx below
> is not very realistic) you'll almost certainly get additional hints in
> the function body.

True, but sometimes those hints will be buried in nested calls, making
it less obvious. It might well take some digging to figure out just
what sort of object it's meant to be accepting. That's why I prefer to
have some sort of type declarations; or alternatively, a good
docstring / autodoc comment that says what the function wants and
gives.

Chris Angelico



More information about the Python-list mailing list