On Apr 6, 10:23 am, Roy Smith <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]>,
>  Steve Holden <[EMAIL PROTECTED]> wrote:
>
> > > This doesn't cater for negative integers.
>
> > No, it doesn't, but
>
> > s.isdigit() or (s[0] in "+-" and s[1:].isdigit) # untested
>
> > does.
>
> I think this fails on "   -1".  So, then you start doing
> s.strip().isdigit(), and then somebody else comes up with some other
> unexpected corner case...
>
> int(s) and catching any exception thrown just sounds like the best way.

Another corner case: Is "5.0" an integer or treated as one?

regards,
ernie
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to