Card API

The poker.card module has three basic classes for dealing with card suits, card ranks and cards. It also has a DECK, which is just a tuple of Cards.

Suit

class poker.card.Suit[source]

An enumeration.

Enumeration of the four Suits.

Rank

class poker.card.Rank[source]

An enumeration.

Enumeration of the 13 Ranks.

classmethod difference(first, second)[source]

Tells the numerical difference between two ranks.

Parameters:
Returns:

value of the difference (always positive)

Return type:

int

poker.card.FACE_RANKS

See Face card

poker.card.BROADWAY_RANKS

See Broadway card

Card

class poker.card.Card[source]

Represents a Card, which consists a Rank and a Suit.

classmethod make_random()

Returns a random Card instance.

Return type:Card
is_face
Type:bool
is_broadway
Type:bool
rank
Type:Rank
suit
Type:Suit