Last active
December 17, 2015 05:28
-
-
Save zzzeek/5557643 to your computer and use it in GitHub Desktop.
attempting to come up with an example of subclassing enums
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CoinType(Enum): | |
| "types of coins we keep track of." | |
| penny = 1 | |
| nickel = 2 | |
| dime = 3 | |
| quarter = 4 | |
| dollar = 5 | |
| class DefaultCoinUsage(CoinType): | |
| """Represent what coin type the administration | |
| interface should use on startup. | |
| Is stored in prefs.default_coin_type | |
| """ | |
| ask_user = 6 # ask at startup and store per session | |
| last_used = 7 # use the user's last selection from the previous session | |
| class CoinQuery(CoinType): | |
| "Represent criteria for searching among coin records." | |
| all = 6 # query across all coins | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment