[Tutor] Confused about __setitem__

2008-12-03 Thread Jim Hodgen
I am learning Python with a minesweeper-engine project. Future activities turn my attention to exploring the use of dictionaries as sparse matrices, hence the representation of the gameboard. Why can't I fill the dictionary-as-a-matrix with an instance of class Square? Why do I need a custo

Re: [Tutor] Graph theory

2008-12-03 Thread Kent Johnson
On Wed, Dec 3, 2008 at 8:16 PM, John Fouhy <[EMAIL PROTECTED]> wrote: > Interestingly, Guido wrote an essay on implementing graphs in python > using dictionaries and lists: > > http://python.org/doc/essays/graphs/ Also googling "python graph" finds many alternatives. Kent ___

Re: [Tutor] using windows wide proxy settings

2008-12-03 Thread Kent Johnson
On Wed, Dec 3, 2008 at 6:37 PM, Martin Walsh <[EMAIL PROTECTED]> wrote: > The urllib and urllib2 modules also provide a helper function for > retrieving proxy info... > import urllib2 urllib2.getproxies() > {'ftp': 'ftp://10.0.0.100:', 'http': 'http://10.0.0.100:'} And, since ur

Re: [Tutor] Sorting a dictionary on a value in a list.

2008-12-03 Thread Kent Johnson
On Wed, Dec 3, 2008 at 7:58 PM, Lawrence Wickline <[EMAIL PROTECTED]> wrote: > how would I sort on bytes sent? You can't actually sort a dictionary; what you can do is sort the list of items. In this case each item will look be a tuple (filename, (bytes, bytes_sent)) and dict.items() will be a

Re: [Tutor] Graph theory

2008-12-03 Thread John Fouhy
On 04/12/2008, Michele Alzetta <[EMAIL PROTECTED]> wrote: > I have been thinking about a problem, and I'm wondering what the best > approach for a pythonic solution would be. > The actual problem is very complex, but the very first step in the > solution would be to come up with a simple way of

[Tutor] Graph theory

2008-12-03 Thread Michele Alzetta
Hallo all! It's a long time since I last wrote here. I have been thinking about a problem, and I'm wondering what the best approach for a pythonic solution would be. The actual problem is very complex, but the very first step in the solution would be to come up with a simple way of handling graphs

[Tutor] Sorting a dictionary on a value in a list.

2008-12-03 Thread Lawrence Wickline
I am working on a reducer that needs to produce a sorted output of files sorted on their overall bandwidth use. I create a dictionary with the file name as the key (it is always unique) and in the values I am populating a list with the two values of bytes and bytes sent. Each entry looks like {fi

Re: [Tutor] using windows wide proxy settings

2008-12-03 Thread Martin Walsh
Tim Michelsen wrote: > Hello, > is there any possibility in python to retrieve the system wide internet > connection settings? > > I would like to access the proxy settings stored in > Internet Explorer -> Extras -> Options -> Connection -> LAN settings. I wouldn't believe it if I didn't just see

Re: [Tutor] using windows wide proxy settings

2008-12-03 Thread John Fouhy
On 04/12/2008, Tim Michelsen <[EMAIL PROTECTED]> wrote: > Hello, > is there any possibility in python to retrieve the system wide internet > connection settings? > > I would like to access the proxy settings stored in > Internet Explorer -> Extras -> Options -> Connection -> LAN settings. Insta

Re: [Tutor] using windows wide proxy settings

2008-12-03 Thread Alan Gauld
"Tim Michelsen" <[EMAIL PROTECTED]> wrote is there any possibility in python to retrieve the system wide internet connection settings? Further to my earlier mail I had a thought and sure enough there is a winreg module that makes accessing the registry much easier direct from Python. Now all

Re: [Tutor] using windows wide proxy settings

2008-12-03 Thread Alan Gauld
"Tim Michelsen" <[EMAIL PROTECTED]> wrote is there any possibility in python to retrieve the system wide internet connection settings? Not as such, but Python does provide the hooks to get it from the OS. I would like to access the proxy settings stored in Internet Explorer -> Extras -> Opt

[Tutor] [Fwd: Re: Making a dictionary of dictionaries from csv file]

2008-12-03 Thread spir
Judith Flores a écrit : Dear Python community, I have been trying to create a dictionary of dictionaries (and more dictionaries) from a csv file. The csv file contains longitudinal data corresponding to names. The following is just a very (very) simple example of how the data looks: NameD

[Tutor] using windows wide proxy settings

2008-12-03 Thread Tim Michelsen
Hello, is there any possibility in python to retrieve the system wide internet connection settings? I would like to access the proxy settings stored in Internet Explorer -> Extras -> Options -> Connection -> LAN settings. This would later be used by urllib. My aim is not to bother the user wi

Re: [Tutor] Making a dictionary of dictionaries from csv file

2008-12-03 Thread Rich Lovely
How about this: def recursiveDictFactory(): return defaultdict(recursiveDictFactory) dictOfDictsOfDictsEtc = defaultdict(recursiveDictFactory) --- Richard "Roadie Rich" Lovely Part of the JNP|UK Famille www.theJNP.com (Sent from my iPod - please allow me a few typos: it's a very small key

Re: [Tutor] Making a dictionary of dictionaries from csv file

2008-12-03 Thread Kent Johnson
On Wed, Dec 3, 2008 at 3:34 AM, Alan Gauld <[EMAIL PROTECTED]> wrote: > Also you are overwriting the row for each name. So you only > store the last entry. So you need to separate the data further. > Something like > > maindict[row[name]] [row[day]] = (row.weight, row,temp) This will not quite wo

Re: [Tutor] Making a dictionary of dictionaries from csv file

2008-12-03 Thread Alan Gauld
"Judith Flores" <[EMAIL PROTECTED]> wrote I have been trying to create a dictionary of dictionaries (and more dictionaries) from a csv file. Your code below suffers from sloppiness in the number of [] which makes it hard to know exactly what the problem might be. But in principle what you a

Re: [Tutor] sqlite3 Python25 parameter binding problemwithUPDATEplease help

2008-12-03 Thread Alan Gauld
"aivars" <[EMAIL PROTECTED]> wrote I fully agree with you - I still need to understand basic Python (I actually warned that I am a complete noob) and how it works. And probably I need a couple of goof books. To be honest you don;t need many books on Python, the web resources are adequate. Peso