Skip to content

Instantly share code, notes, and snippets.

@tfiers
Last active December 17, 2015 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfiers/5522095 to your computer and use it in GitHub Desktop.
Save tfiers/5522095 to your computer and use it in GitHub Desktop.
"What does that function look like?"
class A:
def f(self, x): return self.f(x/2) + 1
class B(A):
def f(self, x=10):
if x < 0: return self.f(x+200) + 2
if x > 20: return A.f(self,x-50) + 3
else: return x
from pylab import *
t = arange(-1E2, 8E2, .1)
s = map(B().f, t)
plot(t, s, 'r.') # Plot t versus s as red dots.
show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment