Re: [Tutor] Clash of the Titans and Mundane Matters

2005-01-20 Thread Gonçalo Rodrigues
Michael Powe wrote: Clash of the Titans From "Dive into Python": __init__ is called immediately after an instance of the class is created. It would be tempting but incorrect to call this the constructor of the class. It's tempting, because it looks like a constructor (by convention, __init__ is the

Re: [Tutor] Faster procedure to filter two lists . Please help

2005-01-15 Thread Gonçalo Rodrigues
Alan Gauld wrote: By missing out a loop(*) and some splits it should speed up significantly for the cost of some small added complexity in building the dictionaries in the first case. (*)In fact 3 loops because you aren't doing len() which effectively loops over the collection too. It this cor

Re: [Tutor] flattening a list

2005-01-13 Thread Gonçalo Rodrigues
Chad Crabtree wrote: The only problem with this if it is to big or to deeply nested then it will overflow the stack? Danny Yoo has given a mind-blowing continuation implementation that will not overflow the stack. Below goes a recursive-iterator implementation. To avoid deep recursion the code

Re: [Tutor] simple list query

2005-01-03 Thread Gonçalo Rodrigues
Patrick Hall wrote: Hi Dave, I have a list consisting of about 250 items, I need to know if a particular item is in the list. I know this is better suited to a dictionary but thats not the way it ended up ;-) I could do a for loop to scan the list & compare each one, but I have a suspission that

Re: [Tutor] O.T.

2004-12-29 Thread Gonçalo Rodrigues
Jacob S. wrote: I hate to sound weird... But who are you all, what are you're ages, what do you do, marriage status, etc? You obviously don't have to answer, I'm just curious who I'm boldly sending emails to. Jacob Schmidt P.S. I'm a student. 14 years. Play the piano better than I write scripts. Si

Re: [Tutor] am I missing another simpler structure?

2004-12-16 Thread Gonçalo Rodrigues
Loptr Chaote wrote: On Wed, 15 Dec 2004 19:58:56 -0500, Brian van den Broek 1) Every operation has a return value [unless purposefully left out] This includes, but is not limited to; mathematical operations (of course), variable assignment, compare blocks, etc.. A small correction: every function h

Re: [Tutor] eval and exec

2004-12-04 Thread Gonçalo Rodrigues
Bill Campbell wrote: On Sat, Dec 04, 2004, Alan Gauld wrote: I'm having trouble understanding the difference between eval and exec. eval evaluates an *expression* - that is something that returns a value. ... Both are extremely dangerous functions from a security and maintenance/reliability pouint