En Mon, 27 Jul 2009 12:44:40 -0300, jakecjacobson
<jakecjacob...@gmail.com> escribió:
You are quite correct in your statements. My goal was not to make
great code but something that I could quickly test. My assumption was
that the httplib.HTTPSConnection() would do the cast to int for me.
As soon as I cast it to an int, I was able to get past that issue.
A few remarks that may help learning the language:
Note that Python is a strongly typed (and dynamic) language. All objects
have a defined type: "443" is not the same thing as 443, and "2" + 2
raises a TypeError.
If a function expects an integer, you must provide an integer (or
something that at least "acts" as an integer; a string isn't
"integer-alike" at all from Python's POV)
Also, you don't "cast" an object into another: the expression int("443")
is a constructor, and it returns a new object (an integer) based upon its
argument. (so it's quite different from, say, casting "short" to "unsigned
short" in C, that only changes the way the compiler treats the same bytes
in memory).
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list