deck

Implementation of the deck collection type.


License
Unlicense
Install
pip install deck==1.0

Documentation

Deck

Code style: black

Deck is an implementation of the deck collection type, commonly confused with collections.deque.

>>> from deck import Deck
>>> d = Deck()
>>> d.shuffle()
>>> d.deal()
Card(<Suit.Diamonds: '♦'>, <Value.Two: 2>)
>>> d.deal()
Card(<Suit.Diamonds: '♦'>, <Value.Three: 3>)
>>> d.deal()
Card(<Suit.Hearts: '♥'>, <Value.Ten: 10>)
>>> d.deal()
Card(<Suit.Diamonds: '♦'>, <Value.Nine: 9>)

Deck supports cheating, if that's how you want to play.

>>> d.deal_from_bottom()
Card(<Suit.Spades: '♠'>, <Value.Five: 5>)

Importing the deck module also globally corrects other typographical errors that may occur in your code.

>>> import deck
>>> from collections import deck
>>> deck
<class 'deck.Deck'>

Taking this module too seriously would be a mistake.