Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6869531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:34:09+00:00 2026-05-27T03:34:09+00:00

How can I do a fast reset for a continue set of values inside

  • 0

How can I do a fast reset for a continue set of values inside a Python buffer object?

Mainly I am looking for a memset 🙂

PS. The solution should work with Python 2.5 and modify the buffer itself (no copy).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:34:10+00:00Added an answer on May 27, 2026 at 3:34 am

    The ctypes package has a memset function built right in. Ctypes does work with Python 2.5, but is not included by default. You will need a separate install.

    def memsetObject(bufferObject):
        "Note, dangerous"
        import ctypes
        data = ctypes.POINTER(ctypes.c_char)()
        size = ctypes.c_int()  # Note, int only valid for python 2.5
        ctypes.pythonapi.PyObject_AsCharBuffer(ctypes.py_object(bufferObject), ctypes.pointer(data), ctypes.pointer(size))
        ctypes.memset(data, 0, size.value)
    
    testObject = "sneakyctypes"
    memsetObject(testObject)
    print repr(testObject)
    # '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

MongoDB is fast, but only when your working set or index can fit into
using Fast CGI I can't get it to read the php.ini file. See my
Can someone suggest a fast 2 way encryption algorithm for long ints? My candidates
It seems fast, what could be its compression level? Can it be changed? I'm
How can i manage user permission? i need a fast method to manage users
is there a fast algorithm, similar to power of 2, which can be used
I'm trying to read the following Xml document as fast as I can and
DataGridView.CellContentClick is not firing if I mouse click a DataGridViewCheckBoxCell very fast. How can
A pleasant user experience requires a page to load very fast. This can be
using RewriteCond or similar mechanism on apache, can i change how fast content is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.