Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First - I am assuming you are just trying to do this in pure python rather than in a c extension. So I am assuming you have loaded in the different records you are interested in into a set of python objects and your problem is that you want to see the higher level structure that is spread across these objects with bits here and there throughout the objects.</p> <p>So can you not simply load each of the records into a byte arrays type? You can then use python slicing of arrays to create a new array that has just the data for the high level structure you are interested in. You will then have a single byte array with just the data you are interested in and can print it out or manipulate it in any way that you want to.</p> <p>So something like:</p> <pre><code>a = bytearray(b"Hello World") # put your records into byte arrays like this b = bytearray(b"Stack Overflow") complexStructure = bytearray(a[0:6]+b[0:]) # Slice and join arrays to form # new array with just data from your # high level entity print complexStructure </code></pre> <p>Of course you will still ned to know where within the records your high level structure is to slice the arrays correctly but you would need to know this anyway.</p> <p><strong>EDIT</strong>:</p> <p>Note taking a slice of a list does not copy the data in the list it just creates a new set of references to the data so:</p> <pre><code>&gt;&gt;&gt; a = [1,2,3] &gt;&gt;&gt; b = a[1:3] &gt;&gt;&gt; id(a[1]) 140268972083088 &gt;&gt;&gt; id(b[0]) 140268972083088 </code></pre> <p>However changes to the list b will not change a as b is a new list. To have the changes automatically change in the original list you would need to make a more complicated object that contained the lists to the original records and hid them in such a way as to be able to decide which list and which element of a list to change or view when a user look to modify/view the complex structure. So something like:</p> <pre><code>class ComplexStructure(): def add_records(self,record): self.listofrecords.append(record) def get_value(self,position): listnum,posinlist = ... # formula to figure out which list and where in # list element of complex structure is return self.listofrecords[listnum][record] def set_value(self,position,value): listnum,posinlist = ... # formula to figure out which list and where in # list element of complex structure is self.listofrecords[listnum][record] = value </code></pre> <p>Granted this is not the simple way of doing things you were hoping for but it should do what you need.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload