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/045268.html below:

[Python-Dev] Empty keyword

[Python-Dev] Empty keyword [Python-Dev] Empty keywordRobert Brewer fumanchu at amor.org
Mon Jun 7 12:12:46 EDT 2004
Sylvain Hellegouarch wrote:
> 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:
> 
> which I really dislike.

Have you read the bit about empty lists and such when testing truth
values?
http://docs.python.org/lib/truth.html

>>> x = []
>>> if x:
... 	print True
... else:
... 	print False
... 	
False
>>> x = [0]
>>> if x:
... 	print True
... else:
... 	print False
... 	
True


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org

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