Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18514

Re: Typed python comparison / code analysis questions

References <CAH0oNN+cT4WqM+M+Ne9eOfFL4y71sG84XqYDo+NAkLp-w1kVjw@mail.gmail.com>
Date 2012-01-05 07:38 +1100
Subject Re: Typed python comparison / code analysis questions
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4426.1325709486.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Jan 5, 2012 at 7:09 AM, Lucas Vickers <lucasvickers@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Typed python comparison / code analysis questions Chris Angelico <rosuav@gmail.com> - 2012-01-05 07:38 +1100

csiph-web