"Gabriel Genellina":
>To avoid altering the equilibrium of the whole universe, use ctypes.create_string_buffer: http://python.net/crew/theller/ctype...tal-data-types
Thanks Gabriel – looks like I really have to spend more time with that
excellent document.
Patrick Maupin:
>Whenever I do low-level stuff like this, I'm in one of two modes:
Mode #1: I'm using somebody else's C library and the overhead of doing so is small.
Mode #2: I need to code my own low-level stuff (for speed, IO access, whatever).
This seems to be where I am at.
> In mode 1, I try not to break out a compiler. ctypes is great for this, and the results are "pure python" to the extent that you can give pure python to someone else with the same C library, and it will work. No muss, no fuss, no makefile, no question that ctypes is awesome stuff.
In mode 2, I have to break out a compiler. I almost never do this without ALSO breaking out Pyrex. Pyrex is also awesome stuff, and in Pyrex, you can easily create a (new) Python string for your results without having to worry about reference counting or any other really nasty low level interpreter details. You can code a lot of stuff in pure Pyrex, and you can easily mix and match Pyrex and C.
Pyrex and ctypes are both tools which let me connect to non-Python code without having to remember to handle Python interpreter internals correctly. If I can get by with ctypes, I do, but if I actually have to code in something other than Python to get the job done, I bypass ctypes and go straight for Pyrex.
Don’t know anything about Pyrex except that it is not in the
standard library on Suse – will try to read up on it. Thanks.
Terry Reedy: http://python.net/crew/theller/ctype...al.html#arrays
>Which essentially is the bytearray type of 3.0.
How does it differ from plain old array.array(b,”The quick brown fox”)?
- Hendrik 0 1204 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Peter Hickman |
last post by:
Well after all this discussion it would appear that a 'Python like'
language has appeared => Prothon. http://www.prothon.org/index.html
Very alpha, sort of like Python (if you consider the...
|
by: Peter Otten |
last post by:
QOTW: "try...except and try...finally are really two completely different
statements with different purposes." - Carl Banks
"Zope and ZODB do incredibly complex stuff as side effects in what...
|
by: Terry Hancock |
last post by:
Is there an *easy* way to make an object immutable in
python? Or perhaps I should say "one obvious way to do it"?
Oughtn't there to be one?
I've found a thread on how to do this, which...
|
by: Xah Lee |
last post by:
Python, Lambda, and Guido van Rossum
Xah Lee, 2006-05-05
In this post, i'd like to deconstruct one of Guido's recent blog about
lambda in Python.
In Guido's blog written in 2006-02-10 at...
|
by: C.L. |
last post by:
I was looking for a function or method that would return the index to the first
matching element in a list. Coming from a C++ STL background, I thought it might
be called "find". My first stop was...
|
by: Roy Smith |
last post by:
In article <mailman.2119.1219612653.922.python-list@python.org>,
"Hendrik van Rooyen" <mail@microcorp.co.zawrote:
Reminds me of that great old song from "Saturday Night Hacker":
Oh, oh, oh,...
|
by: Simon Brunning |
last post by:
2008/8/25 Hendrik van Rooyen <mail@microcorp.co.za>:
You can indeed use ctypes to modify the value of a string - see
<http://tinyurl.com/5hcnwl>. You can use it to crash the OS, too.
My advice...
|
by: Lie |
last post by:
On Oct 11, 5:27 am, "Hendrik van Rooyen" <m...@microcorp.co.zawrote:
Not necessarily. You've mentioned two ways.
PS: Umm, a little bit off note: set is a built-in name, I'm a little
confused...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |