Skip to main content

This package contains implementation of the library "StaticTypedList". StaticTypedList is a data type supporting a list of one type of element (and its subtypes) like Java List objects.

Project description

StaticTypedList

StaticTypedList is a data type supporting a list of one type of element (and its subtypes) like Java List objects.

Installation

pip install StaticTypedList

Usage

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

Length

'len()' function can be called with a StaticTypedList as the parameter. It gets the number of elements in the StaticTypedList.

Input: len(StaticTypedList([4, 5, 3])) Output: 3

Contains

Input: 5 in StaticTypedList([5, 6, 2]) Output: True

Get Item at Index

Input:

a: StaticTypedList = StaticTypedList([5, 6, 2]) print(a[1])

Output: 6

Set Item at Index

Input:

a: StaticTypedList = StaticTypedList([5, 6, 2]) a[1] = 1 print(a)

Output: [5, 1, 2]

Append Element

Input:

a: StaticTypedList = StaticTypedList([5, 6, 2]) a.append(1) print(a)

Output: [5, 6, 2, 1]

Insert Element

Input:

a: StaticTypedList = StaticTypedList([5, 6, 2]) a.insert(1, 3) print(a)

Output: [5, 3, 6, 2]

Remove Element

Input:

a: StaticTypedList = StaticTypedList([5, 6, 2]) a.remove(6) print(a)

Output: [5, 2]

Pop Element

Input:

a: StaticTypedList = StaticTypedList([5, 6, 2]) a.pop(1) print(a)

Output: [5, 2]

Extend Lists

Input:

a: StaticTypedList = StaticTypedList([5, 6, 2]) b: StaticTypedList = StaticTypedList([2, 7]) a.extend(b) print(a)

Output: [5, 6, 2, 2, 7]

Count Number of Occurrences of Element

Input:

a: StaticTypedList = StaticTypedList([5, 6, 2, 7, 2, 3, 2]) print(a.count(2))

Output: 3

Get Index of Element

Input:

a: StaticTypedList = StaticTypedList([1, 7, 3, 7, 5]) print(a.index(3))

Output: 2

Sort

Input:

a: StaticTypedList = StaticTypedList([3, 2, 6, 7, 1]) a.sort() print(a)

Output: [1, 2, 3, 6, 7]

Clear

Input:

a: StaticTypedList = StaticTypedList([3, 2, 6, 7, 1]) a.clear() print(a)

Output: []

Checking for Equality

Input: StaticTypedList([2, 6, 7, 3]) == [2, 6, 7, 3] Output: True

Project details


Release history Release notifications | RSS feed

This version

1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

StaticTypedList-1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

StaticTypedList-1-py2-none-any.whl (5.5 kB view details)

Uploaded Python 2

File details

Details for the file StaticTypedList-1.tar.gz.

File metadata

  • Download URL: StaticTypedList-1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4

File hashes

Hashes for StaticTypedList-1.tar.gz
Algorithm Hash digest
SHA256 f7fd17ed562a7a00c55e4030fbce64327abb8f2497a49dcc0642b049c010bb7e
MD5 2d00295f8576e2a5fd0a541fed987bb4
BLAKE2b-256 fcd6ceaf535681597aab5fa2eb202814327fc496e72aa879a2c1a4c9fbc8a3fd

See more details on using hashes here.

File details

Details for the file StaticTypedList-1-py2-none-any.whl.

File metadata

  • Download URL: StaticTypedList-1-py2-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4

File hashes

Hashes for StaticTypedList-1-py2-none-any.whl
Algorithm Hash digest
SHA256 9284c1d93b3ae85da895f656d57d57f6e473170fcc8ca579857657b486d13ee3
MD5 d4fa5779e898810aa57bfd70b4c8498e
BLAKE2b-256 d216a385dd7c28028d44a0c0535e6dfeb7aacf6fd0ff4422f255d14d5948bbb6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page