Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small refactor #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

small refactor #14

wants to merge 1 commit into from

Conversation

tormich
Copy link

@tormich tormich commented Dec 26, 2020

  • build coords list in one go
  • same for heights
  • tuple assignment makes possible to switch colorA and colorB in one line
  • if __main__ is a standard python concept. I am putting it here to make Python gods happy

P.S.
Thank you for you videos. And math stendup is awesome! As well as the book!
I'm a big fan of yours 😄

- build `coords` list in one go
- same for `heights`
- tuple assignment makes possible to switch `colorA` and `colorB` in one line
- `if __main__` is a standard python concept. I am putting it here to make Python gods happy

P.S.
Thank you for you videos. And math stendup is awesome! As well as the book!
I'm a big fan of yours 😄
@EhsanKia
Copy link

There's a lot of complicated code for fixing the coordinate loading, here's a 3 liner that achieves the same:

import json
with open(coordfilename, 'r') as fin:
    coords = list(map(json.loads, fin.readlines()))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants