Giter Site home page Giter Site logo

B909 improvements about flake8-bugbear HOT 4 OPEN

mimre25 avatar mimre25 commented on September 19, 2024 1
B909 improvements

from flake8-bugbear.

Comments (4)

JelleZijlstra avatar JelleZijlstra commented on September 19, 2024

Thanks for writing this up.

Assign and AnnAssign can be ignored, since they just rebind the name, they do not mutate the container. (foo: T += 3 and similar are syntax errors.) Similarly, I wouldn't worry about the attribute setting mechanisms (setattr/delattr/etc.), because you can't set an attribute on builtin containers like list, tuple, set, and dict. There could be user-defined subclasses where setting an attribute interferes with iteration, but that feels too speculative for a lint rule.

from flake8-bugbear.

mimre25 avatar mimre25 commented on September 19, 2024

A good catch with Assign and AnnAssign.

Regarding the syntax errors: you're right - AugAssign and AnnAssign cannot be mixed.

What do you think about del?
Should we also remove that, when it only targets the container itself instead of an element inside of it?

from flake8-bugbear.

JelleZijlstra avatar JelleZijlstra commented on September 19, 2024

We should catch del container[i], but not del container.

from flake8-bugbear.

mimre25 avatar mimre25 commented on September 19, 2024

Sounds good to me.

I'll implement these improvements some time next week 🙂

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.