Skip to content

improvements for gradually_worse_pi #18

Description

@danilovmy

Hello, Mark.
We have a small conversation on PyCon DE 2022 after your talk.
I have a small improvements for your "gradually_worse_pi"


class my_prop(math.__class__):
    _pi = math.pi`

    @property
    def pi(self):
        self._pi += 0.0001
        return self._pi

math.__class__ = my_prop

Here we have an inheritance from math module class, that's why we don't need override getattr and also we don't need change the sys import list.
Probably those code can be more elegant and Pythonic.

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