Path: csiph.com!goblin3!goblin.stu.neva.ru!news.netfront.net!not-for-mail From: Vladimir Macek Newsgroups: cz.comp.lang.python Subject: Re: [python] Coding style Date: Thu, 26 Nov 2015 10:14:02 +0100 Organization: Netfront http://www.netfront.net/ Lines: 32 Message-ID: References: NNTP-Posting-Host: 194.228.3.217 Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: adenine.netfront.net 1448529247 44602 194.228.3.217 (26 Nov 2015 09:14:07 GMT) X-Complaints-To: news@netfront.net NNTP-Posting-Date: Thu, 26 Nov 2015 09:14:07 +0000 (UTC) To: Konference PyCZ Received-SPF: none (Address does not pass the Sender Policy Framework) SPF=MAILFROM; sender=macek@sandbox.cz; remoteip=::ffff:87.236.197.188; remotehost=; helo=mx.sandbox.cz; receiver=hugo.zagamma.cz; X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: Received-SPF: none (Address does not pass the Sender Policy Framework) SPF=FROM; sender=macek@sandbox.cz; remoteip=::ffff:87.236.197.188; remotehost=; helo=mx.sandbox.cz; receiver=hugo.zagamma.cz; X-BeenThere: python@py.cz X-Mailman-Version: 2.1.20 Precedence: list List-Id: Konference PyCZ List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com cz.comp.lang.python:3050 On 26.11.2015 08:26, Petr Blahos wrote: > Ahoj, co považujete za lepší coding style? > > if evt: > evt.Skip() > > nebo > > evt.Skip() if evt else None > > ? > Ahoj, ty zpusoby nejen ze nejsou funkcne shodne, ale take pusobi na ctenare rozdilne: Prvni naznacuje: Pokud objekt je (platny), proved na nem operaci, ktera muze byt i pomerne komplikovana, mit vliv na system a jejiz vysledek me nezajima (proceduralni typ). Druhy: Ziskej vyslednou hodnotu, pokud je to mozne a spise se neocekava slozita operace uvnitr Skip(), ktera by menila "konfiguraci systemu". Takto to vnimam ja. -- : Vladimir Macek : http://macek.sandbox.cz : +420 608 978 164 : UNIX && Dev || Training : Python, Django : PGP key 97330EBD --- news://freenews.netfront.net/ - complaints: news@netfront.net ---