On Jun 29, 2011, at 2:46 PM, Torsten Landschoff wrote: > Hi Michael, > > On Tue, 2011-06-28 at 10:28 -0400, Michael Bayer wrote: > >>> ClassManager class is not documented. What should I be using instead? >> >> Instrumentation has to establish state on a new object independent of >> __new__() - during pickling, the state is restored naturally as >> __dict__ is restored, during fetch of rows, new_instance() is used, >> during normal construction, __init__() is used. >> >> class_manager() is documented we'd only need to get new_instance() and >> the use case documented, seems to me that would be bug fixed. > > Fine with me. Thanks! :-) > > Still I wonder why __init__ is still supported when using ORM mapped > classes and __new__ is not. Is there any reason why the latter is harder > to support? Or is it a matter of too little gain (who is using __new__ > anyway?) for too much work?
I'm not sure offhand if __new__() can be wrapped in a monkeypatch the way we do for __init__(), or if so what are the side effects of that, and it also would mean there's no way to create a new instance without ._sa_instance_state being tacked on. Particularly with pickling this is problematic. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
