overloading.py
overloading.py copied to clipboard
AttributeError: module 'typing' has no attribute 'TypingMeta'
for some reason my program throws this error rooted in this lib. when i try to simply overload the init of my class. Code:
from overloading import overload
import cmath
class Quaternion:
def __init__(self, r: int, i: int, j: int, k: int):
self.r = r
self.i = i
self.j = j
self.k = k
@overload
def __init__(self, c: complex):
self.r = c.real
self.i = c.imag
print(Quaternion(1, 2, 3, 4).r)
print(Quaternion(1 + 2j).r)
Error:
Traceback (most recent call last): File "C:...\Python\Python37\lib\site-packages\overloading.py", line 63, in overload return register(__registry[fname], func) KeyError: 'main.Quaternion.init'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:...\Python\Testing\quaternion.py", line 6, in
Same here, python 3.7
The downgrade of the typing module helped me (from the python repository) to version 3.5.2.2.
You can also forcefully ignore the typing module in the overloading module by assigning typing = None after the 30th line in the file overloading.py, but I think the typing module features will not be available.
such an unfortunately infomation ! we want use python3; this maybe an solution for overload: https://python3-cookbook.readthedocs.io/zh_CN/latest/c09/p20_implement_multiple_dispatch_with_function_annotations.html
The downgrade of the typing module helped me (from the python repository) to version 3.5.2.2. You can also forcefully ignore the typing module in the overloading module by assigning
typing = Noneafter the 30th line in the fileoverloading.py, but I think the typing module features will not be available.
Same issue here. Downgrading all the way to 3.5 sounds like a major hassle.
I have the same issue. @bintoro If you ask me, this project should be archived, since it's not in active development and does not work for the newest versions of python.