[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Tue Jan 25 15:49:04 2005 -->
- <!--x-from-r13: fpureerl ng cebgrhf-grpu.pbz (Prawnzva Epureerl) -->
- <!--x-message-id: 41F6AFB4.30905@proteus-tech.com -->
- <!--x-reference: [email protected] -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] Pyhon syntax -->
- <li><em>date</em>: Tue Jan 25 15:49:04 2005</li>
- <li><em>from</em>: scherrey at proteus-tech.com (Benjamin Scherrey)</li>
- <li><em>in-reply-to</em>: <<a href="msg01068.html">[email protected]</a>></li>
- <li><em>references</em>: <<a href="msg01066.html">[email protected]</a>> <<a href="msg01068.html">[email protected]</a>></li> print row
- <li><em>subject</em>: [ale] Pyhon syntax</li>
This will iterate through every call until c.fetchone() is empty and
returns None or throws an exception. Python structures loops as
iterations of lists, not too dissimilar from lisp except with a readable
syntax. The result is that you do only have one exit from your loop in
the vast majority of cases, you don't have seperate testing code from
iteration code, and the semantics more closely match your logical
intention. I'm a big C++ programmer but python never fails to astonish
me and being both simple to learn while powerfully expressive at the
same time. I think its fairly unique in that regard. Python is very
object oriented as is C++ but also supports the functional paradigm
which, in C++, requires more clumsy and sometimes brain warping syntax
of predicate templates and function objects.
Ben Scherrey
Christopher Fowler wrote:
>The Python fact seems to explain these differences.
>
>
>
>>>>while True:
>>>>
>>>>
>... row = c.fetchone();
>... if not row: break;
>... print row
>
>
>This one works but goes against the idea that if you enter a loop there
>must only be one way out of that loop.
>
>
>
<snip rest>
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="01088" href="msg01088.html">[ale] Pyhon syntax</a></strong>
<ul><li><em>From:</em> rb211 at tds.net (William Bagwell)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="01066" href="msg01066.html">[ale] Pyhon syntax</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="01068" href="msg01068.html">[ale] Pyhon syntax</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg01077.html">[ale] Critters in the Attic</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg01079.html">[ale] Critters in the Attic</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg01068.html">[ale] Pyhon syntax</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg01083.html">[ale] Pyhon syntax</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#01078"><strong>Date</strong></a></li>
<li><a href="threads.html#01078"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>