[Tutor] Interactive visualization in python

2010-11-07 Thread Aravind Venkatesan
Hello, This is Aravind. I am a university graduate student. I am looking for a software module or package to visualize a hierarchial tree data structure in python. Here's the problem: I have a tree(hierarchially represented) with set of nodes and edges. I would like to visualize this tree first. T

Re: [Tutor] Interactive visualization in python

2010-11-07 Thread Alan Gauld
"Aravind Venkatesan" wrote This is Aravind. I am a university graduate student. I am looking for a software module or package to visualize a hierarchial tree data structure in python. Most GUI toolkits have a tree widget like the Wiondows Explorer tree view. The Tkintrer version is includ

Re: [Tutor] Interactive visualization in python

2010-11-07 Thread Wayne Werner
On Sun, Nov 7, 2010 at 2:50 AM, Alan Gauld wrote: > > "Aravind Venkatesan" wrote > > > This is Aravind. I am a university graduate student. I am looking for a >> software module or package to visualize a hierarchial tree data structure >> in >> python. >> > > Most GUI toolkits have a tree widget

Re: [Tutor] test

2010-11-07 Thread Sandip Bhattacharya
On Sat, Nov 06, 2010 at 04:20:54PM +1100, Steven D'Aprano wrote: > Luke Paireepinart wrote: > >You don't get your own e-mails back. > > I do. > > Perhaps it's an option when you sign up? I think it is an irritating gmail-only "feature". I use a google apps domain and face the same issue. I see

Re: [Tutor] Interactive visualization in python

2010-11-07 Thread Terry Carroll
On Sun, 7 Nov 2010, Alan Gauld wrote: Most GUI toolkits have a tree widget like the Wiondows Explorer tree view. The Tkintrer version is included in the Tix module which extends the basic Tkinter widgets. I'm pretty sure wxPython will have one too. I haven't used it, but wxPython's tree widge

[Tutor] trying to generate change in print output

2010-11-07 Thread Terry Green
Am stumped, when I use this code: race=int(row[2]) raceChek=1 if raceChek == race: print ('raceChek ', raceChek, 'race ', race) else: print ('raceChek ', raceChek,' no match ', 'race ', race); raceChek = race I Get this: raceChek 1 race 1 raceChek 1 race 1

Re: [Tutor] trying to generate change in print output

2010-11-07 Thread Steven D'Aprano
Terry Green wrote: Am stumped, when I use this code: race=int(row[2]) raceChek=1 This causes IndentationError: unexpected indent. if raceChek == race: print ('raceChek ', raceChek, 'race ', race) else: print ('raceChek ', raceChek,' no match ', 'race ', race); raceChek = race

[Tutor] Adding cookies to cookiejar object (Python 3.01)

2010-11-07 Thread fjulll
I have succeded in importing a bunch of cookies from my browser to an array and now want to put them in a cookiejar object to send in a HTTP-request. I've read the documentation over and over again but can't figure out how to actually add your own cookies to the jar. Does anyone know? http://docs.

[Tutor] List comprehension question

2010-11-07 Thread Richard D. Moores
def proper_divisors(n): """ Return the sum of the proper divisors of positive integer n """ return sum([x for x in range(1,n) if int(n/x) == n/x]) The list comprehension is this function is inefficient in that it computes n/x twice. I'd like to do an a = n/x and use a in "if int(a

Re: [Tutor] List comprehension question

2010-11-07 Thread Hugo Arts
On Mon, Nov 8, 2010 at 12:36 AM, Richard D. Moores wrote: > def proper_divisors(n): >     """ >     Return the sum of the proper divisors of positive integer n >     """ >     return sum([x for x in range(1,n) if int(n/x) == n/x]) > > The list comprehension is this function is inefficient in that

Re: [Tutor] List comprehension question

2010-11-07 Thread Richard D. Moores
On Sun, Nov 7, 2010 at 15:53, Hugo Arts wrote: > On Mon, Nov 8, 2010 at 12:36 AM, Richard D. Moores wrote: >> def proper_divisors(n): >>     """ >>     Return the sum of the proper divisors of positive integer n >>     """ >>     return sum([x for x in range(1,n) if int(n/x) == n/x]) >> >> The li

Re: [Tutor] List comprehension question

2010-11-07 Thread Hugo Arts
On Mon, Nov 8, 2010 at 1:16 AM, Richard D. Moores wrote: > On Sun, Nov 7, 2010 at 15:53, Hugo Arts wrote: >> n is a proper >> divisor of x if there is no remainder after division, after all. This >> also means you won't have to do a cast, which tend to be fairly >> expensive. > > I don't know wha

Re: [Tutor] List comprehension question

2010-11-07 Thread Wayne Werner
On Sun, Nov 7, 2010 at 6:31 PM, Hugo Arts wrote: > > here's a list comprehension > >>> a = [x*2 for x in range(10)] > >>> a > [0, 2, 4, 6, 8, 10, 12, 14, 16, 18] > > here's the equivalent generator expression: > >>> a = (x*2 for x in range(10)) Since you're talking about generators and effi

Re: [Tutor] trying to generate change in print output

2010-11-07 Thread Alan Gauld
"Terry Green" wrote Am stumped, when I use this code: race=int(row[2]) raceChek=1 if raceChek == race: print ('raceChek ', raceChek, 'race ', race) else: print ('raceChek ', raceChek,' no match ', 'race ', race); raceChek = race I Get this: raceChek 1 race 1 raceChek 1 no ma

Re: [Tutor] Interactive visualization in python

2010-11-07 Thread davidheiserca
FYI... There is a non-Python commercial program called XMLSpy which displays a visual tree rendition of an XML schema (.xsd) file. The schema file can be created or manipulated with Python/ElementTree. Maybe it can help you in your program development. - Original Message - Fro

Re: [Tutor] List comprehension question

2010-11-07 Thread Alan Gauld
"Hugo Arts" wrote Yes. A cast or typecast means converting some data to a different type, like converting floats to integers, strings to integers, The term cast can be misleading however since in some languages - those decended from C it means treating a piece of data as if it were another t

Re: [Tutor] List comprehension question

2010-11-07 Thread Richard D. Moores
On Sun, Nov 7, 2010 at 16:41, Wayne Werner wrote: > On Sun, Nov 7, 2010 at 6:31 PM, Hugo Arts wrote: >> >> >> here's a list comprehension >> >>> a = [x*2 for x in range(10)] >> >>> a >> [0, 2, 4, 6, 8, 10, 12, 14, 16, 18] >> >> here's the equivalent generator expression: >> >>> a = (x*2 for x in

Re: [Tutor] List comprehension question

2010-11-07 Thread Wayne Werner
On Sun, Nov 7, 2010 at 7:15 PM, Richard D. Moores wrote: > On Sun, Nov 7, 2010 at 16:41, Wayne Werner wrote: > > On Sun, Nov 7, 2010 at 6:31 PM, Hugo Arts wrote: > > I should have mentioned that I'm using 3.1 . > > So this version of my function uses a generator, range(), no? > Correct. The ru

Re: [Tutor] List comprehension question

2010-11-07 Thread Richard D. Moores
On Sun, Nov 7, 2010 at 17:47, Wayne Werner wrote: > On Sun, Nov 7, 2010 at 7:15 PM, Richard D. Moores > wrote: >> >> On Sun, Nov 7, 2010 at 16:41, Wayne Werner wrote: >> > On Sun, Nov 7, 2010 at 6:31 PM, Hugo Arts wrote: >> >> I should have mentioned that I'm using 3.1 . >> >> So this version