in java, the following code defines an array of the predefined class (myCls):
myCls arr[] = new myCls
how can I do that in python? I want to have an array of type (myCls)?
thanks in advance
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Python is dynamically typed. You do not need to (and in fact CAN’T) create a list that only contains a single type:
If you require it to only contain a single type then you’ll have to create your own list-alike, reimplementing the list methods and
__setitem__()yourself.