Skip to content

Instantly share code, notes, and snippets.

@audy
Created October 28, 2010 22:47
Show Gist options
  • Select an option

  • Save audy/652499 to your computer and use it in GitHub Desktop.

Select an option

Save audy/652499 to your computer and use it in GitHub Desktop.
a cute little matrix object
class matrix(list):
""" A cute little matrix object """
def __init__(self, x, y):
""" initialize """
[ self.append([0]*x) for i in range(y) ]
def __repr__(self):
""" niceprint """
return '\n'.join([ ' '.join([str(j) for j in i]) for i in self ])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment