Newbie naive question ... int() throws ValueError

Chris Angelico rosuav at gmail.com
Sat May 12 18:53:20 EDT 2012


On Sun, May 13, 2012 at 4:25 AM, Devin Jeanpierre
<jeanpierreda at gmail.com> wrote:
> What having to try-it-and-see does is give me extra steps to know what
> it does. Instead of only reading the documentation, now I have to both
> read the documentation *and* try it out in the interactive interpreter
> to see its behaviour in a bunch of undocumented error cases.

Point to note: The Python documentation tells you about the language.
Trying it in the interpreter tells you about your implementation.
There can be differences. I doubt there will be in something as simple
as casting to int, but in other functions, it wouldn't surprise me to
find that CPython (the one that most people think of as Python) and
IronPython, PyPy, or Jython have differences in what they can throw.

ChrisA



More information about the Python-list mailing list