MCPcopy Index your code
hub / github.com/RustPython/RustPython / rev

Method rev

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

Source from the content-addressed store, hash-verified

2913 class madstring(str):
2914 _rev = None
2915 def rev(self):
2916 if self._rev is not None:
2917 return self._rev
2918 L = list(self)
2919 L.reverse()
2920 self._rev = self.__class__("".join(L))
2921 return self._rev
2922 s = madstring("abcdefghijklmnopqrstuvwxyz")
2923 self.assertEqual(s, "abcdefghijklmnopqrstuvwxyz")
2924 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