Skip to main content
9 events
when toggle format what by license comment
Oct 2, 2022 at 19:27 history edited Reinderien CC BY-SA 4.0
added 2243 characters in body
Oct 2, 2022 at 18:57 comment added hexaquark This is amazing, thank you for your time and wisdom! I learned A LOT through this comment.
Oct 2, 2022 at 18:56 vote accept hexaquark
Oct 2, 2022 at 17:53 history edited Reinderien CC BY-SA 4.0
added 120 characters in body
Oct 2, 2022 at 16:45 history edited Reinderien CC BY-SA 4.0
added 242 characters in body
Oct 2, 2022 at 16:37 comment added Reinderien @ShapeOfMatter Recursion in general is indeed fun, but should be avoided like the plague in Python especially when iterative alternatives are available. With no tail optimisation and a very shallow stack, Python is uniquely ill-suited to recursion.
Oct 2, 2022 at 16:35 comment added ShapeOfMatter "rec should be redesigned so that it does not recurse" because the recursion is unbounded. Recursion in general is fun! In this case, just use something off the shelf. There's copypasta in itertools, or import more-itertools.unique_everseen so you can write self.particlesLocation = list(itertools.islice(unique_everseen(more-itertools.repeatfunc(get_random_canvas_value)), 5)), or something like that...
Oct 2, 2022 at 16:13 history edited Reinderien CC BY-SA 4.0
added 120 characters in body
Oct 2, 2022 at 15:59 history answered Reinderien CC BY-SA 4.0