Hey Darren,
On Mon, Nov 15, 2010 at 9:04 AM, Darren Dale <[email protected]> wrote:
> but not this:
>
> def test():
> sentinal = '3'
> with open('foo.txt', 'w') as f:
> sentinal in ('1', '2')
>
as a possible workaround until the actual bug is fixed, remember that
'x in y' is mostly sugar for 'y.__contains__(x)',
In [1]: a = ('1', '2')
In [2]: '3' in a
Out[2]: False
In [3]: a.__contains__('3')
Out[3]: False
so you may be able to use the uglier form for now.
Also worth mentioning that if you assign the tuple to a variable, the
bug doesn't show up:
dreamweaver[~]> cat bad.pyx
def test():
sentinel = '3'
with open('foo.txt', 'w') as f:
a = ('1', '2')
sentinel in a
dreamweaver[~]> cython bad.pyx
dreamweaver[~]> # no crash, though I didn't test that it behaves correctly.
Cheers,
f
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev