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 into the  
containing scope is a bit weird.
A generator expression doesn't:

py> str
<type 'str'>
py> w = (str for str in range(10))
py> w
<generator object at 0x00AD7C38>
py> str
<type 'str'>
py> w.next()
0
py> str
<type 'str'>

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to