How to use the ptype.pcontainer function in ptype

To help you get started, we’ve selected a few ptype examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arizvisa / syringe / lib / ptypes / parray.py View on Github external
'''base array element'''
import ptype,utils

class __parray_generic(ptype.pcontainer):
    '''provides the generic features expected out of an array'''
    def __contains__(self,v):
        for x in self.value:
            if x is v:
                return True
        return False

    def __len__(self):
        if not self.initialized:
            return int(self.length)
        return len(self.value)

    # XXX: update offsets (?)
    def insert(self, index, object):
        self.value.insert(index, object)