@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic (No. 2045 / 12833)
A false value doesn't necessarily need to explicitly be False. For example, these are all considered False:
| boolean | False | 
| null | None | 
| zero integer | 0 | 
| zero float | 0.0 | 
| empty string | '' | 
| empty list | [] | 
| empty tuple | () | 
| empty dict | {} | 
| empty set | set() | 
Anything else is considered True.
J'ai essayé.
http://ideone.com/fTS6kQ
def check_empty(something):
	if something:
		print('Not Empty')
	else:
		print('Is Empty')
	
alist = []
check_empty(alist)
alist.append('7of9')
check_empty(alist)
aint = 0
check_empty(aint)
aint = 314
check_empty(alist)
résultat
Success	time: 0 memory: 23304 signal:0
Is Empty
Not Empty
Is Empty
Not Empty
Recommended Posts