Python - a set of one type only
I want to create a Set class in Python, but unlike the set class that
already implemented in Python, I want my set to contain elements of only
one type. For example a set of integers, a set of strings and a set of any
other user defined class.
Is there any way in Python to pass the type as a parameter to the class?
or any other way to do it?
I was thinking about using dict to implement the set but dicts can contain
elements from different types.
Thank you for your help!
No comments:
Post a Comment