<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 10, 2013 at 7:01 PM, Nachi Ueno <span dir="ltr"><<a href="mailto:nachi@ntti3.com" target="_blank">nachi@ntti3.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">HI folks<br>
<br>
I would like to ask the review criteria in the community.<br>
<br>
Should we use exception for non-exceptional cases when we can use<br>
 parameter checking?<br>
<br>
Example1:  Default value for array index<br>
<br>
try:<br>
   value = list[5]<br>
except IndexError:<br>
    value = 'default_value'<br>
<br>
This can be also written as,<br>
<br>
     list_a[3] if len(list_a) > 3 else 'default_value'<br>
<br>
"ask for forgiveness, not permission" is one of way in python,<br>
however, on the other hand, google python code style guide says,<br>
-------------<br>
Minimize the amount of code in a try/except block. The larger the body<br>
of the try, the more likely that an exception will be raised by a line<br>
of code that you didn't expect to raise an exception. In those cases,<br>
the try/except block hides a real error.<br>
---------------<br>
<a href="http://google-styleguide.googlecode.com/svn/trunk/pyguide.html#Exceptions" target="_blank">http://google-styleguide.googlecode.com/svn/trunk/pyguide.html#Exceptions</a><br>
<br>
Personally, I prefer not to use exception for such cases.<br></blockquote><div> </div><div>++</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Best<br>
Nachi<br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</blockquote></div><br></div></div>