0

I have the following problem in Visual Studio Code 2019 where Anaconda python 3.7.4 64-bit intepretator is used. I am trying to create a list using the following python code:

my_list = [1, 2, 3]

However instead of creating the list compiler initializes the tuple since the following code

type(my_list)

returns (class 'tuple') which should be the case if I use round brackets or no brackets at all like in the following code

my_list = 1, 2, 3

My guess is that Visual Code by some reasons ignores the fact that I am providing the square brackets. Similar problem has been discussed in this post Can't type certain square brackets in Visual Studio 2010 + Resharper.

Please help me to figure out the problem related to the Visual Studio ignorance of square brackets.

Will be very greatfull for help!

Bogdan
  • 864
  • 10
  • 18
  • Is there anything else in between `my_list = [1, 2, 3]` and `type(my_list)`? Your code might have unwittingly changed the `type` in between. Also did you try another Python interpreter? – r.ook Oct 21 '19 at 13:15
  • There is no additional code in between and in other redactors it works fine. I have not been trying to use alternative interpreters. – Bogdan Oct 21 '19 at 13:19
  • 1
    Regional/Language setting is English on your OS and VSCode? Try the stock Python interpreter if you could and see the problem persists. Other than these suggestions I'm afraid I can't be helpful as I can't produce the same results. – r.ook Oct 21 '19 at 13:27
  • Thank you very much for suggestion! I will make these steps and response if it helps. – Bogdan Oct 21 '19 at 13:30
  • Can you provide a complete code snippet of what you're seeing? – Brett Cannon Oct 21 '19 at 23:36

1 Answers1

1

I face the similar (or the same?) issue when running ptpython inside console in the editor area. When I press [, ], <, > and some other symbols I can't enter them. Also if I paste a snippet with those symbols, they are ignored and didn't appear in the code.

When I hold ALT while typing [, ], <, > then it helps to type.

I found this inconvenient and switch to regular console (not in editor area). There I don't have such issue.

BTW, check that you can type the symbols in other filetypes. If so, then check hotkeys whether something bound to [ and ].

Maxim Suslov
  • 4,335
  • 1
  • 35
  • 29