Coder Social home page Coder Social logo

Comments (5)

leisurelicht avatar leisurelicht commented on August 21, 2024

我本地下载个3.8试一下

from wtfpython-cn.

pruidong avatar pruidong commented on August 21, 2024
>>> [(yield x) for x in some_iterable]
SyntaxError: 'yield' inside list comprehension
>>> [(yield x) for x in some_iterable]
SyntaxError: 'yield' inside list comprehension
>>> list([(yield x) for x in some_iterable])
SyntaxError: 'yield' inside list comprehension
>>> list((yield x) for x in some_iterable)
SyntaxError: 'yield' inside generator expression
>>> list(some_func((yield x)) for x in some_iterable)
SyntaxError: 'yield' inside generator expression

3.8中的idle运行上面的语句报错.

https://github.com/leisurelicht/wtfpython-cn#-yielding-none%E7%94%9F%E6%88%90-none

from wtfpython-cn.

leisurelicht avatar leisurelicht commented on August 21, 2024
>>> [(yield x) for x in some_iterable]
SyntaxError: 'yield' inside list comprehension
>>> [(yield x) for x in some_iterable]
SyntaxError: 'yield' inside list comprehension
>>> list([(yield x) for x in some_iterable])
SyntaxError: 'yield' inside list comprehension
>>> list((yield x) for x in some_iterable)
SyntaxError: 'yield' inside generator expression
>>> list(some_func((yield x)) for x in some_iterable)
SyntaxError: 'yield' inside generator expression

3.8中的idle运行上面的语句报错.

https://github.com/leisurelicht/wtfpython-cn#-yielding-none%E7%94%9F%E6%88%90-none

3.8中把这个bug修复了,看这里.

from wtfpython-cn.

leisurelicht avatar leisurelicht commented on August 21, 2024
>>>a, b = "wtf!", "wtf!"
>>>a is b # 仅适用于3.7版本以下, 3.7以后的返回结果为False.
True

上述代码在Python 3.8中运行同样为True.注释存在错误.

运行环境: IDLE / Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32

相关连接地址.

https://github.com/leisurelicht/wtfpython-cn#-strings-can-be-tricky-sometimes%E5%BE%AE%E5%A6%99%E7%9A%84%E5%AD%97%E7%AC%A6%E4%B8%B2-

我觉得应该是3.8中ast的实现方式有更新,不过我没在 new list 中找到说明。

from wtfpython-cn.

pruidong avatar pruidong commented on August 21, 2024

好的,谢谢.

from wtfpython-cn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.