Re: problem with str()

2007-03-16 Thread Steve Holden
Alex Martelli wrote: > Steve Holden <[EMAIL PROTECTED]> wrote: >... Get yourself a stuffed bear, and next time you have this kind of problem spend a few minutes explaining to the bear exactly how your program can't possibly be wrong. Works like a charm. >>> A rubber ducky works m

Re: problem with str()

2007-03-15 Thread Petr Prikryl
"Alex Martelli" wrote > Steve Holden wrote: >... > > >> Get yourself a stuffed bear, and next time you have this kind of problem > > >> spend a few minutes explaining to the bear exactly how your program > > >> can't possibly be wrong. Works like a charm. > > > > > > A rubber ducky works muc

Re: problem with str()

2007-03-15 Thread Alex Martelli
Steve Holden <[EMAIL PROTECTED]> wrote: ... > >> Get yourself a stuffed bear, and next time you have this kind of problem > >> spend a few minutes explaining to the bear exactly how your program > >> can't possibly be wrong. Works like a charm. > > > > A rubber ducky works much better for that,

Re: problem with str()

2007-03-15 Thread 7stud
On Mar 15, 5:31 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > The fact that a list comprehension "leaks" its variables into the > containing scope is a bit weird. > A generator expression doesn't: > > py> str > > py> w = (str for str in range(10)) > py> w > > py> str > > py> w.next() >

Re: problem with str()

2007-03-15 Thread Steve Holden
Alex Martelli wrote: > Steve Holden <[EMAIL PROTECTED]> wrote: > >> 7stud wrote: >>> Sheesh! You would think that after looking at every inch of the code >>> for way too many hours, at some point that would have poked me in the >>> eye. >>> >>> Thanks all. >>> >> Get yourself a stuffed bear, and n

Re: problem with str()

2007-03-15 Thread Alex Martelli
Steve Holden <[EMAIL PROTECTED]> wrote: > 7stud wrote: > > Sheesh! You would think that after looking at every inch of the code > > for way too many hours, at some point that would have poked me in the > > eye. > > > > Thanks all. > > > Get yourself a stuffed bear, and next time you have this ki

Re: problem with str()

2007-03-15 Thread Paul Rubin
[EMAIL PROTECTED] writes: > methodList = [str for str in names if callable(getattr(obj, str))] > > instead, do something like this: > > methodList = [i for i in names if callable(getattr(obj, i))] or: methodList = list(str for str in names if callable(getattr(obj, str))) genexps, unlike lis

Re: problem with str()

2007-03-15 Thread Gabriel Genellina
En Thu, 15 Mar 2007 17:32:24 -0300, <[EMAIL PROTECTED]> escribió: > methodList = [str for str in names if callable(getattr(obj, str))] > > instead, do something like this: > > methodList = [i for i in names if callable(getattr(obj, i))] The fact that a list comprehension "leaks" its variables int

Re: problem with str()

2007-03-15 Thread Steve Holden
7stud wrote: > Sheesh! You would think that after looking at every inch of the code > for way too many hours, at some point that would have poked me in the > eye. > > Thanks all. > Get yourself a stuffed bear, and next time you have this kind of problem spend a few minutes explaining to the bear

Re: problem with str()

2007-03-15 Thread 7stud
Sheesh! You would think that after looking at every inch of the code for way too many hours, at some point that would have poked me in the eye. Thanks all. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with str()

2007-03-15 Thread Terry Reedy
"7stud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |I can't get the str() method to work in the following code(the last | line produces an error): If you 'print str' here | methodList = [str for str in names if callable(getattr(obj, str))] and again here, you will see the prob

Re: problem with str()

2007-03-15 Thread kyosohma
On Mar 15, 2:49 pm, "7stud" <[EMAIL PROTECTED]> wrote: > I can't get the str() method to work in the following code(the last > line produces an error): > > > class test: > """class test""" > def __init__(self): > """I am init func!""" > s

Re: problem with str()

2007-03-15 Thread Larry Bates
7stud wrote: > I can't get the str() method to work in the following code(the last > line produces an error): > > > class test: > """class test""" > def __init__(self): > """I am init func!""" > self.num = 10 > self.num2

Re: problem with str()

2007-03-15 Thread Matimus
Don't use built-ins as variable names. Your code will work if you change this: > methodList = [str for str in names if callable(getattr(obj, str))] to this: > methodList = [s for s in names if callable(getattr(obj, s))] -- http://mail.python.org/mailman/listinfo/python-list