Phillip J. Eby wrote: > I suggest changing this to something like this: > > class tag(object): > def __init__(self,name): > self.name = name > def __enter__(self): > print "<%s>" % name > def __exit__(self): > print "</%s>" % name > > with tag('html'): > # ... etc. > > So that it's obvious where the implementation is coming from. > Otherwise, it looks altogether too magical.
Done - included in the latest version on SF. [1] > Also, the posted draft doesn't explain what happens to the __enter__ > return value, either in a literal sense or in the sense of where it fits > in the overall concept of context management. I've tried to clarify this by showing usage of the closing() context manager. Cheers, Nick. [1] http://www.python.org/sf/1234057 -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.blogspot.com _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com