RichDom2185 / pythonbuddy-issue-tracker

Issue tracker for Python Buddy.
https://pythonbuddy.dev
0 stars 0 forks source link

Error when using generators #4

Open tjingsheng opened 5 months ago

tjingsheng commented 5 months ago

Link: https://pythonbuddy.dev/editor/?code=IyBDb21tZW50IG91dCBhbGwgb3RoZXIgU2VnbWVudHMgZHVyaW5nIHRlc3RpbmcuCgojIFN0YXJ0IG9mIFNlZ21lbnQgMQooeCBmb3IgeCBpbiBbXSkKIyBFbmQgb2YgU2VnbWVudCAxCgojIFN0YXJ0IG9mIFNlZ21lbnQgMgpkZWYgZW1wdHlfZ2VuZXJhdG9yKCk6CiAgICBpZiBGYWxzZToKICAgICAgICB5aWVsZApzdW0oZW1wdHlfZ2VuZXJhdG9yKCkpICAjIFNob3VsZCBwcmludCAwCiMgRW5kIG9mIFNlZ21lbnQgMg==&filename=generator.py

Code:

# Comment out all other Segments during testing.

# Start of Segment 1
(x for x in [1, 2, 3])
# End of Segment 1

# Start of Segment 2
def empty_generator():
    if False:
        yield
sum(empty_generator())  # Should print 0
# End of Segment 2
RichDom2185 commented 5 months ago

Hi, thanks for reporting this! Generator expressions and the yield keyword are not yet supported as of now, but I'll try to make them available in the next release.

Stay tuned for further updates on this thread!