3 ms·
The things he's talking about have nothing to do with Python. If you have a per-application instance of a class, you can't use instance data for request-specif
by jrockway 15y ago
The things he's talking about have nothing to do with Python. If you have a per-application instance of a class, you can't use instance data for request-specific things. The reason is because the per-application class is per-application, not per-request. (If you clone the per-application class for each request, then it's OK, but still a little weird. Any operation that needs state to be initialized and thrown away is exactly why you create an instance of a class.)
Really, anything that changes instance data outside the constructor should worry you. And actually, Python's habit of requiring you to initialize attributes in __init__ is kind of annoying; stuff like Perl's Moose is much cleaner.