On Wed, 7 Jan 2009 20:21:55 -0600
Terry Brown <[email protected]> wrote:

> 
> On Wed, 7 Jan 2009 17:53:30 -0600
> "Edward K. Ream" <[email protected]> wrote:
> 
> > > Is it ok to change it by adding
> > >
> > >    if not stack:
> > >        return None
> > >
> > > just before v,n = stack.pop()?  
> > 
> > No.  Top-level positions can have an empty stack.
> > 
> > The following tests are the recommend way to test p.v::
> 
> Ok, but I want to pass vnodes to c.vnode2position for which there is
> no position - of course I don't know that, I want c.vnode2position to
> tell me that.  At the moment I'd have to catch an AssertionError,
> which seems silly.  How about changing
> 
>   assert c.positionExists(p)
> 
> to
> 
>   if not c.positionExists(p):
>       return None

Ok, so now I'm confused.  I made the second change, but of course the
first issue is getting the way.  If stack is empty stack.pop() will
always raise an exception.  So my goal is for this function to return a
useful response when there's no position in c for the vnode.  Can you
explain again what's wrong with the if not stack: return None approach?

Thanks,
Terry


> ?
> 
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to