Atomic¶
-
class
part.
Atomic
(*args, **kwds)¶ Atomic class.
The
Atomic
class represents an abstract version of two concrete classes:-
abstract
__str__
()¶ Return str(self).
-
__eq__
(other)¶ Return self==other.
-
__lt__
(other)¶ Return self<other.
-
__gt__
(other)¶ Return self>other.
-
abstract
__hash__
()¶ Return hash(self).
-
abstract
__bool__
()¶ Return bool(self).
-
abstract
__or__
(other)¶ Return the union of self with other.
- Parameters
other (
Atomic
, tuple) – Another atomic subset.- Returns
The union of self and other.
- Return type
-
abstract
__and__
(other)¶ Return the intersection of self with other.
- Parameters
other (
Atomic
, tuple) – Another atomic subset.- Returns
The intersection of self and other.
- Return type
-
abstract
__sub__
(other)¶ Return the difference of self with other.
- Parameters
other (
Atomic
, tuple) – Another atomic subset.- Returns
The difference of self and other.
- Return type
-
abstract
__xor__
(other)¶ Return the symmetric difference of self with other.
- Parameters
other (
Atomic
, tuple) – Another atomic subset.- Returns
The symmetric difference of self and other.
- Return type
-
abstract
__invert__
()¶ Return the complement of self.
- Returns
The complement of self.
- Return type
-
static
from_tuple
(item)¶ Create an interval from a tuple.
- Parameters
item (
IntervalTuple
) –The tuple to transform:
a pair
<a,b>
designates an interval closed on the left and open on the right;a triple
<a,b,bool>
designates an interval open/closed on the left and open on the right;a quadruplet
<a,b,bool,bool>
designates an interval open/closed on the left and open/closed on the right.
- Returns
Examples
>>> from part import Atomic >>> print(Atomic[int].from_tuple((10, 20))) [10;20) >>> print(Atomic[int].from_tuple((10, 20, True, None))) [10;20) >>> print(Atomic[int].from_tuple((10, 20, None, None))) (10;20) >>> print(Atomic[int].from_tuple((10, 20, None, True))) (10;20]
-
static
from_value
(value)¶ Create an interval from any value.
- Parameters
value (object) – The value to transform.
- Returns
The value transformed into an interval containing one value.
- Return type
Examples
>>> from part import Atomic >>> print(Atomic[int].from_value(10)) [10;10]
-
abstract
before
(other, strict=True, reverse=False)¶ Return
True
if the subset is the before the other.
-
abstract