Re: [Tutor] using windows wide proxy settings

2008-12-04 Thread Timmie
Hello all, thanks a lot for your answers. > > 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:'} This seems to be the fastest met

Re: [Tutor] Confused about __setitem__

2008-12-04 Thread Alan Gauld
"Jim Hodgen" <[EMAIL PROTECTED]> wrote Why can't I fill the dictionary-as-a-matrix with an instance of class Square? You can but you are not trying to do that in your code. You are assigning Square to the class that contains the dictionary, not the dictionary itself. class Square: mined

Re: [Tutor] Confused about __setitem__

2008-12-04 Thread Kent Johnson
On Thu, Dec 4, 2008 at 3:54 AM, Alan Gauld <[EMAIL PROTECTED]> wrote: > These are all class level variables so they will be shared if you > create more than one instance of the class. That's probably > not what you want?. You should initialise them inside an __init__ > method if you want each squa

[Tutor] To print docstrings

2008-12-04 Thread prasad rao
Hello friends. I am new to programing.I am learning Python. I failed in my attempts to retrive doc strings of methods in a module. """ for x in dir(logging): print x,x.__doc__ = for x in dir(collections): print x,collections.x.__doc__ == >>> def dd(o): zx=dir (o)

Re: [Tutor] To print docstrings

2008-12-04 Thread A.T.Hofkamp
prasad rao wrote: Hello friends. I am new to programing.I am learning Python. I failed in my attempts to retrive doc strings of methods in a module. """ for x in dir(logging): print x,x.__doc__ = for x in dir(collections): print x,collections.x.__doc__ == I am n

Re: [Tutor] To print docstrings

2008-12-04 Thread Kent Johnson
On Thu, Dec 4, 2008 at 9:46 AM, prasad rao <[EMAIL PROTECTED]> wrote: > > Hello friends. > I am new to programing.I am learning Python. > I failed in my attempts to retrive doc strings of methods in > a module. > """ > for x in dir(logging): > print x,x.__doc__ Here x is a string, that is why y

Re: [Tutor] To print docstrings

2008-12-04 Thread Kent Johnson
On Thu, Dec 4, 2008 at 10:10 AM, A.T.Hofkamp <[EMAIL PROTECTED]> wrote: > docs = [] > for x in dir(collections): > docs.append(x.__doc__) This will not work, see my previous email for solution. Kent ___ Tutor maillist - Tutor@python.org http://mail

Re: [Tutor] Confused about __setitem__

2008-12-04 Thread bob gailer
Jim Hodgen wrote: 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? Wh

Re: [Tutor] Help Optimise Code

2008-12-04 Thread J�rg W�lke
* Richard Lovely <[EMAIL PROTECTED]> [081123 11:35]: > I've tried a the sieve of erath-whatever as in test_generator, > implemented using itertools functions, but it hit max recusion depth > somewhere before 1000 primes, and I'm after millions of primes. I found an old implementation for some exer

Re: [Tutor] Help Optimise Code

2008-12-04 Thread Kent Johnson
On Thu, Dec 4, 2008 at 11:38 AM, Jörg Wölke <[EMAIL PROTECTED]> wrote: > #!/usr/bin/env python > > l=1*[1] > for i in range(2,len(l)): >if l[i] == 1: > print i > for j in range(i+1,len(l)): > if j%i == 0: for j in range(2*i, len(l), i): would be much faster

Re: [Tutor] To print docstrings

2008-12-04 Thread Alan Gauld
"prasad rao" <[EMAIL PROTECTED]> wrote Please someone tell me how I can retrive all the docstrings in a module Unless its just as an exercise use help() Its much easier! -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _

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

2008-12-04 Thread Lawrence Wickline
Thanks for the help I think I got it. As far as lines go I believe it will be processing hundreds of thousands of lines if not a million or more lines per run. I haven't gotten to do a full run but it has been running acceptably fast on my test files. I ended up putting it into a main fun

Re: [Tutor] Graph theory

2008-12-04 Thread Dave Kuhlman
On Wed, Dec 03, 2008 at 08:49:12PM -0500, Kent Johnson wrote: > 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

Re: [Tutor] Graph theory

2008-12-04 Thread Santiago Payà i Miralta
On Thu, Dec 04, 2008 at 01:26:02PM -0800, Dave Kuhlman wrote: > On Wed, Dec 03, 2008 at 08:49:12PM -0500, Kent Johnson wrote: > > 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 diction

[Tutor] rrdtool examples.

2008-12-04 Thread Jeremiah Jester
Is anyone on here using the python-rrdtool module for graphing and analysis? If so, do you have some sample scripts you could show me. There doesn't seem to be a lot out there as far as real world python examples. Thanks, JJ Disclaimer: The information contained in this transmission, including