Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[enchancement] Fix error message when trying to delete builtin #138890

@sergey-miryanov

Description

@sergey-miryanov

Feature or enhancement

Proposal:

Following code produces not very clear error message (IMHO)

>>> all
<built-in function all>
>>> all in globals()
False
>>> del all
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    del all
        ^^^
NameError: name 'all' is not defined

On my sight it well be better to tell that builtin cannot be deleted.

(fixed can be to cannot be)

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions