Skip to main content

A module that multiplexes interactions with lists of python objects.

Project description

Mulpyplexer is a piece of code that can multiplex interactions with lists of python objects. It’s easier to show you:

import mulpyplexer

class A:
def __init__(self, i):

self.i = i

def add(self, j):

return A(self.i + (j.i if isinstance(j, A) else j))

def sub(self, j):

return A(self.i - (j.i if isinstance(j, A) else j))

def __repr__(self):

return “<A %d>” % self.i

def str(self):

return str(self.i)

def __eq__(self, o):

return self.i == o.i

one = mulpyplexer.MP([ A(10), A(20), A(30) ])

two = one.add(5) assert two.mp_items == [ A(15), A(25), A(35) ]

three = two.sub(10) assert three.mp_items == [ A(5), A(15), A(25) ]

four = three.add(one) assert four.mp_items == [ A(15), A(35), A(55) ]

five = four.str() assert five.mp_items == [ “15”, “35”, “55” ]

six = four.i assert six.mp_items == [ 15, 35, 55 ]

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

mulpyplexer-0.02.tar.gz (1.5 kB view details)

Uploaded Source

File details

Details for the file mulpyplexer-0.02.tar.gz.

File metadata

  • Download URL: mulpyplexer-0.02.tar.gz
  • Upload date:
  • Size: 1.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mulpyplexer-0.02.tar.gz
Algorithm Hash digest
SHA256 4227fe19fe8bca83b2592c6857d44b883a23abb79ca807243335f08156e4d9ce
MD5 5d549c42d1d3c4f41cc4621e7ca03b82
BLAKE2b-256 fb70416d72f7ee237d4922d534b611f29f126423997ce53b23c43b72897f7e8e

See more details on using hashes here.

Provenance

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