A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-June/045271.html below:

[Python-Dev] Re: Empty keyword

[Python-Dev] Re: Empty keyword [Python-Dev] Re: Empty keywordCasey Duncan casey at zope.com
Mon Jun 7 14:10:24 EDT 2004
On Mon, 07 Jun 2004 14:32:18 +0100
Sylvain Hellegouarch <sh at defuze.org> wrote:

> Hi all,
> 
> It miht sound stupid or useless, or maybe someone has already
> mentioned it but sometimes I wish Python could provdie an "Empty"
> keyword like The "None" one.
> 
> It would be usefull to validdate the emptyness of any scalar or
> sequence in an uniform way instead of using things such as :
> 
> if len(mylist) == 0:

You would not write it this way anyhow. In Python you can test a
sequence directly as in:

if mylist:

or

if not mylist:

Empty sequences (and mappings) are false and non-empty sequences are
true.

See also: http://docs.python.org/ref/Booleans.html#Booleans

-Casey


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4