Skip to content

Instantly share code, notes, and snippets.

@soar
Created April 14, 2017 14:55
Show Gist options
  • Select an option

  • Save soar/4958bb0ad49365aa520c26bc0962c983 to your computer and use it in GitHub Desktop.

Select an option

Save soar/4958bb0ad49365aa520c26bc0962c983 to your computer and use it in GitHub Desktop.
Python Types
class Test(object):
a = ''
b = {}
def __init__(self, a, b):
self.a = a
self.b.update({b: b})
def __str__(self):
return "a: {!s}, b: {!s}".format(self.a, self.b)
v1 = Test('v1-a', 'v1-b')
v2 = Test('v2-a', 'v2-b')
print('v1: {!s}'.format(v1))
print('v2: {!s}'.format(v2))
@soar
Copy link
Author

soar commented Apr 14, 2017

v1: a: v1-a, b: {'v2-b': 'v2-b', 'v1-b': 'v1-b'}
v2: a: v2-a, b: {'v2-b': 'v2-b', 'v1-b': 'v1-b'}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment