• palordrolap@fedia.io
    link
    fedilink
    arrow-up
    4
    arrow-down
    1
    ·
    18 hours ago

    In most languages evals are, in a way, like gotos. You should aim to write your code with none at all, but they’re nice to have in a pinch if the project takes a turn and a rewrite might take time you don’t have. Just don’t put user-supplied strings through one and you’ll be fine. Probably.

    Also, in at least one language I can think of, there’s a variant of eval that works a lot like try in other languages. As such, I don’t think those should be considered the same thing.

    • Badabinski@kbin.earth
      link
      fedilink
      arrow-up
      1
      ·
      12 hours ago

      There are generally different degrees of eval as well. ast.literal_eval in Python is much more forgivable, and is the only reasonable way to handle data generated by chucklefucks who think simply stringifying a dict and writing it to a file is a reasonable serialization strategy.

      • luciferofastora@feddit.org
        link
        fedilink
        arrow-up
        1
        ·
        14 minutes ago

        chucklefucks who think simply stringifying a dict and writing it to a file is a reasonable serialization strategy.

        “Pickle, motherfucker, do you speak it?”