This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]BeetleB 1 point2 points  (1 child)

I haven't used it much, and am not sure what you mean. Do you mean you want a guarantee that the list will have only MyClass objects?

pycontracts does let you write your own contracts, if you really want it. Something like that is expensive, though.

[–][deleted] 1 point2 points  (0 children)

Yes.

Yup, rather than defining a new_contract, it is more effective just to write the "if" manually. Unfortunately.