MCPcopy Index your code
hub / github.com/python/cpython / rev

Method rev

Lib/test/test_descr.py:3008–3014  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3006 class madstring(str):
3007 _rev = None
3008 def rev(self):
3009 if self._rev is not None:
3010 return self._rev
3011 L = list(self)
3012 L.reverse()
3013 self._rev = self.__class__("".join(L))
3014 return self._rev
3015 s = madstring("abcdefghijklmnopqrstuvwxyz")
3016 self.assertEqual(s, "abcdefghijklmnopqrstuvwxyz")
3017 self.assertEqual(s.rev(), madstring("zyxwvutsrqponmlkjihgfedcba"))

Callers

nothing calls this directly

Calls 4

listClass · 0.85
reverseMethod · 0.45
__class__Method · 0.45
joinMethod · 0.45

Tested by

no test coverage detected