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/20070222/025eff8f/attachment.htm below:

<br><br><div><span class="gmail_quote">On 2/22/07, <b class="gmail_sendername">Neal Becker</b> &lt;<a href="mailto:ndbecker2@gmail.com">ndbecker2@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Mike Klaas wrote:<br><br>&gt; On 2/22/07, Neal Becker &lt;<a href="mailto:ndbecker2@gmail.com">ndbecker2@gmail.com</a>&gt; wrote:<br>&gt;<br>&gt;&gt; Well consider this:<br>&gt;&gt; &gt;&gt;&gt;str (4)<br>&gt;&gt; &#39;4&#39;
<br>&gt;&gt; &gt;&gt;&gt;int(str (4))<br>&gt;&gt; 4<br>&gt;&gt; &gt;&gt;&gt;str (False)<br>&gt;&gt; &#39;False&#39;<br>&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;bool(str(False))<br>&gt;&gt; True<br>&gt;&gt;<br>&gt;&gt; Doesn&#39;t this seem a bit inconsisent?
<br>&gt;<br>&gt; Virtually no python objects accept a stringified version of themselves<br>&gt; in their constructor:<br>&gt;<br>&gt;&gt;&gt;&gt; str({})<br>&gt; &#39;{}&#39;<br>&gt;&gt;&gt;&gt; dict(&#39;{}&#39;)<br>&gt; Traceback (most recent call last):
<br>&gt;&nbsp;&nbsp; File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>&gt; ValueError: dictionary update sequence element #0 has length 1; 2 is<br>&gt; required<br>&gt;&gt;&gt;&gt; str([])<br>&gt; &#39;[]&#39;<br>&gt;&gt;&gt;&gt; list(&#39;[]&#39;)
<br>&gt; [&#39;[&#39;, &#39;]&#39;]<br>&gt;<br>&gt; Python is not Perl.<br>&gt;<br>Except, all the numeric types do, including int, float, and complex.&nbsp;&nbsp;But<br>not bool.&nbsp;&nbsp;In fact, this is not just academic.&nbsp;&nbsp;The fact that other numeric
<br>types act this way leaves a reasonable expectation that bool will.<br>Instead, bool fails in _the worst possible way_: it silently gives a _wrong<br>result_.</blockquote><div><br>i agree with mike; it would just be asking for trouble. (have you ever been bitten by the Perl behavior where the string &#39;0&#39; is considered false?&nbsp; it&#39;s a nasty, nasty problem to debug.)
<br><br>neal, you may be confusing the concepts of &quot;convert data from one type to another&quot; and &quot;read the printed representation of data&quot;.&nbsp; <br></div><br><br>ben</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