> Separately, I'm also curious about how to process big files. For example,
I
> was trying to play 100 million games of chutes & ladders
Without doing the 100,000,000, you could try either researching the nums,
or trying an algorithm that tried intervals, and narrowed down the best ,
and numerical
> Separately, I'm also curious about how to process big files. For example, I
> was trying to play 100 million games of chutes & ladders, and I crashed my
> machine, I believe: the game results, including 4 ints & 2 short lists of
> ints per game, are gathered into a list, so it can become a pretty
On Thu, Jan 2, 2014 at 4:15 AM, Keith Winston wrote:
> Thanks for all this Eryksun (and Mark!), but... I don't understand why you
> brought gdbm in? Is it something underlying shelve, or a better approach, or
> something else? That last part really puts me in a pickle, and I don't
> understand why
On Thu, Jan 02, 2014 at 04:15:06AM -0500, Keith Winston wrote:
> Separately, I'm also curious about how to process big files. For example, I
> was trying to play 100 million games of chutes & ladders, and I crashed my
> machine, I believe: the game results, including 4 ints & 2 short lists of
> in
Thanks for all this Eryksun (and Mark!), but... I don't understand why you
brought gdbm in? Is it something underlying shelve, or a better approach,
or something else? That last part really puts me in a pickle, and I don't
understand why.
Separately, I'm also curious about how to process big files
On Wed, Jan 1, 2014 at 11:43 AM, Keith Winston wrote:
> Thanks Danny, I don't understand the re-persisted part, but I'll look into
> it.
Shelf.close calls Shelf.sync to flush the cache. Here's what it does:
>>> print(inspect.getsource(shelve.Shelf.sync))
def sync(self):
i
On 01/01/2014 16:43, Keith Winston wrote:
Thanks Danny, I don't understand the re-persisted part, but I'll look
into it. I realized I hadn't done enough homework to justify a question
right after I sent the first half of that one! Happy New Year!
You do infinitely more work than some who pose
Thanks Danny, I don't understand the re-persisted part, but I'll look into
it. I realized I hadn't done enough homework to justify a question right
after I sent the first half of that one! Happy New Year!
___
Tutor maillist - Tutor@python.org
To unsubsc
On Tue, Dec 31, 2013 at 11:01 PM, Keith Winston wrote:
> I'm working my way slowly through Programming Python by Mark Lutz, and as an
> example of data persistence, he uses this example:
Ooops; the email got cut off a bit early. Can you try again?
___
According to:
http://docs.python.org/2/library/shelve.html
The shelve can be opened in 'writeback' mode, which I think might be
relevant to your question.
"By default modified objects are written only when assigned to the
shelf (see Example). If the optional writebackparameter is set to
True,
So sorry, I hit return: here's the example:
import shelve
db = shelve.open('class-shelve')
sue = db['sue']
sue.giveRaise(.25)
db['sue'] = sue
tom = db['tom']
tom.giveRaise(.20)
db['tom'] = tom
db.close()
Is it possible to dispense with the assignment/reassignment and just use
(open shelve)
db[
I'm working my way slowly through Programming Python by Mark Lutz, and as
an example of data persistence, he uses this example:
--
Keith
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mail
Ok, I see that is was the directory restriction that was the problem. Sorry
for the simple question.
Randy Raymond
From: Randy Raymond
Sent: Thursday, February 11, 2010 10:09 AM
To: Tutor Python
Subject: [Tutor] Shelve
I am running Python 2.6.4 under Windows Vista 32-bit Home Edition
On do, 2010-02-11 at 10:09 -0600, Randy Raymond wrote:
> I am running Python 2.6.4 under Windows Vista 32-bit Home Edition.
> When I run:
>
> import shelve
> test=shelve.open("myTest.fil")
And to shich directory does this file get written? I suspect you are
writing to a protected directory. When
I am running Python 2.6.4 under Windows Vista 32-bit Home Edition. When I run:
import shelve
test=shelve.open("myTest.fil")
I get a DCPermissionerror exception. I am an administrator on this machine (it
is my home PC). Python and Pythonw are both allowed exceptions to the Windows
firewall.
Timo wrote:
Emile van Sebille schreef:
Timo wrote:
# Results file
import shelve
def read_result(person):
results = []
s = shelve.open(RESULTFILE)
try:
results = s[person]
Maybe passing this out prevents s from being garbage collected?
What do you mean by passing out?
Emile van Sebille schreef:
Timo wrote:
# Results file
import shelve
def read_result(person):
results = []
s = shelve.open(RESULTFILE)
try:
results = s[person]
Maybe passing this out prevents s from being garbage collected?
What do you mean by passing out?
I also tried
Timo wrote:
# Results file
import shelve
def read_result(person):
results = []
s = shelve.open(RESULTFILE)
try:
results = s[person]
Maybe passing this out prevents s from being garbage collected?
Emile
except KeyError:
#print "No results for this person"
Hello, I have a PyGTK application where the user is able to click on a
button, then a new dialog pops up with a treeview and the program fills
this view with data from a shelve.
Everything works, the data is being added to the treeview. The only
problem is, that when I close the dialog, it doesn
Kent Johnson schreef:
On Tue, Mar 3, 2009 at 12:18 PM, Timo wrote:
Hello all, I'm using the Shelve module to store dictionaries in a list as a
value of a key.
So:
key = [{'keyA' : 1, 'keyB' : 2}, {'key1' : 1, 'key2' : 2}]
The problem is I can't remove a dictionary from the list.
import
On Tue, Mar 3, 2009 at 12:18 PM, Timo wrote:
> Hello all, I'm using the Shelve module to store dictionaries in a list as a
> value of a key.
>
> So:
>
> key = [{'keyA' : 1, 'keyB' : 2}, {'key1' : 1, 'key2' : 2}]
>
> The problem is I can't remove a dictionary from the list.
>
>
> import shelve
>
>
Hello all, I'm using the Shelve module to store dictionaries in a list
as a value of a key.
So:
key = [{'keyA' : 1, 'keyB' : 2}, {'key1' : 1, 'key2' : 2}]
The problem is I can't remove a dictionary from the list.
import shelve
s = shelve.open('file')
try:
for index, value in enumerate(s[
On Wed, 8 Aug 2007, TheSarge wrote:
> I have five data files, that are used to build a database.
>
> 1.txt
> 2.txt
> 3.txt
> 4.text
> 5.txt
>
> I want to build a database using a persistent dictionary (shelve).
>
> The specifications are that the key for each dictionary keyword pair, is the
> l
I have five data files, that are used to build a database.
1.txt
2.txt
3.txt
4.text
5.txt
I want to build a database using a persistent dictionary (shelve).
The specifications are that the key for each dictionary keyword pair, is the
lefthand side
value of the # sign, and the corresponding val
Andreas Kostyrka wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
>
>
> Eric Brunson wrote:
>
>> On Sat, July 28, 2007 4:01 am, Thorsten Kampe wrote:
>>
>>> * Kent Johnson (Fri, 27 Jul 2007 08:06:33 -0400)
>>>
>>>
Barton David wrote:
> *sigh* I'm
"Eric Brunson" <[EMAIL PROTECTED]> wrote
> On Sat, July 28, 2007 4:01 am, Thorsten Kampe wrote:
>>> In what way is it Python's fault that the dbm database doesn't
>>> reclaim
>>> disk space?
>>
>> It's actually how most databases work. Even a simple Outlook pst
>> file
>> (which is a database, t
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Eric Brunson wrote:
> On Sat, July 28, 2007 4:01 am, Thorsten Kampe wrote:
>> * Kent Johnson (Fri, 27 Jul 2007 08:06:33 -0400)
>>
>>> Barton David wrote:
>>>
*sigh* I'm really going off Python.
>>> In what way is it Python's fault that the
On Sat, July 28, 2007 4:01 am, Thorsten Kampe wrote:
> * Kent Johnson (Fri, 27 Jul 2007 08:06:33 -0400)
>
>> Barton David wrote:
>>
>>> *sigh* I'm really going off Python.
>>>
>>
>> In what way is it Python's fault that the dbm database doesn't reclaim
>> disk space?
>
> It's actually how most data
* Kent Johnson (Fri, 27 Jul 2007 08:06:33 -0400)
> Barton David wrote:
> > *sigh* I'm really going off Python.
>
> In what way is it Python's fault that the dbm database doesn't reclaim
> disk space?
It's actually how most databases work. Even a simple Outlook pst file
(which is a database, too
Alan Gauld wrote:
> "Andreas Kostyrka" <[EMAIL PROTECTED]> wrote
>
>
>>> a lot to build the Tacoma Narrows bridge... Similarly you don't
>>> need
>>> much math to build a GUI friont end to a database, but you need
>>>
>> I would question even that one can write a good GUI frontend to a
>
"Andreas Kostyrka" <[EMAIL PROTECTED]> wrote
>> a lot to build the Tacoma Narrows bridge... Similarly you don't
>> need
>> much math to build a GUI friont end to a database, but you need
>
> I would question even that one can write a good GUI frontend to a
> database without the theory behind it.
Andreas Kostyrka wrote:
> Believe me, the Python developers are sure listening. Only that
> "cleaning up the mess" has associated costs, that are usually not
> acceptable. If it comes to "not breaking existing programs" or "cleaning
> up the stdlib so it's nicer", "not breaking existing programs"
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Barton David wrote:
> Eric Brunson wrote:
>> You seem like a smart guy that's having a bad day, so I'm cutting you
>> slack.
>
> Thanks Eric. Yes I did indeed have a bad day (and it got much much worse),
> and this is most definitely a case of a ba
Python is like democracy. It isn't perfect, but it's the best thing
come up with so far. ;-)
Barton David wrote:
> Eric Brunson wrote:
> > You seem like a smart guy that's having a bad day, so I'm cutting you
> > slack.
>
> Thanks Eric. Yes I did indeed have a bad day (and it got much much
Eric Brunson wrote:
> You seem like a smart guy that's having a bad day, so I'm cutting you
> slack.
Thanks Eric. Yes I did indeed have a bad day (and it got much much worse),
and this is most definitely a case of a bad workman blaming his tools. I
apologise to all concerned for voicing my frustr
>> cPickle/Pickle question is AFAIR documented,
>
> But not in a manner totally clear to a newbie. An experienced
> programmer will figure out that a C implementation is faster but
> what does that meabn when your only reference is a few weeks
> of Python? And why is there two modules if one is bet
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Alan Gauld wrote:
> "Andreas Kostyrka" <[EMAIL PROTECTED]> wrote
>
>> was, that the only way to have more math courses would be to study
>> something with mathematics in the title *g*)
>
> Thats true of most engineering courses.
> Although I studie
"Andreas Kostyrka" <[EMAIL PROTECTED]> wrote
> was, that the only way to have more math courses would be to study
> something with mathematics in the title *g*)
Thats true of most engineering courses.
Although I studied Electrical engineering the only compulsory subject
for each of the 5 years(i
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Alan Gauld wrote:
> "Tiger12506" <[EMAIL PROTECTED]> wrote
>
>> Some people need degrees, most people don't. It all depends on what
>> they are
>> capable of understanding.
>
> It also depends what they are doing.
> Most programmers don't build c
One thing I don't think people realize, or at least don't talk about
often enough, is that good programming, like good art, takes talent.
I can draw a cat to make my 2yo happy or sketch my house well enough
that someone could pick it out driving down the street, but if I paint
every day for th
"Tiger12506" <[EMAIL PROTECTED]> wrote
> Some people need degrees, most people don't. It all depends on what
> they are
> capable of understanding.
It also depends what they are doing.
Most programmers don't build complex state machines, nor do they
build safety critical systems. 90% or more of
"Eric Brunson" <[EMAIL PROTECTED]> wrote
>> newbie-friendly. My only complaint is that I'm starting to feel
>> like I
>> won't get much further than that without a computer science degree.
>
> I'll disagree with you on that, if you can get a PhD in genetics
> then
> programming should be a snap.
"Eric Brunson" <[EMAIL PROTECTED]> wrote
> It seems like new programmers today expect to be spoonfed their
> information like they were in grammar school.
I think its true they expect a lot of tutorial stuff, probably because
of the number of idiot guides to programming in languages like
VB/PHP e
"Barton David" <[EMAIL PROTECTED]> wrote
> I've learned to program with Python (and can hardly conceive of a
> better
> language to be honest)- and I still think the core language is
> great:
> elegant, easy to use and brilliantly documented.
Completely agree.
> But the more I explore the stan
> ...some credit. I taught myself to program, from scratch, without access
> to (or time for) any courses whatsoever... 5 years now...core
> language...certain standard modules pretty well... complaint...won't get
> much further...without a computer science degree.
Wow. I'm so *shocked*.
Most p
Barton David wrote:
>
> *Eric Brunson* wrote:
>
> > It seems like new programmers today expect to be spoonfed their
> > information like they were in grammar school. They don't know what it
> > is to hack a Makefile to get a package to compile or break out an
> RFC to
> > understand a protocol.
Eric Brunson wrote:
> It seems like new programmers today expect to be spoonfed their
> information like they were in grammar school. They don't know what it
> is to hack a Makefile to get a package to compile or break out an RFC to
> understand a protocol. If you don't understand something a
the
code you'd have to read is just more Python, anyway.
Just me being a grouchy old programmer. In my day we had to program in
4 feet of snow, uphill... both ways!
> Andreas
>
>
>>
>>
>> -Original Message-
>> From: Kent Johnson [mailto:[EMAIL
Andreas Kostyrka wrote:
> Additionally, the language core is very very thought out, with glacial
> enhancements. "Fixing" the standard library OTOH would involve
renaming
> and removing names, which would make huge collections of programs
break.
> Not a good thing :(
Yes agreed. My comments there
once seemed to aspired to.
>
>
>
> -Original Message-
> From: Kent Johnson [mailto:[EMAIL PROTECTED]
> Sent: 27 July 2007 14:11
> To: Barton David
> Cc: tutor@python.org
> Subject: Re: [Tutor] Shelve del not reducing file size
>
> If it's any sol
d involve renaming
and removing names, which would make huge collections of programs break.
Not a good thing :(
Andreas
I know no language that beats this pattern.
>
>
>
> -Original Message-----
> From: Kent Johnson [mailto:[EMAIL PROTECTED]
> Sent: 27 July 2007 14:11
>
27;friendliness' it once seemed to aspired to.
-Original Message-
From: Kent Johnson [mailto:[EMAIL PROTECTED]
Sent: 27 July 2007 14:11
To: Barton David
Cc: tutor@python.org
Subject: Re: [Tutor] Shelve del not reducing file size
If it's any solace, there is a small minority of Pyth
reas
>
>
> -Original Message-
> From: Kent Johnson [mailto:[EMAIL PROTECTED]
> Sent: 27 July 2007 13:07
> To: Barton David
> Cc: tutor@python.org
> Subject: Re: [Tutor] Shelve del not reducing file size
>
> Barton David wrote:
>> *sigh* I'm r
;
> I guess it's not Python's fault: I'm guess I'm just too stupid. But I'm
> just getting really disenchanted. Sorry.
>
>
> -Original Message-
> From: Kent Johnson [mailto:[EMAIL PROTECTED]
> Sent: 27 July 2007 13:07
> To: Barton Dav
too stupid. But I'm
just getting really disenchanted. Sorry.
-Original Message-
From: Kent Johnson [mailto:[EMAIL PROTECTED]
Sent: 27 July 2007 13:07
To: Barton David
Cc: tutor@python.org
Subject: Re: [Tutor] Shelve del not reducing file size
Barton David wrote:
> *sigh* I'm really
Barton David wrote:
> *sigh* I'm really going off Python.
In what way is it Python's fault that the dbm database doesn't reclaim
disk space?
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
*sigh* I'm really going off Python.
OK, thanks Andreas.
This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University o
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
That's in the nature of the underlying database library used for the
shelve. Most dbm implemention on Unix are using a sparse file that is
used as hashmap. E.g. compare ls -l versus du of the database file.
Now if this is the case, there is no way (wi
Hi,
I've hit a snag with Python's shelve module. By way of example...
_
from shelve import DbfilenameShelf as StoreFile
import os
sf=StoreFile("mytest.db",writeback=False) # but same problem if
writeback=True
for i in range(1):
sf[str(i)]="TESTOBJECT"
sf.sync()
print len(sf)
sf.cl
59 matches
Mail list logo