Skip to content

__doc__ property #249

@dg-pb

Description

@dg-pb

Hello

I have a code:

class A:
    string = 'Hello'
    @property
    def __doc__(self):
        return self.string


class MyCustomProxy(wrapt.ObjectProxy):
    pass


if __name__ == '__main__':
    a = A()
    dmw = wrapt.ObjectProxy(a)
    dmwc = MyCustomProxy(a)
    print(dmw.__doc__)
    print(dmwc.__doc__)
    a.string = 'Yes'
    print(dmw.__doc__)
    print(dmwc.__doc__)

Result:

Hello
Hello
Yes
Hello

Python implementation of the proxy object calls doc from its ProxyObject.@Propert(doc).

However, C implementation hard-copies doc value to the proxy if inheriting from it.

Is this expected?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions