Skip to content

vscode python debug iterator count() code showing is not correct #130104 #687

@opticaloptical

Description

@opticaloptical

Environment data

  • debugpy version: XXX (run import debugpy; print(debugpy.__version__) if uncertain)
    1.4.1

  • OS and version: XXX
    -win 10 20H2 19042.1110 Windows Feature Experience Pack 120.2212.3530.0

  • Python version (& distribution if applicable, e.g. Anaconda): XXX
    conda 4.10.3
    Python 3.8.10 (default, May 19 2021, 13:12:57) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32

  • Using VS Code or Visual Studio:
    版本: 1.58.2 (user setup)
    提交: c3f126316369cd610563c75b1b1725e0679adfb3
    日期: 2021-07-14T22:10:15.214Z
    Electron: 12.0.13
    Chrome: 89.0.4389.128
    Node.js: 14.16.0
    V8: 8.9.255.25-electron.0
    OS: Windows_NT x64 10.0.19042

Actual behavior

code:

from itertools import count
my_vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
current_counter = count()
string = "This is just a sentence."
for i in string:
  if i in my_vowels:
    print(f"Current vowel: {i}")
    print(f"Number of vowels found so far: {next(current_counter)}")

info:
local variable show:
count(1), count(3),count(4).......

Expected behavior

from itertools import count

my_vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']

current_counter = count()
string = "This is just a sentence."

for i in string:
  if i in my_vowels:
    print(f"Current vowel: {i}")
    print(f"Number of vowels found so far: {next(current_counter)}")

info:
local variable show:
current_counter :1,2,3,4,5

Steps to reproduce:

  1. XXX
    无标题

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions