Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Visual Studio Code
#2
(May-16-2023, 09:52 PM)NewPi Wrote: I use Visual Studio Code and the Python extension.
When I hover over "random.choices(...)" it shows, that choices is a variable.

I don't understand. Isn't it a function?
It's a method if look at source code.
Why it show a variable,is that in source there is this line choices = _inst.choices
So _inst.choices is the method,if hover over will return.
(method) def sample(
    population: Any,
    k: Any,
    *,
    counts: Any | None = None
) -> (list | Any)

Chooses k unique random elements from a population sequence.
.....
You can get to this code bye press Ctrl and click when hover over choices.
[Image: owVChQ.png]
Reply


Messages In This Thread
Visual Studio Code - by NewPi - May-16-2023, 09:52 PM
RE: Visual Studio Code - by snippsat - May-16-2023, 10:56 PM
RE: Visual Studio Code - by NewPi - May-16-2023, 10:58 PM
RE: Visual Studio Code - by snippsat - May-16-2023, 11:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  My code works on Jupyter Lab/Notebook, but NOT on Visual Code Editor jst 4 1,279 Nov-15-2023, 06:56 PM
Last Post: jst
  How to set PYTHONPATH in Visual Studio Code? aupres 5 4,825 Aug-15-2023, 03:51 PM
Last Post: snippsat
  how do I open two instances of visual studio code with the same folder? SuchUmami 3 1,015 Jun-26-2023, 09:40 AM
Last Post: snippsat
  Visual Studio Code venv ibm_db error mesi1000 7 2,978 Nov-13-2022, 12:36 AM
Last Post: snippsat
  debugging help on Visual Studio Code mg24 12 2,178 Oct-02-2022, 12:18 AM
Last Post: mg24
  Problem with importing Python file in Visual Studio Code DXav 7 5,450 Jun-15-2022, 12:54 PM
Last Post: snippsat
  Visual Studio Code Intellisense for Imported Modules Not Working hockinsk 1 2,817 Apr-23-2022, 04:41 PM
Last Post: deanhystad
Photo Visual studio code unable to color syntax on python interpreter tomtom 4 7,186 Mar-02-2022, 01:23 AM
Last Post: tomtom
  compile error Visual Studio Code jamie_01 2 1,760 Jan-25-2022, 09:36 AM
Last Post: Larz60+
  Calling python from c++ in visual studio pdk5 0 2,213 May-24-2021, 10:18 AM
Last Post: pdk5

Forum Jump:

User Panel Messages

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