473,409 Members | 2,056 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,409 software developers and data experts.

Help in Placing Object in Memory

I am newbie to Python...... i want to know something..........

can i place an object in disk instead of placing in Main Memory...?

If possible, can you please explain with some scripts...?

can two python script share a common object....?

Mar 27 '07 #1
6 1054
Clement wrote:
I am newbie to Python...... i want to know something..........

can i place an object in disk instead of placing in Main Memory...?
If possible, can you please explain with some scripts...?
See the module pickle and it's examples.
can two python script share a common object....?
What do you mean by that? They can both load a pickled object, yes. But they
can't share it as a at-runtime object, where changes in one script are
immediately are known to the other.

To do such a thing, look at pyro.

Diez
Mar 27 '07 #2
On Tue, 2007-03-27 at 16:49 +0200, Diez B. Roggisch wrote:
can two python script share a common object....?

What do you mean by that? They can both load a pickled object, yes. But they
can't share it as a at-runtime object, where changes in one script are
immediately are known to the other.
Remote procedure call, such as Python Twisted's PB library can allow
this to virtually be the case.
>
To do such a thing, look at pyro.

Diez
Mar 27 '07 #3

"Diez B. Roggisch" <de***@nospam.web.dewrote in message
news:56*************@mid.uni-berlin.de...
What do you mean by that? They can both load a pickled object, yes. But
they
can't share it as a at-runtime object, where changes in one script are
immediately are known to the other.

To do such a thing, look at pyro.
Or not natively (i.e., that battery isn't included). I believe it can
still be done, though: http://poshmodule.sourceforge.net/
(I haven't used the module - just used Google to locate it)

You could, of course, roll-your-own solution using shared memory and/or
other interprocess communication (http://docs.python.org/lib/ipc.html)

Hope that helps,
-ej
Mar 27 '07 #4
Clement a écrit :
I am newbie to Python......
To Python only, or to both Python and programming in general ?
i want to know something..........

can i place an object in disk instead of placing in Main Memory...?
You can store it on disk (cf pickles and friends), but to actually use
it you'll have to load it in memory anyway.
can two python script share a common object....?
While there are technical answers on this, I guess you'd better learn
how to use functions and pass objects between them.

My 2 cents.
Mar 27 '07 #5
On Mar 27, 10:33 am, "Clement" <jeba.r...@gmail.comwrote:
I am newbie to Python...... i want to know something..........

can i place an object in disk instead of placing in Main Memory...?

If possible, can you please explain with some scripts...?

can two python script share a common object....?

POSH allows shared objects, but it's not built-in. http://poshmodule.sourceforge.net/

If you're only looking for persistence (and not sharing), there's the
(standard) shelve module. http://docs.python.org/lib/module-shelve.html
If your need to share objects is fairly minimal and not performance-
sensitive, you might be able to get by with shelves, sync, and file
locking or some other locking.

Mar 27 '07 #6
"Clement" <je*******@gmail.comwrites:
I am newbie to Python...... i want to know something..........

can i place an object in disk instead of placing in Main Memory...?

If possible, can you please explain with some scripts...?

can two python script share a common object....?
For the CPU to use the object, it needs to be in RAM. But it is
possible to save the RAM image onto disk, and then bring it back
later. The common approach is called "pickling", though there are
several variants on this:

http://docs.python.org/lib/persistence.html
--
Harry George
PLM Engineering Architecture
Mar 27 '07 #7

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

Similar topics

5
by: Jeff Greenberg | last post by:
Not an experienced c++ programmer here and I've gotten myself a bit stuck. I'm trying to implement a class lib and I've run into a sticky problem that I can't solve. I'd appreciate any help that I...
10
by: gogogo_1001 | last post by:
Dear all, I don't understand why "delete" works well on destructing a object, but fails to destruct a vector of it. Any of your comment is highly appreciated! Following is the program...
6
by: Vijay | last post by:
I need to generate HTML files based on the some codes. One HTML file per code. I have the link (ex:http://123.234.345.456/WebPages/GetTestData.aspx?SomeCode=25), by passing the code as parameter I...
2
by: MyNameIsnt | last post by:
Can anyone tell me why, when I click on the buttons it register 2 characters on the display? if you use the right mousebutton it works ok, but the buttons dont flash?? it works fine without the...
7
by: Tina | last post by:
I have an asp project that has 144 aspx/ascx pages, most with large code-behind files. Recently my dev box has been straining and taking long times to reneder the pages in the dev environment. ...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
3
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here...
24
by: arcticool | last post by:
I had an interview today and I got destroyed :( The question was why have a stack and a heap? I could answer all the practical stuff like value types live on the stack, enums are on the stack, as...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
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:
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
Oralloy
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,...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.