[Greg Ewing] > How about user-defined keywords? > > Suppose you could write > > statement opening > > def opening(path, mode): > f = open(path, mode) > try: > yield > finally: > close(f) > > which would then allow > > opening "myfile", "w" as f: > do_something_with(f) [etc.]
This one is easy to reject outright: - I have no idea how that would be implemented, especially since you propose allowing to use the newly minted keyword as the target of an import. I'm sure it can be done, but it would be a major departure from the current parser/lexer separation and would undoubtedly be an extra headache for Jython and IronPython, which use standard components for their parsing. - It doesn't seem to buy you much -- just dropping two parentheses. - I don't see how it would handle the case where the block-controller is a method call or something else beyond a simple identifier. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ 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