On Thu, Jul 3, 2014 at 8:50 PM, 'Terry Brown' via leo-editor
<[email protected]> wrote:
> On Thu, 3 Jul 2014 18:30:32 -0500
> Kent Tenney <[email protected]> wrote:
>
>> p.gnx is not currently writable, would it be a big
>> deal to make it writeable? If not globally, for
>> @auto tree nodes?
>
> So wow, p.v.gnx is a property which only supports get, which is why you
> can't write to it, which wasn't a surprise. What is a surprise to me,
> it's not just returning a hidden variable, it's calling
> g.app.nodeIndices.toString(v.fileIndex), where v.fileIndex
> is a tuple like ('tbrown', '20140703203404', 26811)
> i.e. username, start of session timestamp, count of gnxs created in
> session.
There is a bit of history behind this. Iirc, earlier versions of
Leo's file format used a different gnx, so what you are seeing is the
detritus from the changeover.
Let's see how long p.gnx takes to execute. In any Leo node run:
import timeit
setup = 'gc.enable() ; import leo.core.leoNodes as n;
v = n.vnode(context=None) ; p = n.position(v)'
print(timeit.timeit(stmt='p.gnx',setup=setup))
On my slowish Windows machine I get values of around 2.2 (seconds).
Since the default for timeit.timeit is to run the code one million
times, p.gnx takes about 2.2 microseconds to execute.
> So it looks like making it writable would be a big deal.
It would be wrong to make it writable: gnx's are immutable. Perhaps I
am missing the point of this conversation.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.