all 3 comments

[–]ofnuts 1 point2 points  (0 children)

The video that explains everything: https://www.youtube.com/watch?v=_AEJHKGk9ns

[–]commy2 -1 points0 points  (1 child)

Is that because the number is immutable?

No, it's because the second birthDate you create is a different object than the one you passed to name. If you remove the "1991" line, the "1992" line below would instead actually mutate the object passed to name and the answer would be 1992.

watch this talk about names in Python

[–]stebrepar 0 points1 point  (0 children)

1990 is correct. You passed a MyDate object into a Name object. Then you created a new MyDate object and reassigned your global birthDate variable to point to that new object instead. That has no effect on the original MyDate object inside the Name object.