Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Try as I might, I can't get that to raise an exception.

That said, agreed that this is weird. Python makes some really unintuitive choices regarding scope.



Ok. Try this.

    if input() == "dynamic scope?":
        defined = "happyhappy"
    print(defined)


it raises an exception if blahblah() returns False, because then b never gets defined.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: