Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: TypeError: unorderable types: function() < int() Date: Tue, 10 May 2016 19:16:48 +1000 Lines: 35 Message-ID: References: <1fc32599-0264-460c-8178-057558d19be5@googlegroups.com> <858tziff27.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de KjcA083NJVO+6UMjmt1pEA2zaoCGUQkcsrXC5ctXNWtw== Cancel-Lock: sha1:I7zTg6D5vtSuvWE92RXcxNyanUw= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'beginners': 0.09; 'meaningful': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:()': 0.09; 'typeerror:': 0.09; 'types:': 0.09; 'python': 0.10; "'make": 0.16; 'comparison.': 0.16; 'foundational': 0.16; 'function()': 0.16; 'guessing': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'url:tutor': 0.16; 'integer': 0.18; 'refers': 0.18; 'tests': 0.18; 'function,': 0.22; '(most': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'skip:" 20': 0.26; 'right.': 0.27; 'function': 0.28; 'url:mailman': 0.30; 'seconds': 0.31; 'certain': 0.31; 'anybody': 0.32; 'class': 0.33; 'url:python': 0.33; 'traceback': 0.33; 'url:listinfo': 0.34; 'file': 0.34; 'url:org': 0.36; 'created': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'where': 0.40; '20,': 0.66; 'worth': 0.67; 'skip:\xe2 10': 0.70; 'teach': 0.70; '8bit%:40': 0.72; 'evaluate': 0.72; '_o__)': 0.84; 'contented': 0.84; 'received:125': 0.84; 'welcome!': 0.84; '\xe2\x80\xa6': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <858tziff27.fsf@benfinney.id.au> X-Mailman-Original-References: <1fc32599-0264-460c-8178-057558d19be5@googlegroups.com> Xref: csiph.com comp.lang.python:108458 George Molsom writes: > I have created a program in class 'make a game that tests how good > people are at guessing when 10 seconds has elapsed.' Welcome! You may want to join the dedicated beginners forum where we collaboratively teach foundational Python concepts. > Traceback (most recent call last): > File "E:/Computing/Python/Little book of challenges/Challenge 6 10 seconds experiment.py", line 20, in > if totaltime < 10: > TypeError: unorderable types: function() < int() That's right. The ‘totaltime’ name refers to a function. To ask whether an integer object is less than a function object is not a meaningful comparison. If you want to *call* the function, use the “call this function” syntax:: totaltime() That will evaluate to the return value when you call it, so use the return value:: if totaltime() < 10: # … -- \ “There's a certain part of the contented majority who love | `\ anybody who is worth a billion dollars.” —John Kenneth | _o__) Galbraith, 1992-05-23 | Ben Finney