Typed python comparison / code analysis questions

Chris Angelico rosuav at gmail.com
Wed Jan 4 15:38:03 EST 2012


On Thu, Jan 5, 2012 at 7:09 AM, Lucas Vickers <lucasvickers at gmail.com> wrote:
> 2) Is there a way to error when comparing variables of different types?

Yep. Use Python version 3.

>>> 1<"1"
Traceback (most recent call last):
  File "<pyshell#88>", line 1, in <module>
    1<"1"
TypeError: unorderable types: int() < str()

Chris Angelico



More information about the Python-list mailing list