Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78320
| Date | 2014-09-25 10:39 +1000 |
|---|---|
| From | Cameron Simpson <cs@zip.com.au> |
| Subject | Re: how to make return(self.res) not to output the content of list ? |
| References | <54235E8B.4040106@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14338.1411606781.18130.python-list@python.org> (permalink) |
On 25Sep2014 08:15, luofeiyu <elearn2014@gmail.com> wrote:
>You could write a separate method that just calls self.grow() and does
>not return the result, and call that method instead from the
>interactive interpreter.
luofeiyu: please take care to include the attribution line. The text above is
from Ian Kelly, but you do not show that. Attribution is important: it both
gives credit and also lets people know who said what.
On 25Sep2014 08:15, luofeiyu <elearn2014@gmail.com> wrote:
>how can i change your meaning into python code?
Well, I'd not do it that way. I would just make .grow() not return self.res.
Basicly, if a function returns None (which it does when it does not have an
explicit return command), the python interpreter prints no output. So I would
just write .grow() like this:
def grow(self):
self.res= a data ananlyse process
Let the caller access self.res directly afterwards if they want to.
For Ian's suggestion, write a trivial method like this:
def grow_but_be_silent(self):
self.grow()
Cumbersome, but it would do what you seem to ask for.
Cheers,
Cameron Simpson <cs@zip.com.au>
Drive Agressively Rash Magnificently - Nankai Leathers
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: how to make return(self.res) not to output the content of list ? Cameron Simpson <cs@zip.com.au> - 2014-09-25 10:39 +1000
csiph-web