A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20140223/97c613de/attachment.html below:

<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 23 February 2014 02:29, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><p dir="ltr">On 22 Feb 2014 22:15, "Stephen J. Turnbull" <<a href="mailto:stephen@xemacs.org" target="_blank">stephen@xemacs.org</a>> wrote:<br>
> Antoine Pitrou writes:<br>> Â > Chris Angelico <<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>> wrote:<br>> Â > > hasattr(x,"y") <-> (x.y or True except AttributeError: False)<br>
> Â > But it's not the same. hasattr() returns a boolean, not an arbitrary<br>
> Â > value.<br>> I think he meant<br>> Â  Â  hasattr(x,"y") <-> (x.y and True except AttributeError: False)</p>
</div><p dir="ltr">With PEP 463, the explicit equivalent of hasattr() would be something like :</p>
<p dir="ltr">hasattr(x,"y") <-> (bool(x.y) or True except AttributeError: False)</p></blockquote><div>That would work, but I think I'd prefer:</div><div><br></div><div>hasattr(x,"y") <-> bool(x.y or True except AttributeError: False)<br>
</div><div><br></div><div>Makes it clearer IMO that the entire expression will always return a boolean.</div><div><br></div><div>If exception expressions already existed in the language, I would think there would be a strong argument for a library function hasattr(), but probably not a builtin.</div>
<div><br></div><div>Tim Delaney </div></div></div></div>

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