New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

Currently, if you try to subscript a non-generic type you will get an error:

>>> int[str]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'type' object is not subscriptable

Yes, 'type' objects are usually not subscriptable, but list[str] works, and it 
is not clear from the error message for what type it is failed.

The following PR changes an error message:

>>> int[str]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: type 'int' is not subscriptable

----------
components: Interpreter Core
messages: 414573
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Improve error message for subscripting non-generic types
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46927>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to