On Tue, Dec 31, 2019 at 3:48 AM Ernie Rael <[email protected]> wrote:
>
> On 12/30/2019 6:42 PM, Tony Mechelynck wrote:
> > On Tue, Dec 31, 2019 at 3:31 AM Ernie Rael <[email protected]> wrote:
> >> On 12/29/2019 6:11 PM, Ernie Rael wrote:root
> >>>  From python, is it *always* true that "vim.buffer[i].number == i" ?
> >>>
> >>> -ernie
> >>>
> >> I've convinced myself that this is true. The docs say
> >>
> >>      A mapping object providing access to the list of vim buffers.
> >>      ...
> >>      b.number    Buffer number. Can be used as |python-buffers| key.
> >>
> >> and the python interface code uses
> >>
> >>      b = buflist_findnr((int) bnr);
> >>
> >> -ernie
> > To test if it is really _always_ true, test it with invalid values,
> > for instance -1 or 9999.
> >
> > Best regards,
> > Tony.
> >
> I used bwipe as well as some plain invalid numbers. Invalid numbers
> generate errors from vim, so the test couldn't complete; the function
> wouldn't collapse and I guess it's both true and false :-)
>
> -ernie
>
In that case I guess you could put that statement inside a Python
try..except construct and catch the appropriate vim.error

Best regards,
Tony.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAJkCKXt6LCC2%3DOM3Zxa50CL5v%2Bgrfhrh7K7NR4F1Rm8k3V%3D_5A%40mail.gmail.com.

Raspunde prin e-mail lui