Re: [Tutor] Tutor Digest, Vol 104, Issue 65

2012-10-16 Thread Osemeka Osuagwu
On Tue, 16 Oct 2012 10:30:54 +0100 Alan Gauld wrote > > Yes but then it wouldn't be OOP. You'd be back in the world of > traditional procedural programming passing explicit data references > around. Its much better to make it an instance method with the self > reference being passed implicitly >

Re: [Tutor] CSV -> sqlite tables with foreign keys

2012-10-16 Thread Hugo Arts
On Wed, Oct 17, 2012 at 5:59 AM, Monte Milanuk wrote: > Hello, > > I'm working on a python script to take the sql script, create a sqlite3 > database, create the tables, and then populate them using the info from the > csv file. > The sticking point seems to be creating the foreign keys between t

Re: [Tutor] managing memory large dictionaries in python

2012-10-16 Thread Abhishek Pratap
On Tue, Oct 16, 2012 at 7:22 PM, Alexander wrote: > On Tue, Oct 16, 2012 at 20:43 EST, Mark Lawrence > wrote: >> For the record Access is not a database, or so some geezer called Alex >> Martelli reckons http://code.activestate.com/lists/python-list/48130/, so >> please don't shoot the messenger:

[Tutor] CSV -> sqlite tables with foreign keys

2012-10-16 Thread Monte Milanuk
Hello, I'm working on a python script to take the sql script, create a sqlite3 database, create the tables, and then populate them using the info from the csv file. The sticking point seems to be creating the foreign keys between the tables I've got a data file with lines like this: "John","G.",

Re: [Tutor] managing memory large dictionaries in python

2012-10-16 Thread Alexander
On Tue, Oct 16, 2012 at 20:43 EST, Mark Lawrence wrote: > For the record Access is not a database, or so some geezer called Alex > Martelli reckons http://code.activestate.com/lists/python-list/48130/, so > please don't shoot the messenger:) > Cheers. > Mark Lawrence. Mark I don't believe your re

Re: [Tutor] managing memory large dictionaries in python

2012-10-16 Thread Mark Lawrence
On 17/10/2012 01:03, Alan Gauld wrote: You just need to set it up, load the data and use it - probably around 50 lines of SQL... And you don't need anything fancy for a single table database - Access, SQLite, even FoxPro... For the record Access is not a database, or so some geezer called Al

Re: [Tutor] managing memory large dictionaries in python

2012-10-16 Thread Alan Gauld
On 16/10/12 17:57, Abhishek Pratap wrote: For my problem I need to store 400-800 million 20 characters keys in a dictionary and do counting. This data structure takes about 60-100 Gb of RAM. Thats a lot of records but without details of what kind of counting you plan on we can't give specific

Re: [Tutor] managing memory large dictionaries in python

2012-10-16 Thread Oscar Benjamin
On 16 October 2012 21:03, Prasad, Ramit wrote: > Abhishek Pratap wrote: >> Sent: Tuesday, October 16, 2012 11:57 AM >> To: tutor@python.org >> Subject: [Tutor] managing memory large dictionaries in python >> >> Hi Guys >> >> For my problem I need to store 400-800 million 20 characters keys in a >>

Re: [Tutor] managing memory large dictionaries in python

2012-10-16 Thread emile
On 10/16/2012 01:03 PM, Prasad, Ramit wrote: Abhishek Pratap wrote: Sent: Tuesday, October 16, 2012 11:57 AM To: tutor@python.org Subject: [Tutor] managing memory large dictionaries in python Hi Guys For my problem I need to store 400-800 million 20 characters keys in a dictionary and do count

Re: [Tutor] managing memory large dictionaries in python

2012-10-16 Thread Prasad, Ramit
Abhishek Pratap wrote: > Sent: Tuesday, October 16, 2012 11:57 AM > To: tutor@python.org > Subject: [Tutor] managing memory large dictionaries in python > > Hi Guys > > For my problem I need to store 400-800 million 20 characters keys in a > dictionary and do counting. This data structure takes a

[Tutor] managing memory large dictionaries in python

2012-10-16 Thread Abhishek Pratap
Hi Guys For my problem I need to store 400-800 million 20 characters keys in a dictionary and do counting. This data structure takes about 60-100 Gb of RAM. I am wondering if there are slick ways to map the dictionary to a file on disk and not store it in memory but still access it as dictionary o

Re: [Tutor] extract uri from beautiful soup string

2012-10-16 Thread eryksun
On Tue, Oct 16, 2012 at 7:52 AM, Norman Khine wrote: > > thanks, i made the changes https://gist.github.com/3891927 On line 67, use the result of soup.findAll directly: assoc_data.extend(assoc_cont.renderContents() for assoc_cont in soup.findAll('td', {'width': '49%', 'class': 'menu2

Re: [Tutor] extract uri from beautiful soup string

2012-10-16 Thread Norman Khine
On Tue, Oct 16, 2012 at 6:40 AM, eryksun wrote: > On Mon, Oct 15, 2012 at 1:17 PM, Norman Khine wrote: >> >> i made an update: https://gist.github.com/3891927 which works based on >> some of the recommendations posted here. >> >> any suggestions for improvement? > > I can't make any specific reco

Re: [Tutor] Tutor Digest, Vol 104, Issue 60

2012-10-16 Thread eryksun
On Tue, Oct 16, 2012 at 3:53 AM, Osemeka Osuagwu wrote: > On Sun, 14 Oct 2012 16:21:38 +0100 Alan Gauld wrote: > > Just to clarify, if I went with the top level function; then I guess > I'll define a 'name' attribute for each individual grid and then pass > that name in place of the 'grid' argumen

Re: [Tutor] Tutor Digest, Vol 104, Issue 60

2012-10-16 Thread Alan Gauld
On 16/10/12 08:53, Osemeka Osuagwu wrote: # or make this a regular instance method class Grid: def extend_grid(self, thickness=4, force=False): # do stuff to self to extend it # no need to return anything Just to clarify, if I went with the top level function; then I

Re: [Tutor] Tutor Digest, Vol 104, Issue 60

2012-10-16 Thread Osemeka Osuagwu
On Sun, 14 Oct 2012 16:21:38 +0100 Alan Gauld wrote: > >> In the code below, I can't seem to get around calling an instance >> method (__reality_check()) from within a class method (update_grid()), > > Of course you can't :) > > Since the class method has no access to the instance, it cannot call >