abroad() function.
It is actually an iterable object of internal class AbroadInitializer. To inspect abroad objects, since 0.3.50 there is a class
method ~.Tense.isAbroad().
AbroadInitializer class reference via the type constructor:
AbroadInitializer is mysterious, and doesn't require at least one parameter, just as abroad() function:
it demands all 4 from 4 parameters to have a value. First of them is a sequence, last three are corresponding values as in abroad() function,
those are value1, value2 and modifier.
__all__aveytense.__all__
returns all globally scoped functions and classes inside module aveytense, meanwhile
aveytense.Tense.__all__ returns all normally accessible
non-underscored members of the class aveytense.Tense.
aveytense.util features a decorator @all
for creating the __all__ attribute for types easier.
@all cannot be missed, otherwise an error is thrown (surprisingly it is
AttributeError stating that there is lack of attribute
we created). Moreover, there are 4 optional parameters. However, these won't be discussed as this goes beyond the definition of the __all__ attribute.
aveytense.util specially for making the __all__ attribute easier:
class decorator @All and decorator @all. These got marked unrealized, because mechanisms used didn't work. Ultimately,
on 0.3.53, @all has been defined.
AVT_ prefixed typesAVT_ prefix from submodule aveytense.types are
supposed to warrant their current state for all supported versions of Python by AveyTense (≥ 3.8). Naming syntax is:
typing are redefined, basing on the availability of method __class_getitem__() in stub files specific Python definitions are defined
in, e.g. memoryview (has __class_getitem__() method since 3.14).
__class_getitem__()
AVT_ prefixed types:
| Type name | Lifetime | Python equivalent |
|---|---|---|
| Primal | ||
aveytense.types.AVT_Array |
≥ 0.3.54 | array.array (1) |
aveytense.types.AVT_AsyncContextManager |
≥ 0.3.53 | contextlib.AbstractAsyncContextManager (2) (3) |
aveytense.types.AVT_AsyncGenerator |
≥ 0.3.52 | collections.abc.AsyncGenerator (2) |
aveytense.types.AVT_AsyncIterable |
≥ 0.3.52 | collections.abc.AsyncIterable (2) |
aveytense.types.AVT_AsyncIterator |
≥ 0.3.52 | collections.abc.AsyncIterator (2) |
aveytense.types.AVT_Awaitable |
≥ 0.3.52 | collections.abc.Awaitable (2) |
aveytense.types.AVT_Callable |
≥ 0.3.52 | collections.abc.Callable (2) |
aveytense.types.AVT_ChainMap |
≥ 0.3.52 | collections.ChainMap (2) |
aveytense.types.AVT_Collection |
≥ 0.3.52 | collections.abc.Collection (2) |
aveytense.types.AVT_Container |
≥ 0.3.52 | collections.abc.Container (2) |
aveytense.types.AVT_ContextManager |
≥ 0.3.53 | contextlib.AbstractContextManager (2) (3) |
aveytense.types.AVT_Coroutine |
≥ 0.3.52 | collections.abc.Coroutine (2) |
aveytense.types.AVT_Counter |
≥ 0.3.52 | collections.Counter (2) |
aveytense.types.AVT_DefaultDict |
≥ 0.3.52 | collections.defaultdict (2) |
aveytense.types.AVT_Deque |
≥ 0.3.52 | collections.deque (2) |
aveytense.types.AVT_Dict |
≥ 0.3.52 | dict (2) |
aveytense.types.AVT_Enumerate |
≥ 0.3.55a2 | enumerate (4) |
aveytense.types.AVT_FrozenSet |
≥ 0.3.52 | frozenset (2) |
aveytense.types.AVT_Generator |
≥ 0.3.52 | collections.abc.Generator (2) |
aveytense.types.AVT_ItemsView |
≥ 0.3.52 | collections.abc.ItemsView (2) |
aveytense.types.AVT_Iterable |
≥ 0.3.52 | collections.abc.Iterable (2) |
aveytense.types.AVT_Iterator |
≥ 0.3.52 | collections.abc.Iterator (2) |
aveytense.types.AVT_KeysView |
≥ 0.3.52 | collections.abc.KeysView (2) |
aveytense.types.AVT_List |
≥ 0.3.52 | list (2) |
aveytense.types.AVT_Mapping |
≥ 0.3.52 | collections.abc.Mapping (2) |
aveytense.types.AVT_MappingView |
≥ 0.3.52 | collections.abc.MappingView (2) |
aveytense.types.AVT_Match |
≥ 0.3.52 | re.Match (2) |
aveytense.types.AVT_MemoryView |
≥ 0.3.54 | memoryview (5) |
aveytense.types.AVT_MutableMapping |
≥ 0.3.52 | collections.abc.MutableMapping (2) |
aveytense.types.AVT_MutableSequence |
≥ 0.3.52 | collections.abc.MutableSequence (2) |
aveytense.types.AVT_MutableUniqual |
≥ 0.3.52 | collections.abc.MutableSet (2) (6) |
aveytense.types.AVT_OrderedDict |
≥ 0.3.52 | collections.OrderedDict (2) |
aveytense.types.AVT_PathLike |
≥ 0.3.54 | os.PathLike (7) |
aveytense.types.AVT_Pattern |
≥ 0.3.52 | re.Pattern (2) |
aveytense.types.AVT_Reversible |
≥ 0.3.52 | collections.abc.Reversible (2) |
aveytense.types.AVT_Sequence |
≥ 0.3.52 | collections.abc.Sequence (2) |
aveytense.types.AVT_Set |
≥ 0.3.52 | set (2) |
aveytense.types.AVT_Tuple |
≥ 0.3.52 | tuple (2) |
aveytense.types.AVT_Type |
≥ 0.3.52 | type (2) |
aveytense.types.AVT_Uniqual |
≥ 0.3.52 | collections.abc.Set (2) (6) |
aveytense.types.AVT_ValuesView |
≥ 0.3.52 | collections.abc.ValuesView (2) |
| Secondary | ||
aveytense.types.AVT_Accumulate |
≥ 0.3.55a2 | itertools.accumulate |
aveytense.types.AVT_Batched |
≥ 0.3.55a2 | itertools.batched (8) |
aveytense.types.AVT_Chain |
≥ 0.3.55a2 | itertools.chain |
aveytense.types.AVT_Combinations |
≥ 0.3.55a2 | itertools.combinations |
aveytense.types.AVT_CombinationsReplacement |
≥ 0.3.55a2 | itertools.combinations_with_replacement |
aveytense.types.AVT_Compress |
≥ 0.3.55a2 | itertools.compress |
aveytense.types.AVT_Count |
≥ 0.3.55a2 | itertools.count |
aveytense.types.AVT_Cycle |
≥ 0.3.55a2 | itertools.cycle |
aveytense.types.AVT_DropWhile |
≥ 0.3.55a2 | itertools.dropwhile |
aveytense.types.AVT_FilterFalse |
≥ 0.3.55a2 | itertools.filterfalse |
aveytense.types.AVT_GroupBy |
≥ 0.3.55a2 | itertools.groupby |
aveytense.types.AVT_Islice |
≥ 0.3.55a2 | itertools.islice |
aveytense.types.AVT_Pairwise |
≥ 0.3.55a2 | itertools.pairwise (9) |
aveytense.types.AVT_Permutations |
≥ 0.3.55a2 | itertools.permutations |
aveytense.types.AVT_Product |
≥ 0.3.55a2 | itertools.product |
aveytense.types.AVT_Repeat |
≥ 0.3.55a2 | itertools.repeat |
aveytense.types.AVT_StarMap |
≥ 0.3.55a2 | itertools.starmap |
aveytense.types.AVT_TakeWhile |
≥ 0.3.55a2 | itertools.takewhile |
aveytense.types.AVT_Zip |
≥ 0.3.55a2 | zip |
aveytense.types.AVT_ZipLongest |
≥ 0.3.55a2 | itertools.zip_longest |
| Clean | ||
aveytense.types.AVT_GenericAlias |
≥ 0.3.55a2 | types.GenericAlias |
aveytense.types.AVT_UnionType |
≥ 0.3.55a2 | types.UnionType |
AVT_Array for Python 3.12 and above is clean type alias of array.array. For least versions it occurs as a class inheriting from array.array and
typing.Generic.
(2) All these classes are generic since Python 3.9; in previous versions of Python their generic equivalents were stored in the
typing library. Today these still exist despite these are deprecated, as in
this article, as no version of removal was given to this
day. Before Python 3.9, these classes are imported from typing library, since and after - from their Python libraries, without any modifications performed in either version.
(3) Following naming of ABCs from contextlib library in typing library,
there is no Abstract prefix.
(4) enumerate is subscriptable since Python 3.9, but its version on
typing module (Enumerate) wasn't defined.
(5) memoryview is subscriptable since Python 3.14; in this case
AVT_MemoryView for Python 3.14 and above is clean type alias of memoryview. For least versions it occurs as an inheritable class (exception from memoryview)
with base typing.Generic and that re-implements every memoryview class member. It would be much easier, if memoryview wasn't a final class.
(6) To not collide with 2 classes having name Set
(collections.abc.Set
and typing.Set) that also have different use,
for AveyTense collections.abc.Set is called Uniqual, and collections.abc.MutableSet has name MutableUniqual. typing.Set remains as-is,
and it is the class referred by AVT_Set for Python 3.8.
(7) os.PathLike is subscriptable since Python 3.9, so for
Python 3.8 it is defined as a generic protocol class (as it is not defined in typing). Since Python 3.9, AVT_PathLike is clean type alias of os.PathLike.
(8) itertools.batched is backported before Python 3.13
(itertools.batched was actually added in 3.12, but it was lacking the strict keyword parameter). Implementation is different as shown in the documentation.
(9) itertools.pairwise is backported before Python 3.10
Using example (supported versions of Python by AveyTense):
mode parametermode parameter appears in class methods of class
aveytense.Tense usually starting with is- prefix,
and it is used to modify the checking technique. By default it usually has value ~.constants.MODE_AND, indicating every object must comply specific requirement.
Same can be achieved with value "and". Meanwhile values ~.constants.MODE_OR and "or" allow to alleviate the value checking - at least one
of the objects has to complete the given condition. One of examples is given in class method
~.Tense.hasattr().
Examples of class methods in class aveytense.Tense having the mode parameter:
~.Tense.isEllipsis(),
~.Tense.isInteger(),
~.Tense.isNone(),
~.Tense.isString().
~.Tense.hasattr() has it since 0.3.34.
~.Tense.append() &
~.Tense.extend() and
~.Tense.reverse() &
~.Tense.shuffle()
range.
Perhaps you can actually pass a value with keyword, what makes this type of parameters universal, code actually nudges that these parameters
require a parameter passed via position. It is also worth noticing some libraries and applications use this naming convention as in
this section, including Visual Studio Code.
~.util.ParamVar
starting with the word positional. If there is need to mark these positional parameters as universal, consider following solution:
~.Tense.append(),
~.Tense.extend(),
~.Tense.reverse(),
~.Tense.shuffle().
random.shuffle() modified the list instance
(there a), that means this function isn't pure. Meanwhile with ~.Tense.shuffle() returned is reversed copy of the sequence:
~.Tense.shuffle() class method is pure, because it returns modified version of the target sequence.
list with
~.Tense.isList() class method or
set with
~.Tense.isSet(),
but also types of all items within the sequence. This is what additional parameter type is for. Some IDEs can type hint a sequence,
just like below:
typing.get_args()
with type(a) as this function's value. That means we will have to iterate through all items in the sequence.
type parameter. For example (order of types there doesn't matter):
[type(e) for e in <sequence>] promotes defined in version 0.3.51 class method
~.Tense.getAllItemsTypes().
If some types repeat, they won't be added to the returned unique tuple (see
~.util.uniquetuple).
~)aveytense module mostly; also used to keep accordance with tense before 0.3.40. If ~ is used in a class
or module documentation, then it can point to that class/module.
~.util.ParamVar as
their prefix.