Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Gregory Ewing Newsgroups: comp.lang.python Subject: Re: Equivalent code to the bool() built-in function Date: Mon, 18 Apr 2011 12:08:08 +1200 Lines: 14 Message-ID: <911dnaF58aU1@mid.individual.net> References: <4da9fb0b$0$13696$426a74cc@news.free.fr> <87k4etho6e.fsf@benfinney.id.au> <4daa2b72$0$32037$426a74cc@news.free.fr> <87d3klha85.fsf@benfinney.id.au> <4daaa6f6$0$20187$426a74cc@news.free.fr> <878vv9gqhq.fsf@benfinney.id.au> <4dab7654$0$7290$426a74cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net YubdLuJwvyvXs98rPfKvDwk3Qh/nLp/CjEC68J6oIHbOkt2K9O Cancel-Lock: sha1:yJrAR7mtuAGk18/toRD7V+A58xk= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: <4dab7654$0$7290$426a74cc@news.free.fr> Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3439 candide wrote: > bool(x) is nothing more than a shortcut for the following expression : > True if x else False. It's a much shorter and easier-to-read shortcut. Also keep in mind that if-else expressions are quite a recent addition to the language. Before that, we had 'not not x' as another equivalent -- Greg