Giter Site home page Giter Site logo

Comments (2)

cooperlees avatar cooperlees commented on July 18, 2024

Thanks for asking before spending the time on the PR and us potentially saying nope.

  1. I'd accept it - Thought I do feel cpython/implementations should error on this
  2. I'd accept it ... Anything that is usless / pointless and not covered by a more specific flake8 plugin is welcome here

With this one, are you only checking that there is always explicit returns at the end of a function's body? You're never worrying about the type right as I feel mypy / other type checkers will get that.

  • If so, I'd accept that too.

I don't feel the need for any of these to be optional. They all seems sane to me. But would love another contributor or users views ...

from flake8-bugbear.

JelleZijlstra avatar JelleZijlstra commented on July 18, 2024

Agree 1 and 2 are good.

3 is probably better left to a type checker; mypy already has a similar check. In general, it requires type information to know whether a function always returns. Some examples:

def int_or_die(s: str) -> int:
    try:
        return int(s)
    except ValueError:
        sys.exit(1)

def does_it_return() -> int:
    while True:
        try:
            return int(raw_input())
        except ValueError:
            continue

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.