[Tutor] dictionary-ness ...

David Broadwell dbroadwell@mindspring.com
Wed May 14 13:50:22 2003


> Ok. As long as the keys are strings, you can replace the dictionary with
> a shelve. See http://www.python.org/doc/current/lib/module-shelve.html
I'll look into that ...
No I'm not after persistence yet, but I'll keep it in mind.

> Another option would be to use an SQL database, maybe SQLite,
In time, I don't think I'm pythonly ready for that yet.

>> Wacking down to the 'words' in the files is trivial and with 
>> os.path.walk's help, just a few minutes in the interpreter and
>> I can grab the wordlist of the files.
> So what is the purpose? Do you want to be able to enter a word and
> see in what files it occurs, or what?
Purpose: Pointless bit-tweedling to gain experience. And the fact
that a word list on that order would be enough data for a reasonable
load test to a database.

> I don't understand the purpose of this.
> Why key on parts of a word?
It was something I felt I could implement.

> Why two letters?
I thought having 26 records too few and 17576 too many.
So I settled on 676 at max.

> No, it would not look like that. It might look like...
> dict = {'wo': ['word', 'wording'], ... }
Sorry, right. I was typing on the fly.

> ...but I can't see the point in storing anything like that.
> What is the purpose of this dictionary?
A faster way of seeing how many 'w' words I have than a flat list.
Also happens to be something (size wise) that I'm comfortable
iterating through, the though of the words from over 20000 files
in a single list seemed, unwieldy.

No, I don't really need to bind it all in a dictionary, but I 
took this project on with dictionary in mind to combat my learning
curve. And I think that it has some practical value, at least to
my curiosity as to exactly what is written in my MP3 data structure.

> There are several python based search engines already. I think
> a list was posted recently on this mailing list. Perhaps you
> would learn something from studying some of them.
Hey that too. Though it was before I was a subscriber, so I'll have
to do a bit of hunting.

--

David Broadwell