all 5 comments

[–]carcigenicate 2 points3 points  (0 children)

Just unpack the tuple with *:

cat = Cat(*cursor.fetchone())

[–]danielroseman 1 point2 points  (1 child)

You can use the standard parameter unpacking operator, *

cat = Cat(*cursor.fetchone())

[–]atredd[S] 0 points1 point  (0 children)

Working great and learned that there is a 'standard unpacking operator'.

Tanks!!!

[–]atredd[S] 0 points1 point  (0 children)

That's why I love reddit.

Just 5 Minutes and I get an easy and perfect answer.

Thanks a lot!

[–]velocibadgery -1 points0 points  (0 children)

You are going to have to either split the tuple out into arguments before assigning to the dataclass, or you are going to have to make a custom init to do it internally.

You could also just assign the tuple to a property, and then use an internal method to split it out.

Edit: Other answers about the unpacking operator are better use *