Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75669
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'syntax': 0.04; '(self,': 0.09; 'answering': 0.09; 'callback': 0.09; 'function,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:method': 0.09; 'def': 0.12; 'wrote': 0.14; 'called,': 0.16; 'code?': 0.16; 'dark.': 0.16; 'guessing': 0.16; 'received:80.91.229.3': 0.16; 'received:97': 0.16; 'received:plane.gmane.org': 0.16; 'syntaxerror:': 0.16; 'input': 0.22; 'error': 0.23; 'question': 0.24; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; 'code': 0.31; '"",': 0.31; 'context,': 0.31; 'file': 0.32; 'class': 0.32; 'supposed': 0.32; 'but': 0.35; 'there': 0.35; 'method': 0.36; 'being': 0.38; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'called': 0.40; 'subject:back': 0.60; 'back': 0.62; 'show': 0.63; 'chance': 0.65; 'sample': 0.67; 'invalid': 0.68; 'x):': 0.84; 'subject::': 0.85 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dave Angel <davea@davea.name> |
| Subject | Re:how to call back a method ? |
| Date | Mon, 4 Aug 2014 04:34:11 -0400 (EDT) |
| Organization | news.gmane.org |
| References | <53DEF0E0.4020909@gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | 97.73.240.43 |
| X-Newsreader | PiaoHong.Usenet.Client.VIP:1.56 |
| 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.12625.1407141231.18130.python-list@python.org> (permalink) |
| Lines | 38 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1407141231 news.xs4all.nl 2967 [2001:888:2000:d::a6]:46763 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:75669 |
Show key headers only | View raw
elearn <elearn2014@gmail.com> Wrote in message:
> I want to call back a function which is the method of a class .
>
> def callback(self.do,x):
> return(self.do(x))
>
> That is what i want to write,when i input
>
> def callback(self.do,x):
>
> error message:
>
>
> File "<stdin>", line 1
> def callback(self.do,x):
> ^
> SyntaxError: invalid syntax
>
>
> `do` is a method in my class ,how to write the code?
>
Without some context, answering the question is a shot in the dark.
Is callback supposed to be a member function, and is it always
going to be calling do () on the same object that it was called
on ? Then try
def callback (self, x):
return self.do (x)
But there are many other scenarios. Show us some sample code
where it's actually being called, and we might have a better
chance of guessing what you need.
--
DaveA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re:how to call back a method ? Dave Angel <davea@davea.name> - 2014-08-04 04:34 -0400
csiph-web