Skip to content
campadrenalin edited this page Feb 14, 2012 · 8 revisions

ConcurrenTree.model.address

Address

A subclass of ConcurrenTree.model.ModelBase, which provides the function __str__ and the property hash, which are a strict string of the protocol representation and the checksum of the protocol representation, respectively.

Thanks to operator overloading, addresses can be combined in the following patterns:

* addr + addr = addr # prefixes or extends an address
* addr + instruction = instruction # prefixes an instruction address
* addr + operation = operation # prefixes all instructions in an op

In many cases you can use a regular Python list in the place of an Address, and it will be converted for you, for example in operator prefixing.

Methods:
* __init__(target) # accepts lists, Addresses, and JSON strings describing address lists
* resolve(tree) # Assuming tree is the root, return the node referenced by this address
* append(addr) # Extend this address with another address
* parse(list) # Extends internal list, with basic validity checking
* prepend(addr) # Prepend internal list
* proto() # Return protocol representation (list)

Python Library

Clone this wiki locally