Buffer objects

Discussion in 'Python' started by Tom Harris, Sep 1, 2008.

  1. Tom Harris

    Tom Harris Guest

    Greetings,

    I need a little help with buffer objects. Many Python objects export
    the buffer interface, or can be persuaded to create a buffer object
    with a buffer() call.

    First question, the buffer() function appears very quick. Does it just
    wrap the internal pointer and then exit?

    Second question, the buffer interface does include support for
    multiple segments of memory. All the buffers I have examined are only
    a single segment, is this a rarely used functionality?

    Third question, having got my buffer interface I want to get the
    actual pointer out so that I can call foreign functions with ctypes
    with the pointer as a function argument and add offsets to it, so I
    would like it as a plain int. What is the recommended method of
    accessing the raw pointer from the buffer object?

    It must be me but I have found the whole buffer thing difficult to
    understand from the docs, it appears only useful to C coders, but I
    use the buffer interface (GetData()) of wx.Image objects a lot in my
    work.

    TomH celephicus(AT)gmail(DOT)com
     
    Tom Harris, Sep 1, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raja
    Replies:
    12
    Views:
    24,411
    John Harrison
    Jun 21, 2004
  2. 7stud
    Replies:
    11
    Views:
    700
    Dennis Lee Bieber
    Mar 20, 2007
  3. Replies:
    2
    Views:
    607
    sergejusz
    Mar 26, 2007
  4. Neal Becker

    buffer creates only read-only buffer?

    Neal Becker, Jan 8, 2009, in forum: Python
    Replies:
    0
    Views:
    415
    Neal Becker
    Jan 8, 2009
  5. xingye
    Replies:
    9
    Views:
    276
    Michael Lu
    Apr 19, 2004
Loading...

Share This Page