Mutable Type Example : Subclass : Class PYTHON TUTORIALS


PYTHON TUTORIALS » Class » Subclass »

 

Mutable Type Example


class SortedKeyDict(dict):
    def keys(self):
        return sorted(super(
            SortedKeyDict, self).keys())

d = SortedKeyDict((('A'67)('B'68),('C'2)))
print 'By iterator:'.ljust(12)[key  for key  in d]
print 'By keys():'.ljust(12), d.keys()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Class
» Subclass