Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #97976

Re: None returned

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.python
Subject Re: None returned
Date 2015-10-28 08:33 +0000
Organization A noiseless patient Spider
Message-ID <n0q17v$gup$3@dont-email.me> (permalink)
References <b5e68b04-142f-4b78-89ee-874281914d5b@googlegroups.com>

Show all headers | View raw


On Tue, 27 Oct 2015 03:49:29 -0700, pip7kids wrote:

> Hi In the example code below - why is "None" returned -

A function with no explicit return statement returns the non value None.

Your shape.describe function sets an internal description, but has no 
return value.

Note that your author_name member function has the same issue as the 
describe function.

It might also be useful to distinguish between setter and getter 
functions:

    def set_describe(self,text):
        self.description = text
        
    def set_author_name(self,text):
        self.author = text

    def get_describe(self):
        return self.description
        
    def get_author_name(self):
        return self.author

-- 
Denis McMahon, denismfmcmahon@gmail.com

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

None returned pip7kids@gmail.com - 2015-10-27 03:49 -0700
  Re: None returned cassiobotaro@gmail.com - 2015-10-27 04:08 -0700
  Re: None returned John Gordon <gordon@panix.com> - 2015-10-27 15:02 +0000
  Re: None returned Larry Hudson <orgnut@yahoo.com> - 2015-10-28 00:23 -0700
  Re: None returned Denis McMahon <denismfmcmahon@gmail.com> - 2015-10-28 08:33 +0000

csiph-web