mercredi 15 juin 2016

Traits for SortedListWithKey


I am using a SortedListWithKey class from the new sortedcontainers module (link). Is there a way to adapt the List trait to specify that I want a SortedListWithKey(Instance(SomeClass), key=some_key)?

To be more specific, how can achieve something like:

from traits.api import HasTraits, Instance, SortedListWithKey # i know it cannot really be imported

class MyClass(HasTraits):
    sorted_list = SortedListWithKey(Instance(ElementClass)) 

Aucun commentaire:

Enregistrer un commentaire