Skip to main content

A Python 'Object List'. It's basically your standard python list that additionally lets you attach data to it that doesn't affect the actual list items itself.

Project description

oList

A Python 'Object List'. It's basically your standard python list that additionally lets you attach data to it that doesn't affect the actual list items itself.
Treat the oList as you would a normal list:
my_list = oList([-10,3,4,-11,7,14])
my_list.sort()
for list_item in my_list:
    print(str(list_item))

oList Methods:

oList.attach('data') # can be of any type
oList.get_attachments() # returns a list or the object itself if the attachments are only 1
oList.as_dict(_attachments=True) # returns a dict, access values being index, _attachment=True will add attachment data to the dict
oList.as_tuple() # returns tuple

Example Usage:

intel_list = oList([
    'i5-9600k',
    'i9-10910',
    'i9-10900K',
]).attach({
    'carrier': 'Intel',
    'description': 'A nice little list of some intel Cpus.'
})

ryzen_list = oList([
    'Ryzen 3 1200',
    'Ryzen 5 1400',
    'Ryzen 5 3600x'
]).attach({
    'carrier': 'AMD',
    'description': 'A nice little list of some Ryzen Cpus.'
})

cpu_list = oList([intel_list, ryzen_list]).attach('List of Intel and Ryzen Cpus')

# .... later on in the program ....

print("--- " + cpu_list.get_attachments() + " ---\n")

for cpus in cpu_list:
    print(cpus.get_attachments())
    for cpu in cpus:
        print(cpus.get_attachments()['carrier'] + ' - ' + cpu)
    print('')


# OUTPUT:
# --- List of Intel and Ryzen Cpus ---
#
# {'carrier': 'Intel', 'description': 'A nice little list of some intel Cpus.'}
# Intel - i5-9600k
# Intel - i9-10910
# Intel - i9-10900K
#
# {'carrier': 'AMD', 'description': 'A nice little list of some Ryzen Cpus.'}
# AMD - Ryzen 3 1200
# AMD - Ryzen 5 1400
# AMD - Ryzen 5 3600x

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

oList-0.0.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

oList-0.0.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oList-0.0.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for oList-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a914931edbe4d405cbb0bbaa6a3c8baaf0bd952b9d4c17ab452e8139501b0a88
MD5 bb76dc21730bea6829edd5007323d7df
BLAKE2b-256 6b94ef905fca079dad43f9945937f1c09f833eafba6a644e72a60e35519085aa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oList-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for oList-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 afcf94fa10388aa4c336c2756af40f95b55d267dc3af602a87629a5ecdf9942a
MD5 cf5e98229e84225ce4b52f793f8a7a96
BLAKE2b-256 cd566f0830f8908f057848d6615efe3a2af120c41a1c5e838a37f35c9f6af14f

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