Skip to main content

Timeline for Simple OOP Blackjack game in Python

Current License: CC BY-SA 3.0

6 events
when toggle format what by license comment
Oct 9, 2017 at 18:25 comment added user122352 @Hanzy you would indeed see the memory gradually got up as further stacks were allocated
Oct 9, 2017 at 18:17 comment added Hanzy or rather, if the old references to variables in Table get deleted or stored based on the recursion?
Oct 9, 2017 at 18:15 comment added Hanzy Thanks, that's very helpful. So when trying to understand this, if I were to monitor the amount of memory being used by my program, I should be able to see it continually increase on every round of blackjack? Or maybe I'm misunderstanding how the recursion stack works (I have worked around it before but never really needed to inspect how it's implemented until now... I simply iterated the code instead, but now I'm trying to get a better understanding of what's at play). I'm trying to see if the variables inside Table get overwritten when calling Table.__init__ as well I suppose.
Oct 9, 2017 at 18:02 comment added user122352 @Hanzy each one in turn, each loop of the game adds several functions to the recursive stack, you're probably looking at about 150 games before the error if your recursion stack size is set to 1000 call frames(which it is by default)
Oct 9, 2017 at 17:59 comment added Hanzy Thanks for the heads up! I couldn't decide how to re-initialize the table... my goal was to get as "object oriented" as possible but I hadn't even considered a recursion error. Just so I understand, is it just Table.__init__ at the end of the loop that will be the recursive stack? Or does each function inside the Table get added to the stack also? Just curious if a person would need to play roughly 1000 times or far fewer before the limit is reached.
Oct 9, 2017 at 17:51 history answered user122352 CC BY-SA 3.0