News for hackers. Stuff that matters.
Re:I'm Switching to Python and Actually Liking It by MyOutfitIsVague on Wednesday July 16, 2025 @05:12PM (#44586835)
> Compare with the if statement, where the variable in the expression being tested will necessarily be defined.

    if False:
        x = 7
    print(x)

    print(x)
          ^
    NameError: name 'x' is not defined
Ruby does this sort of stuff, where a variable is defined more or less lexically (nil by default). Python doesn't do this. You can have local variables that only maybe exist in Python.

There are no comments on this comment yet.