In [ ]:
%reload_ext nbtutor
In [ ]:
%%nbtutor -r -f
class Foo(object):
two_default = 3.2
def __init__(self, one, two=None):
self.one = one
self.two = two
if two is None:
self.two = self.two_default
def bar(self, eggs):
self.two = self.one * eggs
return self.two
foo = Foo(10)
ans = foo.bar(100)
In [ ]:
%%nbtutor -r -f -i
class Foo(object):
two_default = 3.2
def __init__(self, one, two=None):
self.one = one
self.two = two
if two is None:
self.two = self.two_default
def bar(self, eggs):
self.two = self.one * eggs
return self.two
foo = Foo(10)
ans = foo.bar(100)
In [ ]:
%%nbtutor -r -f --nolies
class Foo(object):
two_default = 3.2
def __init__(self, one, two=None):
self.one = one
self.two = two
if two is None:
self.two = self.two_default
def bar(self, eggs):
self.two = self.one * eggs
return self.two
foo = Foo(10)
ans = foo.bar(100)
In [ ]:
%%nbtutor -r -f -d 5
class Base(object):
def __init__(self, one):
self.one = one
class Foo(Base):
def __init__(self, one, two):
super(Foo, self).__init__(one)
self.two = two
foo = Foo(10, 20)
In [ ]: