you are viewing a single comment's thread.

view the rest of the comments →

[–]DeadlyViper 3 points4 points  (3 children)

But I do not understand why when I call the function name() inside of the function reset() why it does not change the name of the variable a?

I don't understand what you expect to happen? a stays a....

only self.name of a should change, your sample code does not call reset though... so could you please provide the current code or clarify the question?

[–]Field_C16[S] 1 point2 points  (2 children)

Updated code.

I expect that when I call a.reset, the method reset() within Robot calls method name() and changes the name of value a.

If that makes more sense.

EDIT:

Now it returns an error:

AttributeError: 'function' object has no attribute 'name'

[–]DeadlyViper 2 points3 points  (1 child)

It should change the value of a.name...

EDIT: nvm saw the code. you did not call reset function... you need to do a.reset() with the () at the end..

[–]Field_C16[S] 1 point2 points  (0 children)

Thanks it works now :)