PyCQA / PyCQA/flake8-bugbear

B305 triggered for methods in regular objects

Open
#59 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.1k
Forks
123
Avg merge
2d 5h
Merged PRs (30d)
5

Description

class A:

    def next(self):
        return 'x'

The code above triggers "B305: .next() is not a thing on Python 3. Use the next() builtin. For Python 2 compatibility, use six.next()". While the code has other problem (shadowing builtin name), it is not related to generator.next() removed in Py3.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the B305 warning with the regular-object example and locate the B305 implementation and its existing tests. Confirm that generator.next() compatibility warnings still work while a regular object's next method is not reported, then add a regression test for the distinction.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.