Quick survey: locals in comprehensions (Python 3 only)
Steven D'Aprano
steven.d'aprano at 1
Sun Jun 24 06:03:20 EDT 2018
From: Steven D'Aprano <steve+comp.lang.python at pearwood.info>
I'd like to run a quick survey. There is no right or wrong answer, since this
is about your EXPECTATIONS, not what Python actually does.
Given this function:
def test():
a = 1
b = 2
result = [value for key, value in locals().items()]
return result
what would you expect the result of calling test() to be? Is that the result
you think is most useful? In your opinion, is this a useful feature, a
misfeature, a bug, or "whatever"?
I'm only looking for answers for Python 3. (The results in Python 2 are
genuinely weird :-)
--
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing it everywhere."
-- Jon Ronson
--- BBBS/Li6 v4.10 Toy-3
* Origin: Prism bbs (1:261/38)
More information about the Python-list
mailing list