DarkMio•

Someone trying to prove that python can be clusterfuck.

10
ApproachingCorrectOP•

I was an extremely happy man when I learned about arrays and other more elegant data structures.

3
DarkMio•

Python loves hashing and variable lists. It's so easy to fiddle with and it behaves like JSON would. If you know what you're doing, you can do quickly a lot of tasks at once without writing super verbose XML bullshit.

3
Rdfghhj•

Trwtf is that it doesn't complain about contradictory ways of calculating the same value.

4
ApproachingCorrectOP•

Every time I look at it there's a new thing that's just a little off

1
innrautha•

In python, does defining the function (main) inside the while loop mean that for each iteration python will create a new function (identical to the one it just got rid of)?

2
ApproachingCorrectOP•

Wow, I didn't even notice I did that. I'm surprised function definitions re even allowed inside a loop.

I'm honestly not too sure, it seems like something the compiler would optimize out (since the exact same code is running). In actuality... I wonder if this code would cause a memory leak if it went through enough loops.

2
innrautha•

it seems like something the compiler would optimize out

Not sure if that'd be a trivial optimization since loops have to be executed for the computer to know what happens in them (halting problem and all that), I'm sure you could create some weird function definition that changes based on the state of the program (which would be worthy of it's own post on this sub).

Python should free the memory of functions that no longer have a valid reference to them. I don't know much about Python's inner memory workings to say for sure.

4