Return to Home Page
      Blog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     FAQ      Search
 

One characteristic design decision here is how a Strategy object should report "I cannot solve this". (Actually this design decision covers a huge range of patterns where a function might return just about anything...)

Choices are:

1. Setting a flag on the Result object, which is perhaps the most Javaish or OOPish thing to do.

2. Returning a special value, such as null or None, that means "cannot solve".

3. Raising a certain exception.

#2 is the most common in practice; #3 is probably the most Pythonic thing. I would argue that using #1 makes the sample code longer than it should be.

f  e  x



Add your comment below. Use an empty line between each paragraph. Paragraphs will be automatically formatted, and single carriage returns will be respected. Use <code> to begin a code block, and </code> to end a code block. Your email address will not be visible to spam harvesters or used in any way except to contact you with further questions.

Your Email Address:

Search     Home     WebLog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     Contact     Site Design     Server Maintenance     Powered by Zope
©2007 MindView, Inc.