
drsalists at gmail
Jan 24, 2011, 2:40 PM
Post #4 of 7
(172 views)
Permalink
|
|
Re: why are functions greater than numbers?
[In reply to]
|
|
On Mon, Jan 24, 2011 at 1:51 PM, Alan <alan.isaac [at] gmail> wrote: > Why do function objects compare in this way to numbers? > Thanks, > Alan Isaac > > >>>> def f(): return > ... >>>> f>5 > True > > -- > http://mail.python.org/mailman/listinfo/python-list > They shouldn't, but did in 2.x, and no longer do in 3.x: $ /usr/local/cpython-3.1/bin/python3 cmd started 2011 Mon Jan 24 02:39:50 PM Python 3.1.2 (r312:79147, Aug 18 2010, 18:21:44) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def f(): ... return 'abc' ... >>> f > 5 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unorderable types: function() > int() >>> -- http://mail.python.org/mailman/listinfo/python-list
|