this looks like a bug in generator comprehension

Just just at xs4all.nl
Fri Nov 12 04:49:59 EST 2004


In article <4edc17eb.0411120144.444315c0 at posting.google.com>,
 michele.simionato at gmail.com (Michele Simionato) wrote:

> Consider this example:
> 
> def f(x,y):
>    yield str(x) + y
> 
> "".join([s for s in f(1,2)])
> 
> I get correctly 
> 
> TypeError: cannot concatenate 'str' and 'int' objects
> 
> However if I use a generator comprehension (I am using Python 2.4b2)
> I get a misleading error message:
> 
> TypeError: sequence expected, generator found
> 
> Is this a known bug?

Yes:
  http://python.org/sf/905389

Just



More information about the Python-list mailing list