It seems that you are watching Stanford’s open class. Let me cheer you up first.
From the code you sent, it seems there is nothing wrong.
Check other parts of your code again, focusing on whether when calling the playingCardDeck attribute, self. playingCardDeck, instead of _playingCardDeck, is used.
This method of overriding the attribute getter is called lazy loading. I won’t go into details here about the benefits. What you should note is that the first time you call this attribute, you must use self.xxx instead of _xxx. Because only self.xxx will call the getter method. Therefore, for the sake of safety, it is best to use self.xxx to call all other places except the getter and setter of this property.
It seems that you are watching Stanford’s open class. Let me cheer you up first.
From the code you sent, it seems there is nothing wrong.
Check other parts of your code again, focusing on whether when calling the playingCardDeck attribute, self. playingCardDeck, instead of _playingCardDeck, is used.
This method of overriding the attribute getter is called lazy loading. I won’t go into details here about the benefits. What you should note is that the first time you call this attribute, you must use self.xxx instead of _xxx. Because only self.xxx will call the getter method. Therefore, for the sake of safety, it is best to use self.xxx to call all other places except the getter and setter of this property.