473,320 Members | 1,930 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,320 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 746

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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.