Loading ...
Sorry, an error occurred while loading the content.

Re: patch: python buffer number

Expand Messages
  • Bram Moolenaar
    ... It s a simple thing to add. ... Shouldn t that be: - return Py_BuildValue( [ss] , name , number ); (no comma) -- I AM THANKFUL... ...for the piles of
    Message 1 of 3 , Oct 1, 2002
    • 0 Attachment
      Michal Vitecek wrote:

      > this little patch adds buffer number to a list of it's attribute
      > members. i found it useful in my script, perhaps it'll be useful for
      > someone else as well.
      >
      > example:
      >
      > :py import vim
      > :py cb = vim.current.buffer
      > :py print cb.number
      > :py print cb.__members__

      It's a simple thing to add.

      Comparing your patch to other places where Py_BuildValue() is used:

      > - return Py_BuildValue("[s,s]", "name", "number");

      Shouldn't that be:

      - return Py_BuildValue("[ss]", "name", "number");

      (no comma)

      --
      I AM THANKFUL...
      ...for the piles of laundry and ironing because it means I
      have plenty of clothes to wear.

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\
      \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
      \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
    • Michal Vitecek
      hello Bram, ... i ve read the documentation for Py_BuildValue() and both ways are supported, but it s probably better to use the version without comma to
      Message 2 of 3 , Oct 2, 2002
      • 0 Attachment
        hello Bram,

        Bram Moolenaar wrote:
        >Comparing your patch to other places where Py_BuildValue() is used:
        >
        >> - return Py_BuildValue("[s,s]", "name", "number");
        >
        >Shouldn't that be:
        >
        > - return Py_BuildValue("[ss]", "name", "number");
        >
        >(no comma)

        i've read the documentation for Py_BuildValue() and both ways are
        supported, but it's probably better to use the version without comma to
        correspond with other parts of the code.

        --
        fuf (fuf@...)
      Your message has been successfully submitted and would be delivered to recipients shortly.