Re: [Tutor] Best way to convert list of ints to a string?

2008-04-25 Thread Dick Moores
At 08:28 PM 4/25/2008, Kent Johnson wrote: Dick Moores wrote: I have the feeling that I've either forgotten (or never knew) some basic Python built-in or something, but in case I haven't, what's the best way to convert a list of integers to a string? I dunno about 'best', but here is one way

Re: [Tutor] Best way to convert list of ints to a string?

2008-04-25 Thread Kent Johnson
Dick Moores wrote: I have the feeling that I've either forgotten (or never knew) some basic Python built-in or something, but in case I haven't, what's the best way to convert a list of integers to a string? I dunno about 'best', but here is one way to do it: ''.join(map(str, intList)) Perhap

[Tutor] Best way to convert list of ints to a string?

2008-04-25 Thread Dick Moores
I have the feeling that I've either forgotten (or never knew) some basic Python built-in or something, but in case I haven't, what's the best way to convert a list of integers to a string?  Here are two I've come up with. Although intListToString2() is the more Pythonic, intListToString1() is the

Re: [Tutor] Help with Recurring Function

2008-04-25 Thread Kent Johnson
Sanhita Mallick wrote: I am struggling with a simple recurring function What is a recurring function? Do you mean looping? Here is the script. T(i) are trees (as in graphs). The program operates great, until the step where norm_ted is calculated. Mysteriously norm_ted becomes 0, even though

Re: [Tutor] Help with Recurring Function

2008-04-25 Thread bob gailer
Sanhita Mallick wrote: Hi. I am struggling with a simple recurring function, but can't understand why this is happening. Please help. Here is the script. T(i) are trees (as in graphs). The program operates great, until the step where norm_ted is calculated. Mysteriously norm_ted becomes 0, even

[Tutor] Help with Recurring Function

2008-04-25 Thread Sanhita Mallick
Hi. I am struggling with a simple recurring function, but can't understand why this is happening. Please help. Here is the script. T(i) are trees (as in graphs). The program operates great, until the step where norm_ted is calculated. Mysteriously norm_ted becomes 0, even though "mag" value is ca

Re: [Tutor] 6x6 word square solver too slow

2008-04-25 Thread Jeff Younker
However I suspect any attempt to improve performance here needs a new algorithm and probably a clever data structure to minimise brute force tests. If I knew of one, I would have used it :) I'd suggest googling for 'trie'. Tries are method of indexing sets of strings by prefix. As I recall

Re: [Tutor] howto mysqldb dictionary cursor

2008-04-25 Thread Kent Johnson
Vaibhav.bhawsar wrote: I have been trying to get the DictCursor working with mysqldb module but can't seem to. I have pasted the basic connection code and the traceback from pydev. The connection does open with the default cursor class. can't figure out how to use the dict cursor class instead

Re: [Tutor] 6x6 word square solver too slow

2008-04-25 Thread Alan Gauld
"R. Alan Monroe" <[EMAIL PROTECTED]> wrote That effectively means join is getting called at 6 levels of loop nesting for just one recursive call, but you could be doing more than that. I'm doing zip and list comprehension just as often, and they don't make a blip in the profiler. Maybe that's