Is Python type safe?

后端 未结 8 1518
猫巷女王i
猫巷女王i 2021-01-30 17:14

According to Wikipedia

Computer scientists consider a language \"type-safe\" if it does not allow operations or conversions that violate the rules of the

8条回答
  •  隐瞒了意图╮
    2021-01-30 17:46

    We just had a big error in a piece of code. The error was because we had this:

       if sys.errno:
            my_favorite_files.append(sys.errno)
    

    instead of this:

        if args.errno:
            my_favorite_files.append(sys.errno)
    

    The aggressive casting anything to Boolean because it makes if statements easier is something that I would not expect to find in a language that is type-safe.

提交回复
热议问题