ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: Good code patterns in Python
by Jiri Barton other posts by this author
Jul 1 2003 4:38PM messages near this date
Re: Good code patterns in Python | Re: Good code patterns in Python
One, there has been a proposal for a ternary operator on python.org. You
know that kind of  (cond) ? (eval1) : (eval2) stuff.

Two, no need to guard that code. Passing and assigning a paramater should
always make you THINK about what's happening.

Three, how about
a = 1
b = 0
.....
if b == 0:
  a = 0
else:
  a = a/b
? You cannot replace it with your pattern. Sure enough, there are far more
examples of this -- when you cannot evaluate the first expression.

Jiri Barton




-- 
http://mail.python.org/mailman/listinfo/python-list
Thread:
Will Stuyvesant
Ben Finney
Erik Max Francis
Bernhard Herzog
holger krekel
Kirk Job-Sluder
Erik Max Francis
Dennis Lee Bieber
Jiri Barton
Lulu of the Lotus-Eaters
Terry Reedy
Steven Taschuk
Michele Simionato

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved