> > Can you provide an example of raising a unicode error like this:
> > 
> >    u = makeUnicodeString()  # your choice of function
> >    int(u)
> 
> In Python 2.3, I get this:
> 
>   >>> int(u"\u1234")
>   Traceback (most recent call last):
>     File "<stdin>", line 1, in ?
>   UnicodeEncodeError: 'decimal' codec can't encode character '\u1234' in position 0: 
>invalid decimal Unicode string
>   >>> 
> 
> In Python 2.2, this raises ValueError.

I spoke too soon.  UnicodeEncodeError is a subclass of ValueError.  So
catching ValueError from int(str_or_unicode) is the way to go.  Who's
writing that Zope 3 style guide again?

--Guido van Rossum (home page: http://www.python.org/~guido/)

_______________________________________________
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