On Python 3, __class__ can be used without self

Bug #1487725 reported by Ian Cordasco
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Pyflakes
New
Undecided
Unassigned

Bug Description

On Python 3, the following code raises a warning:

    class Test(object):
        def __init__(self):
            print(__class__.__name__)
            self.x = 1

    t = Test()

This is actually valid Python 3 code, but PyFlakes doesn't quite understand that:

    test.py:3: undefined name '__class__'

Tags: easy
Revision history for this message
Shyam Saladi (saladi) wrote :

Any movement on this? I keep getting warnings about this too.

John Vandenberg (jayvdb)
tags: added: easy
Revision history for this message
Meet (meet123mangukiya) wrote :

I'd like to take up this bug

Revision history for this message
Phil Frost (bitglue) wrote : Re: [Bug 1487725] Re: On Python 3, __class__ can be used without self

That would be much appreciated. Please submit your changes as a GitHub PR
when they are complete.

On Wed, Mar 22, 2017 at 3:35 PM Meet <email address hidden> wrote:

> I'd like to take up this bug
>
> --
> You received this bug notification because you are subscribed to
> Pyflakes.
> Matching subscriptions: all pyflakes bugs
> https://bugs.launchpad.net/bugs/1487725
>
> Title:
> On Python 3, __class__ can be used without self
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/pyflakes/+bug/1487725/+subscriptions
>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.