Skip to content

Core

shuffl

Deck

Bases: list

A list which only allows hashable and unique elements.

Source code in shuffl/_deck.py
class Deck(list):
    """A list which only allows hashable and unique elements."""

    def __init__(self, iterable: Iterable) -> None:
        deck = _check_valid_iterable(iterable)
        super().__init__(deck)

    def insert(self, index: int, item: Hashable) -> None:
        _check_valid_item(item, self)
        super().insert(index, item)

    def append(self, item: Hashable) -> None:
        _check_valid_item(item, self)
        super().append(item)

__init__(iterable)

PARAMETER DESCRIPTION
iterable

TYPE: Iterable

Source code in shuffl/_deck.py
def __init__(self, iterable: Iterable) -> None:
    deck = _check_valid_iterable(iterable)
    super().__init__(deck)

insert(index, item)

PARAMETER DESCRIPTION
index

TYPE: int

item

TYPE: Hashable

Source code in shuffl/_deck.py
def insert(self, index: int, item: Hashable) -> None:
    _check_valid_item(item, self)
    super().insert(index, item)

append(item)

PARAMETER DESCRIPTION
item

TYPE: Hashable

Source code in shuffl/_deck.py
def append(self, item: Hashable) -> None:
    _check_valid_item(item, self)
    super().append(item)