Jump to content

Question on the 'return' statement

- - - - -

  • Please log in to reply
1 reply to this topic

#1
demo53

demo53

    Newbie

  • Members
  • PipPip
  • 10 posts
class Recipe:

    """

    This class houses recipes for use by the Omelette class

    """

    

    def __init__(self):

        self.set_default_recipes()

        [B]return[/B]

    

    def set_default_recipes(self):

        self.recipes = {"cheese" : {"eggs":2, "milk":1, "cheese":1},

                        "mushroom" : {"eggs":2, "milk":1, "cheese":1, "mushroom":2},

                        "onion" : {"eggs":2, "milk":1, "cheese":1, "onion":1}}

I'm trying to follow my books code, but I don't understand what's the point of having a return statement in the constructor method.

#2
Flying Dutchman

Flying Dutchman

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 890 posts
  • Location:::1
No point, since constructor aren't designed to return anything. Perhaps this will make more sense.
A conclusion is where you got tired of thinking.
#define class struct    // All is public.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users