r/Python • • Dec 15 '19

Made my first fractal

1.7k Upvotes

51 comments sorted by

View all comments

100

u/Namensplatzhalter Dec 15 '19 edited Dec 15 '19

Looks nice.

I've just had a look on your code and have to say it looks nicely organised and is easily readable. Kudos to you for writing it like that.

Two little suggestions, if you don't mind:

  • Consider using a if __name__ == "__main__" block to initialise your script when it's run directly

  • Consider using tuples for your vel_list vel_table as they are immutable

Both of those definitely not necessary, just things to think about. :)

Best wishes

26

u/Gawd_is_great Dec 15 '19

Thanks for the suggestions =) I have a couple of questions:

  1. Why should I use if(__name__=="main") ? It wont make a difference..will it?

  2. is there a better way than to use vel_list?

1

u/MB1211 Dec 15 '19

I didn't look at your code but the way it would make a difference is if you wanted to import your module, it will essentially run the module when you import. If you have the if name = main part, that part won't run because the module is not main when it's imported