Re: [Tutor] Nested list comprehensions

2006-05-14 Thread John Fouhy
On 15/05/06, Kent Johnson <[EMAIL PROTECTED]> wrote: > You can come pretty close with generators, though it hurts to think > about what is actually going on behind the scenes here: > > In [1]: import itertools > > In [2]: def fibs(): > ...: yield 0 > ...: yield 1 > ...: fib1

Re: [Tutor] Nested list comprehensions

2006-05-14 Thread Kent Johnson
John Fouhy wrote: > On 15/05/06, w chun <[EMAIL PROTECTED]> wrote: >> anyone know if list comps work the same way in haskell? > > Slightly not what you asked, but you can do some funky things with > list comprehensions in Haskell. > > Check this out: > > fibs = 0 : 1 : [ a + b | (a, b) <- zip fi

Re: [Tutor] Nested list comprehensions

2006-05-14 Thread John Fouhy
On 15/05/06, w chun <[EMAIL PROTECTED]> wrote: > anyone know if list comps work the same way in haskell? Slightly not what you asked, but you can do some funky things with list comprehensions in Haskell. Check this out: fibs = 0 : 1 : [ a + b | (a, b) <- zip fibs (tail fibs)] The python transla

Re: [Tutor] Nested list comprehensions

2006-05-14 Thread w chun
i agree with everyone above, kent, alan, roel... in fact, i have do a doubletake everytime i write code like this and have to look things up and/or play with some sample code as you all have done, just to make sure i got it working. (kinda reminds of going back to look at a perl script i wrote...

[Tutor] Database topic now fixed

2006-05-14 Thread S W Collier
Alan, Does that mean you will soon fix the tutor.tgz :-) Thanks for all the hard work you put into this. Stan. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How do I create the equivalent of a Java class in Python?

2006-05-14 Thread Alan Gauld
> How do I create the equivalent of a Java class in Python? I've been looking> at the reference, and it's been confusing to me at least.   Adapted from my book:   Java code:   class Msg{    private String txt;    public Msg(String s){   this.txt = s;    }    public void say(){   if

[Tutor] Treeview

2006-05-14 Thread John CORRY
Hi,   I have managed to find the solution to my problem.   I have defined iter as   Iter = model.get_iter(combo3)   The code now works.  I will show it below for completeness:   combo3 = self.wTree.get_widget("treeview1")     model=gtk.TreeStore(gobject.TYPE_STRING,gobject.