• vga@sopuli.xyz
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    9 hours ago

    Yeah, I figured there would be a workaround. Also

    >>> (10).years()
    Traceback (most recent call last):
      File "<python-input-0>", line 1, in <module>
        (10).years()
        ^^^^^^^^^^
    AttributeError: 'int' object has no attribute 'years'
    

    But the other thing is also: can you add methods to the int class so that they’re available everywhere? I suspect that you cannot in python, at least without significant hackery. And I also suspect that it’s probably something they decided to prevent knowingly.