<?xml version="1.0" encoding="UTF-8"?>

<rdf:RDF 
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns="http://purl.org/rss/1.0/"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
>

  <channel rdf:about="http://lwn.net/headlines/25302/">
    <title>LWN: Comments on "Choosing a ternary operator for Python"</title>
    <link>http://lwn.net/Articles/25302/</link>
    <description>
This is a special feed containing comments posted
to the individual LWN article titled &quot;Choosing a ternary operator for Python&quot;.

    </description>

    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>2</syn:updateFrequency>
    <items>
      <rdf:Seq>
	<rdf:li resource="http://lwn.net/Articles/25422/rss" />
	<rdf:li resource="http://lwn.net/Articles/25395/rss" />
	<rdf:li resource="http://lwn.net/Articles/25344/rss" />
	<rdf:li resource="http://lwn.net/Articles/25315/rss" />
	<rdf:li resource="http://lwn.net/Articles/25313/rss" />
      
      </rdf:Seq>
    </items>

  </channel>
    <item rdf:about="http://lwn.net/Articles/25422/rss">
      <title>Awkward Voting</title>
      <link>http://lwn.net/Articles/25422/rss</link>
      <dc:date>2003-03-13T22:15:33+00:00</dc:date>
      <dc:creator>gleef</dc:creator>
      <description>
      &lt;p&gt;With such an awkward voting scheme, it's no wonder they have no clear winner.  To select between so many choices, Condorcet voting becomes almost a necessity.  I'm not a python developer, but I would suggest that they may actually get an answer to their question if they rerun the vote as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add any significant write-in's from the first vote to the list&lt;/li&gt;
&lt;li&gt;Add &quot;No Tertiary Operator&quot; to the list of choices&lt;/li&gt;
&lt;li&gt;Remove &quot;Write In Vote&quot; from the list, there are enough choices&lt;/li&gt;
&lt;li&gt;Have every voter submit a fully ranked ballot.  Nothing fancy, just rank all the choices (including &quot;No Tertiary Operator&quot;) in order of preference.  If there are 18 choices, there should be 18 rankings for each ballot&lt;/li&gt;
&lt;li&gt;Process those ballots using the Condorcet rules (or one of the widely accepted variations, which only really differ in the method for resolving &quot;circular ties&quot;, a very rare occurance).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The result will be a fair indication of the most preferred choice.  This voting scheme is not significantly harder on the voters.  As for the counters, it's annoying to count lots of these ballots by hand, but we have computers that make it simple.&lt;/p&gt;

&lt;p&gt;For more information on the Condorcet Voting system, see &lt;a href=&quot;http://electionmethods.org/CondorcetEx.htm&quot;&gt;The Election Methods Site&lt;/a&gt;.  For an example of an organization happily using Condorcet for real life decision making see &lt;a href=&quot;http://www.debian.org/vote/&quot;&gt;Debian&lt;/a&gt;.  The system's not perfect, but it's fair and comes up with a good indicator of a preferred compromise choice from a list of many choices.&lt;/p&gt;
      
      </description>
    </item>
    <item rdf:about="http://lwn.net/Articles/25395/rss">
      <title>No need of new syntax</title>
      <link>http://lwn.net/Articles/25395/rss</link>
      <dc:date>2003-03-13T18:11:40+00:00</dc:date>
      <dc:creator>petebull</dc:creator>
      <description>
      And the operator is allowed as an lvalue as in: &lt;br&gt; &lt;br&gt;(a ? b : c) = 5 &lt;br&gt; 
      
      </description>
    </item>
    <item rdf:about="http://lwn.net/Articles/25344/rss">
      <title>Re: It's not completely equivalent</title>
      <link>http://lwn.net/Articles/25344/rss</link>
      <dc:date>2003-03-13T13:32:58+00:00</dc:date>
      <dc:creator>sokol</dc:creator>
      <description>
      Right. I appologize for suggesting a wrong solution.
      
      </description>
    </item>
    <item rdf:about="http://lwn.net/Articles/25315/rss">
      <title>It's not completely equivalent</title>
      <link>http://lwn.net/Articles/25315/rss</link>
      <dc:date>2003-03-13T11:01:15+00:00</dc:date>
      <dc:creator>rschroev</dc:creator>
      <description>
      As pointed out in the Python FAQ (http://www.python.org/cgi-bin/faqw.py?query=ternary&amp;amp;querytype=simple&amp;amp;casefold=yes&amp;amp;req=search), there is a problem:&lt;p&gt;&amp;quot;Is there an equivalent of C's &amp;quot;?:&amp;quot; ternary operator?&lt;br&gt;Not directly. In many cases you can mimic a?b:c with &amp;quot;a and b or c&amp;quot;, but there's a flaw: if b is zero (or empty, or None -- anything that tests false) then c will be selected instead. In many cases you can prove by looking at the code that this can't happen (e.g. because b is a constant or has a type that can never be false), but in general this can be a problem.&amp;quot;&lt;p&gt;There is a workaround though:&lt;p&gt;&amp;quot;Tim Peters (who wishes it was Steve Majewski) suggested the following solution: (a and [b] or [c])[0]. Because [b] is a singleton list it is never false, so the wrong path is never taken; then applying [0] to the whole thing gets the b or c that you really wanted. Ugly, but it gets you there in the rare cases where it is really inconvenient to rewrite your code using 'if'.&amp;quot;&lt;p&gt;In any case, I think using 'and' and 'or' lowers the readability, because it is not obvious what the intent is. A real ternary operator is a good idea.
      
      </description>
    </item>
    <item rdf:about="http://lwn.net/Articles/25313/rss">
      <title>No need of new syntax</title>
      <link>http://lwn.net/Articles/25313/rss</link>
      <dc:date>2003-03-13T10:42:34+00:00</dc:date>
      <dc:creator>sokol</dc:creator>
      <description>
      I am not a Python user but it seems that even in its actual form, Python allows a very similar (and elegant IMHO) syntax:&lt;p&gt;&amp;lt;cond&amp;gt; and &amp;lt;expr1&amp;gt; or &amp;lt;expr2&amp;gt;&lt;br&gt;(you may put it in paranthesis if you like)&lt;p&gt;which works *exactly* in the same manner its C sibling:&lt;br&gt;&amp;lt;cond&amp;gt; ? &amp;lt;expr1&amp;gt; : &amp;lt;expr2&amp;gt;&lt;p&gt;So why all this hype ?
      
      </description>
    </item>
</rdf:RDF>

