You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a class that inherits from NamedTuple,I have compile it to pyd file on windows use cython,when I import the class and create a object in another py file,It throws error TypeError: new() takes 1 positional argument but 4 were given, the class as follows:
from typing import NamedTuple
class Info(NamedTuple):
service: str
damage: str
privilege: str
info = Info("http", "no", "no")
when I don't compile it to pyd,It can use normally,How to deal with it?
The text was updated successfully, but these errors were encountered:
beruhan
changed the title
python3.6 cython nametuple TypeError
python3.6 Cython nametuple TypeError
Apr 10, 2019
What you can do is to simply not use namedtuple at all. Run this code in regular Python, then print out the Info._source attribute. This is a copy of the equivalent code to define the class - just cythonise that. Get rid of the builtins imports though, Cython can do those better.
I have a class that inherits from NamedTuple,I have compile it to pyd file on windows use cython,when I import the class and create a object in another py file,It throws error TypeError: new() takes 1 positional argument but 4 were given, the class as follows:
when I don't compile it to pyd,It can use normally,How to deal with it?
The text was updated successfully, but these errors were encountered: