Giter Site home page Giter Site logo

Comments (5)

mimre25 avatar mimre25 commented on September 19, 2024 2

Oh snap, I actually ran this on a quite big code-base as a test and I didn't have any false positives reported.

I'll take a look and see if I can fix this.

Thanks for reporting this and tagging me 🙂

from flake8-bugbear.

cooperlees avatar cooperlees commented on September 19, 2024 1

Agree this looks a bad / annoying false positive. Will take a fix for this asap and release.

Thanks for reporting.

from flake8-bugbear.

mikaelarguedas avatar mikaelarguedas commented on September 19, 2024

cc @mimre25 for feedback on this as it may also impact the ruff implementation

from flake8-bugbear.

wxtim avatar wxtim commented on September 19, 2024

Looks similar to

mydicts = {'a': {'foo': 1, 'bar': 2}}

for mydict in mydicts:
    if mydicts.get('a', ''):
        print(mydict['foo'])

B038 is complaining about any instance of an object method called inside the loop that object is the iterator for, without checking whether the loop is modifying it.

from flake8-bugbear.

Skrethel avatar Skrethel commented on September 19, 2024

I've also encountered this false positive for copy() function

d = {}
for _ in d:
	copied = d.copy()

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.