Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #77341
| 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 | <cameron@cskk.homeip.net> |
| 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 <cs@zip.com.au> |
| 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 | <pgh40alno9vl8n8bpk5ogbnc1uhql76n2n@4ax.com> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| References | <pgh40alno9vl8n8bpk5ogbnc1uhql76n2n@4ax.com> |
| 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 <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13658.1409464347.18130.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
On 30Aug2014 17:48, Seymore4Head <Seymore4Head@Hotmail.invalid> 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 <cs@zip.com.au>
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 <jk.rhodes@asacomp.com>
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-30 14:27 -0400
Re: I have tried and errored a reasonable amount of times Tim Chase <python.list@tim.thechases.com> - 2014-08-30 13:48 -0500
Re: I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-30 14:50 -0400
Re: I have tried and errored a reasonable amount of times Ned Batchelder <ned@nedbatchelder.com> - 2014-08-30 16:20 -0400
Re: I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-30 16:32 -0400
Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-31 18:37 +1000
Re: I have tried and errored a reasonable amount of times Chris Angelico <rosuav@gmail.com> - 2014-08-31 19:16 +1000
Re: I have tried and errored a reasonable amount of times Grant Edwards <invalid@invalid.invalid> - 2014-09-02 16:43 +0000
Re: I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-09-02 12:59 -0400
Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-03 11:44 +1000
Re: I have tried and errored a reasonable amount of times Rustom Mody <rustompmody@gmail.com> - 2014-09-02 20:14 -0700
Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve@pearwood.info> - 2014-09-03 07:16 +0000
Re: I have tried and errored a reasonable amount of times Marko Rauhamaa <marko@pacujo.net> - 2014-09-03 10:44 +0300
Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-04 11:54 +1000
Re: I have tried and errored a reasonable amount of times Chris Angelico <rosuav@gmail.com> - 2014-09-04 12:03 +1000
Re: I have tried and errored a reasonable amount of times Rustom Mody <rustompmody@gmail.com> - 2014-09-03 19:23 -0700
Re: I have tried and errored a reasonable amount of times Marko Rauhamaa <marko@pacujo.net> - 2014-09-04 08:36 +0300
Re: I have tried and errored a reasonable amount of times Denis McMahon <denismfmcmahon@gmail.com> - 2014-09-04 11:17 +0000
Re: I have tried and errored a reasonable amount of times Chris Angelico <rosuav@gmail.com> - 2014-09-04 21:42 +1000
Re: I have tried and errored a reasonable amount of times Denis McMahon <denismfmcmahon@gmail.com> - 2014-09-05 02:53 +0000
Re: I have tried and errored a reasonable amount of times Chris Angelico <rosuav@gmail.com> - 2014-09-05 13:02 +1000
Re: I have tried and errored a reasonable amount of times Grant Edwards <invalid@invalid.invalid> - 2014-09-05 14:54 +0000
Re: I have tried and errored a reasonable amount of times Marko Rauhamaa <marko@pacujo.net> - 2014-09-05 19:45 +0300
Re: I have tried and errored a reasonable amount of times Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-30 22:21 +0100
Re: I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-30 17:48 -0400
Re: I have tried and errored a reasonable amount of times Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-30 23:32 +0100
Re: I have tried and errored a reasonable amount of times Cameron Simpson <cs@zip.com.au> - 2014-08-31 15:30 +1000
Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-31 19:05 +1000
csiph-web