On Mon, Aug 8, 2011 at 11:32 AM, Terry Brown <[email protected]> wrote:
> On Mon, 8 Aug 2011 11:25:44 -0500
> Kent Tenney <[email protected]> wrote:
>
>> On Mon, Aug 8, 2011 at 9:27 AM, Kent Tenney <[email protected]> wrote:
>> > Howdy,
>> >
>> > Is there an easier way to get a node UNL than
>> > to iterate through parents?
>
> I'm not aware of one off the top of my head - I think UNLs are enjoying
> a surge or perhaps a resurgence in popularity, so perhaps this is
> something that would make sense.  p.UNL() seems like a good name to me,
> or p.unl().  p.u() would be confusing with v.u, the uA dict.

My first guess would probably be p.UNL()

What I came up with in the mean time:

def get_UNL(node):
    """Generate a Leo Universal Node Location for ``node``

    """

    # seed the UNL with this node
    parents = [node.h]
    parent = node.getParent()
    while True:
        if not parent:
            break
        parents.insert(0, parent.h)
        parent = parent.getParent()

    return "-->".join(parents)

>
> Cheers -Terry
>
> --
> You received this message because you are subscribed to the Google Groups 
> "leo-editor" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/leo-editor?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to