MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/48rb5l/top_30_mind_bending_python_interview_questions/d0lys8e/?context=3
r/Python • u/AkashDaniel • Mar 03 '16
8 comments sorted by
View all comments
1
Here's a mind bender...
def foo(): a = [] a.extend([a] for _ in range(10)) del a
Why does this fail with a syntax error in Python 2?
Edit: bracketed too much.
2 u/[deleted] Mar 03 '16 it doesn't 1 u/[deleted] Mar 03 '16 ...fuck, I always remember that wrong. Fixed now.
2
it doesn't
1 u/[deleted] Mar 03 '16 ...fuck, I always remember that wrong. Fixed now.
...fuck, I always remember that wrong. Fixed now.
1
u/[deleted] Mar 03 '16 edited Mar 03 '16
Here's a mind bender...
Why does this fail with a syntax error in Python 2?
Edit: bracketed too much.