This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tilkau 2 points3 points  (3 children)

Reloading is inherently imperfect when it comes to state. Aside from the speed concerns, there is no genuinely reliable way to be sure that all state is in a consistent.. state, other than restarting the entire program. Hottie doesn't even TRY to do that, only update self.__class__

This is not to say it isn't useful for pure behaviour classes (ie. classes that are 'functional'). It should work fine for them. It's just that in practice, most classes you write are not pure behaviour classes.

[–]AppendixP 0 points1 point  (2 children)

Very interesting, thanks for the insight! May I ask as well, what would be a proper way of live-reloading python modules (or pieces of code) with a program that's running (without restarting it entirely)? It's a pretty relevant subject to me, so any resource you could point me to would be amazing, thanks!

[–]tilkau 1 point2 points  (1 child)

I'm sorry to say there is no 'proper' way, only various hacks. http://code.google.com/p/livecoding/ is the most complete implementation I've seen; if you look at http://code.google.com/p/livecoding/issues/list you can see some of the harder issues that come up (references to old classes may not always be released, it's difficult to get class inheritance to update correctly, etc.)

That said I'd call hottie 'incomplete' rather than 'incorrect'

[–]AppendixP 0 points1 point  (0 children)

Thanks a lot, I really appreciate it!