cpython-3.5.0: Bindings for libpython
Safe HaskellNone
LanguageHaskell2010

CPython.Types.Set

Description

Any functionality not listed below is best accessed using the either the Object protocol (including callMethod, richCompare, hash, repr, isTrue, and getIter) or the Number protocol (including and, subtract, or, xor, inPlaceAnd, inPlaceSubtract, inPlaceOr, and inPlaceXor).

Synopsis

Documentation

class Object a => AnySet a Source #

Instances

Instances details
AnySet FrozenSet Source # 
Instance details

Defined in CPython.Types.Set

AnySet Set Source # 
Instance details

Defined in CPython.Types.Set

data Set Source #

Instances

Instances details
Concrete Set Source # 
Instance details

Defined in CPython.Types.Set

Methods

concreteType :: Set -> Type

Object Set Source # 
Instance details

Defined in CPython.Types.Set

AnySet Set Source # 
Instance details

Defined in CPython.Types.Set

Number Set Source # 
Instance details

Defined in CPython.Protocols.Number

data FrozenSet Source #

Instances

Instances details
Concrete FrozenSet Source # 
Instance details

Defined in CPython.Types.Set

Object FrozenSet Source # 
Instance details

Defined in CPython.Types.Set

AnySet FrozenSet Source # 
Instance details

Defined in CPython.Types.Set

Number FrozenSet Source # 
Instance details

Defined in CPython.Protocols.Number

iterableToSet :: Object obj => obj -> IO Set Source #

Return a new Set from the contents of an iterable Object. The object may be Nothing to create an empty set. Throws a TypeError if the object is not iterable.

iterableToFrozenSet :: Object obj => obj -> IO FrozenSet Source #

Return a new FrozenSet from the contents of an iterable Object. The object may be Nothing to create an empty frozen set. Throws a TypeError if the object is not iterable.

fromSet :: AnySet set => set -> IO [SomeObject] Source #

size :: AnySet set => set -> IO Integer Source #

Return the size of a Set or FrozenSet.

contains :: (AnySet set, Object key) => set -> key -> IO Bool Source #

Return True if found, False if not found. Unlike the Python contains() method, this computation does not automatically convert unhashable Sets into temporary FrozenSets. Throws a TypeError if the key is unhashable.

add :: (AnySet set, Object key) => set -> key -> IO () Source #

Add key to a Set. Also works with FrozenSet (like setItem it can be used to fill-in the values of brand new FrozenSets before they are exposed to other code). Throws a TypeError if the key is unhashable. Throws a MemoryError if there is no room to grow.

discard :: Object key => Set -> key -> IO Bool Source #

Return True if found and removed, False if not found (no action taken). Does not throw KeyError for missing keys. Throws a TypeError if key is unhashable. Unlike the Python discard() method, this computation does not automatically convert unhashable sets into temporary FrozenSets.

pop :: Set -> IO SomeObject Source #

Return an arbitrary object in the set, and removes the object from the set. Throws KeyError if the set is empty.

clear :: Set -> IO () Source #

Remove all elements from a set.