Anything can raise MemoryError.
Ok. But I don't think regular application code should catch these.


On converting an 8bit string to an int:

     ValueError *only*
Ok.

On converting a Unicode string to an int:

     ValueError
     UnicodeError (or UnicodeEncodeError, which is a subclass of it)
Can you provide an example of raising a unicode error like this:

u = makeUnicodeString() # your choice of function
int(u)

My point is that once you have a valid unicode object, I don't see how calling int(valid_unicode_object) will raise a UnicodeError.

If this is so, then the style should be:

value = expression_to_compute_value
try:
i = int(value)
except ValueError:
# take corrective action

rather than:

try:
i = int(expression_to_compute_value)
except: # Note: calling 'int()' can raise just about anything
# take corrective action


--
Steve Alexander



_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists - http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope )

Reply via email to