1

in a method definition why would someone set the formal parameter amount equal to the constant PERMANENCE_INC in the formal parameter list?

def increasePermanence(self, amount=PERMANENCE_INC): 
    """ Increases the permanence of this synapse. """ 
    self.permanence = min(1.0, self.permanence+amount)

2 Answers 2

2

That gives default value for the parameter in case it is not provided when the function is called.

For example, to increase permanence by default value, you would call:

obj.increasePermanence()
Sign up to request clarification or add additional context in comments.

Comments

0

This form makes amount an optional argument with a default value of PERMANENCE_INC.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.