Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.05; 'class,': 0.07; 'method.': 0.07; 'permitted': 0.07; 'string': 0.09; '"no"': 0.09; 'function,': 0.09; 'runs': 0.10; 'def': 0.12; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'function?': 0.16; 'invokes': 0.16; 'likewise': 0.16; 'means.': 0.16; 'message- id:@cskk.homeip.net': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'rhodes': 0.16; 'simpson': 0.16; 'str,': 0.16; 'uppercase': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'normally': 0.19; 'tests': 0.22; 'header:User-Agent:1': 0.23; 'cheers,': 0.24; 'code:': 0.26; 'world,': 0.26; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'leave': 0.29; "i'm": 0.30; 'getting': 0.31; 'class': 0.32; 'there.': 0.32; 'skip:m 30': 0.32; 'not.': 0.33; 'something': 0.35; 'test': 0.35; 'false': 0.36; 'received:com.au': 0.36; 'returning': 0.36; 'method': 0.36; 'charset:us-ascii': 0.36; 'skip:o 20': 0.38; 'received:211': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'simply': 0.61; 'content-disposition:inline': 0.62; 'name': 0.63; 'subject:have': 0.80; '(let': 0.84; 'idiots': 0.84; 'julie': 0.84; 'subject:times': 0.84 Date: Sun, 31 Aug 2014 15:30:26 +1000 From: Cameron Simpson To: python-list@python.org Subject: Re: I have tried and errored a reasonable amount of times MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) References: X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=AOuw8Gd4 c=1 sm=1 tr=0 a=YuQlxtEQCowy2cfE5kc7TA==:117 a=YuQlxtEQCowy2cfE5kc7TA==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=LcaDllckn3IA:10 a=UlL7i0wrPmQA:10 a=sGf6lW-M6BwA:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=LvLpXEYgAAAA:8 a=oDqgCb84dkjHEfcEzigA:9 a=CjuIK1q_8ugA:10 a=WjE-N-J3fjQA:10 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1409464347 news.xs4all.nl 2951 [2001:888:2000:d::a6]:45126 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77341 On 30Aug2014 17:48, Seymore4Head wrote: >I have been told that one is a method and the other calls a method. I >still have to learn exactly what that means. I'm getting there. A method is, essentially, a function. Observe: def my_func(x): print(9) my_func is just the name of the function, and .isupper is likewise just the name of the function that tests a string for uppercaseness. Conversely, my_func() actually calls the function, and likewise .isupper() calls the test function, returning True or False depending on whether the string was uppercase or not. A method versus a function? A method is a particular type of function. It is normally defined in a class, eg: class MyClass: def method_name_here(self, arg1, arg2): ... do something with self and arg1 and arg2 ... When you have an object which is an instance of the class (let us call it "o"), when you call: o.method_name_here(1,2) it invokes the function MyClass.method_name_here(o,1,2). So because the string "no" is an instance of str, the code: "no".isupper() runs the function str.isupper("no"), which examines its argument for uppercaseness. Cheers, Cameron Simpson Why is it so hard for people to simply leave people alone? But, the answer comes to me: they are idiots and in a perfect world, I would be permitted to kill them all. - Julie Rhodes