集合理解不适用于Pydev(Python) [英] Set comprehensions don't work on Pydev (Python)

查看:51
本文介绍了集合理解不适用于Pydev(Python)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

{x for x in range(10)}

在IDLE上可以正常工作,但是当我在Eclipse中尝试此操作(使用Pydev插件)时,出现语法错误:

works perfectly on IDLE, but when I try this in eclipse (with Pydev plugin) I get a syntax error:

未定义变量:x

Undefined variable: x

是因为Pydev不支持集合理解等吗?我该怎么做才能使这项工作? (这只是一个例子,不起作用.所有设定的理解对我都不起作用).

Is it because Pydev doesn't support set comprehensions or something? What can I do to make this work? (This was just one example that doesn't work. All set comprehensions don't work for me).

(我正在使用Python 3)

(I'm using Python 3)

推荐答案

这是PyDev中的错误;在这种情况下,请忽略编辑者的警告并执行代码:它将起作用.

This is a bug in PyDev; in this case ignore the editor's warning and execute the code: it will work.

我得到了很多,PyDev并不完美,但已经足够好了!

I get this a lot, PyDev isn't perfect but it's good enough!

这篇关于集合理解不适用于Pydev(Python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆