Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Neil Cerutti Newsgroups: comp.lang.python Subject: Re: First attempt at a Python prog (Chess) Date: 19 Feb 2013 21:10:44 GMT Organization: Norwich University Lines: 15 Message-ID: References: <2013021323250974803-chrishinsley@gmailcom> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: individual.net tdQK3eQIxOcOlw+8APY8KQOjnCtb4WXerWPbVVDZLrRzmG0g8nGagsZSYm+sh7p6nT Cancel-Lock: sha1:NGUDmjw5R9lFEphj06Wzga/qduU= User-Agent: slrn/0.9.9p1/mm/ao (Win32) Xref: csiph.com comp.lang.python:39275 On 2013-02-15, MRAB wrote: > On 2013-02-15 16:17, Neil Cerutti wrote: >> On 2013-02-15, Oscar Benjamin wrote: >>> if score > best_score or best_score is None: >> >> You need the None check first to avoid an exception from the >> comparison. > > Only in Python 3. It is a more difficult to find bug in Python 2, which will not even throw an exception, but instead silently do the wrong thing. -- Neil Cerutti