Issue
What I have:
I am creating a dataclass and I am stating the types of its elements:
class Task():
n_items: int
max_weight: int
max_size: int
items: numpy.array(Item) # incorrect way of doing it
What I want to do
I'd like to declare, that items will be a numpy array of obejcts of class "Item"
Solution
You can put ndarray
:
import numpy as np
class Task():
n_items: int
max_weight: int
max_size: int
items: np.ndarray
Answered By - Grzegorz Skibinski
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.