473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Re: Python String Immutability Broken!


"Simon Brunning":
>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 - don't.
Thanks for the link.

Any advice on what to do or use as an I/O structure for dissemination?
Ken Seehart:

8<----------- using ctypes to make 1+14 = 10 ------------------
>I love ctypes. So cool. It's not supposed to be safe.
And here I thought I was weird…
Life is either a daring adventure or nothing. Security does not
exist in nature, nor do the children of men as a whole experience
it. Avoiding danger is no safer in the long run than exposure.
*Helen Keller <http://www.quotationspage.com/quotes/Helen_Keller/>*
/US blind & deaf educator (1880 - 1968)/

Of course I would not hire anyone who believes this quote, other than
Helen Keller, if she were still with us.
Why not? – as I see it, the Keller quote states the literal truth of
the matter – we all live under an illusion of security – but then
that might just be because I am South African, and the country is
run by cattle thieves.
>It is quite possible to write a small program that works using abused
strings. But my life better not depend on it. Among other things, if
you use the abused string as a key anywhere, you will not get correct
results. Trying to change the length of the string will cause
disasters. Lengthening a string will corrupt memory, and shortening the
string will not shorten it but rather embed '\0' in it.
Understood. – remember I am using it as a kind of array of “pseudoports”
- memory representations of what goes on on wires on the outside.

So only a real madman would try to impute the kind of cross bit
correlation needed to use the bunch of bits as a key. The length would
be fixed, governed by the existence of real hardware on the outside.

Ken Seehart again:
>Yes, there is a better way. Use a character array instead of a string.
The original reason I used a string directly instead of array.array was
to try to skip the serialisation step when disseminating the information
via sockets.

As you can appreciate, this is all “hot stuff” as it represents said
wire states, and is of interest system wide.

So lets explore this further – lets say I use two arrays – one to
represent the stuff that must be output, and one to represent the
latest inputs read.

Then, I think, first prize would be the ability to “publish” that
information as a shared memory block, that can be accessed by other
python processes. Then it will be possible to a priori “chop up
the ownership” of the various bits, so that a process can simply
monitor the bits of interest to it, setting or clearing the bits
of the outputs it is responsible for. In this way the work could
be divided amongst many processes.

Then, on a periodic basis, the I/O would be done, much like one
would do it in an embedded system using an interrupt driven ticker
routine.

That would be really cool.

Does anybody know how to get such memory sharing done in Python?
(Linux only)

- Hendrik

Aug 26 '08 #1
0 748

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: KefX | last post by:
I've been following the group a bit (somewhat loosely; discussions involving other languages or advanced concepts kind of lose me), and I see all this negativity (OMG Python's lambda is borken...
105
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...
3
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...
267
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...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 380 open (-36) / 3658 closed (+65) / 4038 total (+29) Bugs : 965 open ( -9) / 6555 closed (+35) / 7520 total (+26) RFE : 272 open...
0
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,...
0
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...
0
by: Hendrik van Rooyen | last post by:
"Gabriel Genellina": Thanks Gabriel – looks like I really have to spend more time with that excellent document. Patrick Maupin:
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.