Python Forum
Python linter Pylance: What does "(variable): List | Unbound" mean?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python linter Pylance: What does "(variable): List | Unbound" mean?
#2
It's warning you that a static analysis can't guarantee that new_list will be properly initialized (or bound) before reaching that line. I think you have an indentation error starting on line 37.

In this case new_list is only assigned to inside a conditional. If words is set, then the if condition fails and the block is skipped. Execution resumes at line 43. The return will fail because new_list has no value.

I suspect the if was only supposed to be for the following line to load the dictionary. But the indentation as written keeps the rest of the function inside until the final return.
Reply


Messages In This Thread
RE: Python linter Pylance: What does "(variable): List | Unbound" mean? - by bowlofred - Oct-23-2020, 08:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Split string using variable found in a list japo85 2 1,308 Jul-11-2022, 08:52 AM
Last Post: japo85
  An IF statement with a List variable dedesssse 3 8,301 Jul-08-2021, 05:58 PM
Last Post: perfringo
  How to define a variable in Python that points to or is a reference to a list member JeffDelmas 4 2,661 Feb-28-2021, 10:38 PM
Last Post: JeffDelmas
  Create variable and list dynamically quest_ 12 4,441 Jan-26-2021, 07:14 PM
Last Post: quest_
Question Matching variable to a list index Gilush 17 5,920 Nov-30-2020, 01:06 AM
Last Post: Larz60+
  Print variable values from a list of variables xnightwingx 3 2,649 Sep-01-2020, 02:56 PM
Last Post: deanhystad
  "parameter"is possibly unbound CJ_JOYCE 0 4,856 Aug-23-2020, 10:17 AM
Last Post: CJ_JOYCE
  Multiplication between a list and a variable doug2019 2 2,180 Oct-08-2019, 04:10 AM
Last Post: doug2019
  Sub: Python-3: Better Avoid Naming A Variable As list ? adt 9 4,049 Aug-29-2019, 08:15 AM
Last Post: adt
  Score each word from list variable pythonias2019 6 3,378 Jun-13-2019, 05:44 PM
Last Post: gontajones

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020