Pythonic: Difference between revisions

84 bytes added ,  20 May 2016
→‎Python Objects in Octave: add link to the bookmark
(→‎Python Objects in Octave: add link to the bookmark)
Line 131: Line 131:
* Seems like the relevant "pointer" is {{Codeline|id()}}.  Haven't seen yet how to access an object from its id, except that its a bad idea...
* Seems like the relevant "pointer" is {{Codeline|id()}}.  Haven't seen yet how to access an object from its id, except that its a bad idea...


* My plan to create a dict in Python, indexed by {{Codeline|id()}}, maybe called {{Codeline|__objects_in_octave__}}.  Then pass the id of the object (an int) to the {{Codeline|@pyobj/pyobj}} constructor.
* My plan to create a dict in Python, indexed by {{Codeline|hex(id(x))}}, maybe called {{Codeline|__InOct__}}.  Then pass the id of the object to the {{Codeline|@pyobj/pyobj}} constructor.
 
* Follow along and help out here: https://bitbucket.org/macdonald/pytave/commits/branch/cbm_pyobj


* Rejected idea: store the `repr` as a string in `x`.  But this makes a copy of the object rather than a reference to the original object.
* Rejected idea: store the `repr` as a string in `x`.  But this makes a copy of the object rather than a reference to the original object.
99

edits