[New-bugs-announce] [issue30402] Unexpected and/or inconsistent del behavior

Dan Snider report at bugs.python.org
Thu May 18 16:57:29 EDT 2017


New submission from Dan Snider:

k = 'k'
del [k]

That deletes the variable k from the local scope (even though it *looks* like it's trying to delete a list containing 1 element which is equivalent to the variable k).

But if using list literals to delete groups of objects is valid, then why not set literals?

del {k}
raises SyntaxError: can't delete literal

The better option imo would be to only allow tuples when del-ing groups of objects, but if list literals are allowed then set literals should be as well.

----------
components: Interpreter Core
messages: 293942
nosy: assume_away
priority: normal
severity: normal
status: open
title: Unexpected and/or inconsistent del behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30402>
_______________________________________


More information about the New-bugs-announce mailing list