GzipFile as a Context manager
Is there a reason that the gzip.GzipFile class does not have __enter__ and __exit__ methods that mimic those of the file object? I expected the following to work but it doesn't: import gzip with gzip.open('temp.gz', 'w') as fhandle: gzip.write('Hello world.') If there is no reason to avoid this behavior should I submit a bug report and a subsequent patch? Thanks! -- -Mikolai Fajer- -- http://mail.python.org/mailman/listinfo/python-list
Abstract Base Class register function
I have been experimenting with the abc module in py3k and thought about using the register method of an ABC as a class decorator: import abc class MyABC(metaclass=abc.ABCMeta): pass @MyABC.register class MySub(): pass This doesn't work because the register method returns None. It would be a fairly simple modification to have this work: def register(cls, subclass): """Register a virtual subclass of an ABC.""" ... etc ... return subclass What do people think of this behavior? -- -Mikolai Fajer- -- http://mail.python.org/mailman/listinfo/python-list
Re: design pattern: MVC in python
The following link directly discusses using MVC and pygame. http://ezide.com/games/writing-games.html -- -Mikolai Fajer- -- http://mail.python.org/mailman/listinfo/python-list