Opened 6 years ago

#7217 enhancement new

twisted.python.deprecate.deprecated should deprecate attribute access when used on a method

Reported by: Jean-Paul Calderone Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author:

Description

This example should emit a deprecation warning:

from twisted.python.deprecate import deprecated
from twisted.python.versions import Version

class Foo(object):
    @deprecated(Version("foo", 1, 2, 3))
    def bar(self):
        pass

Foo().bar

This would ensure that folks see a warning if they only read an attribute that is going to be removed even if they don't proceed to call it (as a bonus, in some rare cases it might also point at a better location - if you read a method and pass it off somewhere else before it is called, you'd really like to know where it was read).

Change History (0)

Note: See TracTickets for help on using tickets.