Skip to content

Instantly share code, notes, and snippets.

@ehermes
Created October 28, 2016 20:10
Show Gist options
  • Select an option

  • Save ehermes/960657f32ca96c4daa760ef3f6724120 to your computer and use it in GitHub Desktop.

Select an option

Save ehermes/960657f32ca96c4daa760ef3f6724120 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
class Foo(object):
def __new__(cls, *args, **kwargs):
new_foo = super(Foo, cls).__new__(cls)
new_foo.x = None
new_foo.y = None
new_foo.z = None
return new_foo
class Bar(Foo):
def __init__(self, x):
self.x = x
class Baz(Foo):
def __init__(self, y):
self.y = y
my_bar = Bar(1)
my_baz = Baz(2)
print(my_bar.x)
print(my_bar.y)
print(my_baz.x)
print(my_baz.y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment