>> I'm working on a "TempFile" class that stores the data in memory until >> it gets larger than a specified threshold (as per PEP 42). Whilst >> trying to implement it, I've come across some strange behaviour. Can >> anyone explain this?
>> The test case at the bottom starts a TempFile at size 50 and prints its >> type. It then increases the size to the threshold at which point >> "self" is changed to being a TemporaryFile. > Changed how ?-) Just by being assigned with a TemporaryFile object. I thought that if you do instance = TempFile() that "instance" and "self" defined in the Class were the same thing so that if you changed the class of self, the class of instance would also change. Thanks very much for your example. It has solved my problem and helped me understand a new pattern at the same time. -- http://mail.python.org/mailman/listinfo/python-list