[New-bugs-announce] [issue47202] Feature request: Throw an error when making impossible evaluation against an empty list
Luminair
report at bugs.python.org
Sat Apr 2 11:22:18 EDT 2022
New submission from Luminair <luminair at gmail.com>:
Below are four examples of impossible code that operates on nothing. The latter two continue silently, throwing no errors. I saw a bug sneak by because of this. I wonder if it is within the scope of Python's design to throw Exceptions in these situations?
x =
for x in : print("This code is never reached")
while(None): print("This code is never reached")
emptylist = []
for x in emptylist:
if emptylist[x] == "This code is never reached":
print("This code is never reached")
else: print("This code is never reached")
----------
components: Parser
messages: 416559
nosy: Luminair, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Feature request: Throw an error when making impossible evaluation against an empty list
type: enhancement
versions: Python 3.11
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47202>
_______________________________________
More information about the New-bugs-announce
mailing list