Giter Site home page Giter Site logo

Comments (4)

cooperlees avatar cooperlees commented on September 17, 2024

Can you elaborate a little more on you exact idea of:
a) What it check for? (Seems like if it's used you want to warn)
b) What you're going to suggest or state as the remediation for the developer.

from flake8-bugbear.

ambv avatar ambv commented on September 17, 2024

There's nothing inherently wrong with the use of eval. What would you like the warning to say?

from flake8-bugbear.

gopar avatar gopar commented on September 17, 2024

I was taught to never use eval, for the times that I thought I needed eval, I instead went with ast.literal_eval. I guess it depends what you're passing into the function.

from flake8-bugbear.

joaoe avatar joaoe commented on September 17, 2024

If someone uses eval it is quite explicit that eval is being used.

The original problems with eval come from the old javascript days of developers having no idea how to code the language and using eval and copy-pasting the same code snippets everywhere.

In python so far, all use of eval I've seen and that I've used myself has been solely to work around syntax that is invalid in Python2 or 3, e.g., print or exec being keywords and not functions, or the syntax differences of the raise statement.

I do think eval should be used sparingly, but I doubt there is a big benefit about warning about its use, since it is very explicit that eval is being used somewhere.

from flake8-bugbear.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.