Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78320 > unrolled thread
| Started by | Cameron Simpson <cs@zip.com.au> |
|---|---|
| First post | 2014-09-25 10:39 +1000 |
| Last post | 2014-09-25 10:39 +1000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
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
| From | Cameron Simpson <cs@zip.com.au> |
|---|---|
| Date | 2014-09-25 10:39 +1000 |
| Subject | Re: how to make return(self.res) not to output the content of list ? |
| Message-ID | <mailman.14338.1411606781.18130.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web