News for hackers. Stuff that matters.
Re:I'm Switching to Python and Actually Liking It by MyOutfitIsVague on Wednesday July 16, 2025 @05:09PM (#44586801)
Nope, it's more complicated than that:

    e = 'before'
    try:
        x = int('cat')
    except Exception as e:
        e2 = e
        print(e)
    print(e2) # <- This works!
    print(e)  # <- NameError: name 'e' is not defined
It's not a scoping thing, the bound exception variable is actually deleted after the exception block, even if it was already bound before!
Re:I'm Switching to Python and Actually Liking It by librasteve on Thursday July 17, 2025 @02:36AM (#44590372)
lol - raku maybe weird, but at least it has sane variable scoping