Home > database >  How do i understand and customize this annotation in python?
How do i understand and customize this annotation in python?

Time:08-03

enter image description here

When i type something in Jupyternotebook by vscode and hover over the variable, some hints appear above.

What does that mean? i thought str was a object of class str.

CodePudding user response:

x=str(5)

If we only use the code you show, the IntelliSense we get should be like this:

enter image description here

So I think it's possible that you defined str before the line and assigned type list to this three letters "str".

So, this "str" is not the same as type Str. It's just a list named "str". str is a function and enter image description here

CodePudding user response:

You can not use str is valuable area name Python supports str as class https://docs.python.org/3/library/stdtypes.html#textseq

  • Related