Sujet : Re: Top 10 most common hard skills listed on resumes...
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 28. Aug 2024, 06:45:01
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vamdgt$3c4ke$5@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Pan/0.160 (Toresk; )
On Wed, 28 Aug 2024 01:28:22 +0100, Bart wrote:
On 28/08/2024 00:53, Lawrence D'Oliveiro wrote:
>
On Tue, 27 Aug 2024 09:44:40 +0200, David Brown wrote:
Python does not support any significant degree of low-level
programming.
>
A key example of low-level programming is control of hardware, which
on most systems means accessing memory-mapped registers at specific
addresses, reading and writing in specific orders. Python has no
means to do any of that - C and C++ both provide this ability.
I’ve got news for you: this kind of thing is perfectly doable in Python
<https://docs.python.org/3/library/ctypes.html>.
It's Python calling a special module to do the dirty work.
It’s a standard Python module. It uses standard Python constructs like
“«n» * «type»” to construct an array of «n» elements of «type». I/O to/
from those objects are done using something called the “Buffer Protocol”,
which is a core part of how Python works.
I previously showed you how Python can even do low-level type
discrimination at runtime -- try doing that with C. Maybe time to add the
capability to C to call external Python modules, for help with this?
“#include <pytypes.h>", anybody?
That's not far removed from Python just invoking an external C program
to do the job.
But it is removed.
And note that there is nothing in the C spec to require that C cannot do
it that way as well. So don’t confuse implementation details with
fundamental language characteristics.
By contrast, my scripting language can directly do the low level stuff.
But it couldn’t do the dynamic type casting, could it?