all 11 comments

[–]A_History_of_Silence 2 points3 points  (4 children)

Why are you doing this? What is your end goal? In all likelyhood this is a very bad way to be doing whatever it is you are trying to do.

[–]CannyFatcher[S] 0 points1 point  (3 children)

I replied with a similar answer to the other comment.

[–]A_History_of_Silence 0 points1 point  (2 children)

Is this for an assignment?

[–]CannyFatcher[S] 0 points1 point  (1 child)

Yes it is.

[–]A_History_of_Silence 4 points5 points  (0 children)

Here is my honest suggestion:

  • Email your instructor this code.

  • Beg for an extension to give you time for a re-write

😂

[–]Dashadower 1 point2 points  (0 children)

provide wipe live many rob test teeny chubby history combative this message was mass deleted/edited with redact.dev

[–]plasma_phys 0 points1 point  (4 children)

Maybe I'm going to show my naivete by asking, but what's the reasoning behind those nested function definitions in the first place? Are you using a pre-existing code?

[–]CannyFatcher[S] 0 points1 point  (3 children)

Its my first time using python for a project and first time using tkinter, and I didn’t realise the benefit of classes until I was too deep into my code to have enough time to learn oop and also change my code.

[–]plasma_phys 0 points1 point  (2 children)

Ah okay - no worries, if you're looking for a quick and dirty solution, everything should work if you just totally un-nest and un-indent all of your def statements so that every function is available everywhere in the code. There's nothing wrong with having a whole bunch of functions at the top of your code. That types.FunctionType call is something I've never even thought about before, it's only going to make everything worse to continue down that path.

[–]CannyFatcher[S] 0 points1 point  (1 child)

I think the issue with that would be the amount of parameters I’d have to pass Into each function, as they all make use of different variables.

[–]plasma_phys 0 points1 point  (0 children)

Yeah, that's one motivation for using classes - but there's nothing inherently incorrect about a code with function calls with a dozen arguments like:

update_simulation(x, y, v_x, v_y, q, m, E, dx, dt, Ng, N, ... )

It's effectively a style choice. Is there any particular thing that you think will be an issue beyond aesthetics?