Skip to content

Instantly share code, notes, and snippets.

@sloria
Last active March 5, 2019 17:27
Show Gist options
  • Select an option

  • Save sloria/5895679 to your computer and use it in GitHub Desktop.

Select an option

Save sloria/5895679 to your computer and use it in GitHub Desktop.
class Point:
def __init__(self, x, y):
self.x, self.y = x, y
@classmethod
def polar(cls, r, theta):
return cls(r * cos(theta),
r * sin(theta))
point = Point.polar(r=13, theta=22.6)
@ludat

ludat commented Feb 28, 2014

Copy link
Copy Markdown

missed one underscore on the second line

@sloria

sloria commented Feb 28, 2014

Copy link
Copy Markdown
Author

Fixed. Thanks for the suggestions!

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