June 2019
Beginner to intermediate
770 pages
19h 24m
English
In some cases, a design evolves into a module that is very complex; it can become so complex that a single file becomes a bad idea. When we start putting billboard comments in a module, it's a hint that we should consider refactoring a complex module into a package built from several smaller modules.
In this case, the package can be as simple as the following kind of structure. We can create a directory, named blackjack; within this directory, the __init__.py file would look like the following example:
"""Blackjack package""" from blackjack.cards import Shoe from blackjack.player import Strategy_1, Strategy_2 from blackjack.casino import ReSplit, NoReSplit, NoReSplitAces, Hit17, Stand17 from blackjack.simulator ...
Read now
Unlock full access