Skip to main content

Enhanced python datatypes

Project description

RICHTYPES

Enhanced python Datatype with rich extended methods.

Types Supported

  • list
  • dict
  • set
  • tuple
  • str

Install

pip install richtypes

Examples

RichList

from richtypes import RichList

rl = RichList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) # create a RichList

rl.append(12) # append a number
# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

rl.length # length of the list
# 12


# function to check even
def is_even(num):
    return num % 2 == 0


rl.where(is_even) # filter list which follows is_even func
# [2, 4, 6, 8, 10]

# use inplace=False to return a new list
new = rl.where(is_even, inplace=False)
# [2, 4, 6, 8, 10]


rl.first_where(is_even) # first element which follows is_even func
# 2

RichDict

from richtypes import RichDict

rd = RichDict(a=1, b=2, c=3, d=4, e=5) # create a RichDict

rd.length # length of the dict
# 5


rd.first_item # first item of the dict
# {'a': 1}

rd.replace_key(old_key='a', new_key='r') # replace key
# {'b': 2, 'c': 3, 'd': 4, 'e': 5, 'r': 1}

Project details


Download files

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

Source Distribution

richtypes-0.0.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

richtypes-0.0.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file richtypes-0.0.1.tar.gz.

File metadata

  • Download URL: richtypes-0.0.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.5

File hashes

Hashes for richtypes-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ae71732832b485bf9fb37acfcf07b72e2c4cb89aa63a36210d89e7fddc7ae9f2
MD5 fdc986c9148ea4c5e266870a0b2f7f57
BLAKE2b-256 2c31eadb849c64d66636209e1f9d66bcad9bfa3ca7d37cadcd6a911fc784c0a6

See more details on using hashes here.

File details

Details for the file richtypes-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: richtypes-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.5

File hashes

Hashes for richtypes-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 88909a20cd478ee238bb5fb93734c5ee991f9ecc89695340d218ad477104b90e
MD5 308fd72772d40bf6a7e0f5e8b5aa519d
BLAKE2b-256 4a5fe1e8ce470edac2d8ba98f7cf3fcc0e13cb12176aa9c1dacda876c7775081

See more details on using hashes here.

Supported by

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