On Tue, 26 Jun 2018 10:20:38 +0200, Antoon Pardon wrote:

>> def test():
>>     a = 1
>>     b = 2
>>     result = [value for key, value in locals().items()]
>>     return result
[...]

> I would expect an UnboundLocalError: local variable 'result' referenced
> before assignment.

Well, I did say that there's no right or wrong answers, but that 
surprises me. Which line do you expect to fail, and why do you think 
"result" is unbound?



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to