Has apparent 2.4b1 bug been fixed? flatten in Lib\compiler\ast.py overloads 'list' name
Bengt Richter
bokr at oz.net
Wed Jan 19 00:23:44 EST 2005
On Wed, 19 Jan 2005 04:55:53 GMT, bokr at oz.net (Bengt Richter) wrote:
>What am I missing? (this is from 2.4b1, so probably it has been fixed?)
>
I googled and found a bug report, but initial report kind of passes on it
saying nested sequences will probably be tuples, so no panic (my paraphrased description).
So I guess it's in the mill. So never mind. I should have googled first ;-/
>
>def flatten(list):
> l = []
> for elt in list:
> ^^^^--must be expecting list instance or other sequence
> t = type(elt)
> if t is tuple or t is list:
> ^^^^--looks like it expects to refer to the type, not the arg
> for elt2 in flatten(elt):
> l.append(elt2)
> else:
> l.append(elt)
> return l
>
Regards,
Bengt Richter
More information about the Python-list
mailing list