Skip to main content

InfiniteList

InfiniteList is a data type which can support any number of elements. This can be done by using class attributes storing a low number of elements.

Installation

pip install InfiniteList

Usage

To use this library, install it using the command shown in "Installation" section. Then, read the instructions below regarding how to use operations with InfiniteList.

count()

InfiniteList class has 'count()' method accepting an element as the parameter to get the number of occurrences of an element in the list.

For example: a: InfiniteList = InfiniteList([2, 3, 4, 3]) a.count(3) -> returns 2

copy()

InfiniteList has 'copy()' method to return a copy of itself.

index()

InfiniteList class has 'count()' method accepting an element as the parameter to get the index of the first occurrence of that element in the list.

For example: a: InfiniteList = InfiniteList([2, 3, 4, 3]) a.index(3) -> returns 1

reverse()

'reverse()' method in InfiniteList class reverses the order of elements in the list.

For example: c: InfiniteList = InfiniteList([4, 3, 5, 6]) c.reverse() print(c) -> prints [6, 5, 3, 4]

sort()

'sort()' method in InfiniteList class sorts all its elements in ascending order.

For example: c: InfiniteList = InfiniteList([4, 3, 5, 6]) c.sort() print(c) -> prints [3, 4, 5, 6]

min()

'min()' method in InfiniteList returns the minimum element in the list.

For example: c: InfiniteList = InfiniteList([4, 3, 5, 6]) print(c.min()) -> prints 3

max()

'max()' method in InfiniteList returns the maximum element in the list.

For example: c: InfiniteList = InfiniteList([4, 3, 5, 6]) print(c.max()) -> prints 6

sum()

'sum()' method in InfiniteList returns the sum of elements in the list.

For example: c: InfiniteList = InfiniteList([4, 3, 5, 6]) print(c.sum()) -> prints 18

extend()

InfiniteList class has 'extend()' method which adds all elements from a list or iterable to the InfiniteList. The elements are added to the end of the InfiniteList.

For example: c: InfiniteList = InfiniteList([4, 3, 5, 6]) c.extend([7, 8]) print(c) -> prints [4, 3, 5, 6, 7, 8]

insert()

'insert()' method in InfiniteList inserts an element at a particular index in the list.

For example: c: InfiniteList = InfiniteList([1, 2, 3]) c.insert(1, 4) print(c) -> prints [1, 4, 2, 3]

append()

'append()' method in InfiniteList adds an element to the end of the list.

For example: c: InfiniteList = InfiniteList([1, 2, 3]) c.append(5) print(c) -> prints [1, 2, 3, 5]

delete()

'delete()' method in InfiniteList removes an element at a particular index in the list.

For example: c: InfiniteList = InfiniteList([4, 3, 5, 6]) c.delete(1) print(c) -> prints [4, 5, 6]

remove()

'remove()' method in InfiniteList removes an elements in the list if it exists.

For example: c: InfiniteList = InfiniteList([4, 3, 5, 6]) c.remove(5) print(c) -> prints [4, 3, 6]

clear()

'clear()' method in InfiniteList removes all elements from the list.

length

To get the number of elements in an InfiniteList, you can write a code in the format 'len(infinite_list)'.

For example: c: InfiniteList = InfiniteList([4, 3, 5, 6]) print(len(c)) -> prints 4

get an item

To get an item from an InfiniteList, you can write a code in the format 'infinite_list[index]'.

For example: c: InfiniteList = InfiniteList([4, 3, 5, 6]) print(c[2]) -> prints 5

edit an item in the list

To edit the value of an item in the list, you need to specify the index of the item you want to edit and the new value of the item.

For example: c: InfiniteList = InfiniteList([4, 3, 5, 6]) c[2] = 7 print(c) -> prints [4, 3, 7, 6]

str

Using Python's built-in 'print' function followed with an InfiniteList will print out all the elements in the InfiniteList.

For example: c: InfiniteList = InfiniteList([4, 3, 5, 6]) print(c) -> prints [4, 3, 5, 6]

Running Tests

The script "BigNumber_versus_mpf.py" (https://github.com/GlobalCreativeCommunityFounder/InfiniteList/blob/main/InfiniteList/InfiniteList_versus_list.py) is used to run tests of the performance of InfiniteList library against Python's built-in list class.

Sample Test Results

Examples of test results for InfiniteList versus list are in the following files:

  1. https://github.com/GlobalCreativeCommunityFounder/InfiniteList/blob/main/InfiniteList/InfiniteList_versus_list_append.txt (testing for performance of adding items to lists)
  2. https://github.com/GlobalCreativeCommunityFounder/InfiniteList/blob/main/InfiniteList/InfiniteList_versus_list_sort.txt (testing for performance of sorting items in lists)

Metadata

Release files for InfiniteList 1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for InfiniteList 1
File Size Uploaded
InfiniteList-1.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for InfiniteList 1
File Interpreter ABI Platform
InfiniteList-1-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / InfiniteList-1.tar.gz

Download URL InfiniteList-1.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
49313349c24f4d38e712f235cbd1cc2c2bb063c6e3e9305168f2c3910e87f437
BLAKE2b-256 checksum
How to use checksums
8b0820684357f2318e2a53d7213ac7d344ff532d8d4acf64d63bfc0d86521254
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / InfiniteList-1-py3-none-any.whl

Download URL InfiniteList-1-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f94d03f244f78bbfe0d4a270c35084fe1e4ddf0a516e94baa5482635306544b4
BLAKE2b-256 checksum
How to use checksums
384267a41122ff40bc424bd29ecac027a0c13f3e1ba61c19c427f4b41107c75b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release history Release notifications | RSS feed

This release

1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page