Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Open Source > BOOK: Beginning Python: Using Python 2.6 and Python 3.1
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Python: Using Python 2.6 and Python 3.1
This is the forum to discuss the Wrox book Beginning Python: Using Python 2.6 and Python 3.1 by James Payne; ISBN: 978-0-470-41463-7
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Python: Using Python 2.6 and Python 3.1 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 24th, 2013, 01:09 PM
Authorized User
Points: 123, Level: 2
Points: 123, Level: 2 Points: 123, Level: 2 Points: 123, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2010
Posts: 18
Thanks: 0
Thanked 6 Times in 3 Posts
Default Using Exceptions for Flow Control?

From a software engineering perspective, using exceptions for flow control is considered a bad practice; exceptions should be used for ... exceptions (exceptional/unexpected behavior, failed preconditions), yet many examples in this book do it. Is this something that Python programmers do often or is the author doing this to illustrate the existence of exceptions? It seems like if the intent is to teach people about a topic, it should be taught in a way that mirrors how it ought to be used (and NOT how it ought NOT be used).

For example, one could argue that there exists a precondition for accessing an element of a dictionary that has_key(key) method should return True. Why not then call that method instead of blindly using the key and catching the exception?
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Work Flow - Which Control Powerplanner ASP.NET 4 General Discussion 0 May 24th, 2012 08:21 AM
Which Control To Use - Work Flow Powerplanner BOOK: Beginning ASP.NET 4 : in C# and VB 1 May 24th, 2012 08:14 AM
control flow aranjan ASP.NET 1.0 and 1.1 Professional 0 March 29th, 2007 12:44 PM
When to use Exceptions kcraft Pro PHP 1 January 15th, 2005 01:37 PM
Flow Control shmacgregor VS.NET 2002/2003 6 February 25th, 2004 12:05 AM



All times are GMT -4. The time now is 12:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.