[Python-Dev] PEP 343 updated with outcome of recent discussions
Once the cron job works it magic, the updated PEP 343 should be available on the website. As far as I am aware, there aren't any more open issues, so it is once again ready for BDFL pronouncement. I also tinkered with the example naming a bit, and added a new example for the nested context manager (it turns out there *were* mistakes in the last version I posted here - I had the deque method name wrong, and I wasn't invoking __context__ correctly on the nested contexts). Cheers, Nick. P.S. My availability will be sketchy for the rest of this weekend, then nonexistent until next weekend, so don't be surprised if I don't respond to messages before then. -- 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
Re: [Python-Dev] PEP 343 updated
Guido van Rossum wrote: On 10/16/05, Nick Coghlan [EMAIL PROTECTED] wrote: I hope you reverted the status to Proposed... I hadn't, but I've now fixed that in CVS (both in the PEP and the PEP index), and added some text into the PEP saying why it was reverted to Draft. On the latter: I think it shouldn't; I don't like this kind of magic. I'll have to read it before I can comment on the rest. I don't particularly like treating __with__ specially either, but I'm not sure I like the alternative. The alternative is that we'd never be able to safely define a __with__ method directly on generators - the reason is that we would want a def __with__ where the @context decorator has been forgotten to trigger a TypeError when it is used. If generator-iterators were to provide a context manager to automatically invoke close(), then leaving out @context would result in a very obscure bug (as g.close() would be used to finish the context, instead of g.next() or g.throw()). On the other hand, if the context decorator is invoked automatically when a generator function is supplied to populate the __with__ slot, then using a generator to define a __with__ method will just work, instead of only works if you also apply the context decorator Cheers, Nick. -- 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
Re: [Python-Dev] PEP 343 updated
Andrew Koenig wrote: PEP 343 has been updated on python.org. Highlights of the changes: - changed the name of the PEP to be simply The 'with' Statement Do you mean PEP 346, perchance? PEP 343 is something else entirely. No, I mean PEP 343 - it describes Guido's proposal for a with statement. The old name made perfect sense if you'd been part of the PEP 340 discussion, but was rather obscure otherwise. Cheers, Nick. -- 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
[Python-Dev] PEP 343 updated
PEP 343 has been updated on python.org. Highlights of the changes: - changed the name of the PEP to be simply The 'with' Statement - added __with__() method - added section on standard terminology (that is, contexts/context managers) - changed generator context decorator name to context - Updated Resolved Issues section - updated decimal.Context() example - updated closing() example so it works for objects without close methods I also added a new Open Issues section with the questions: - should the decorator be called context or something else, such as the old contextmanager? (The PEP currently says context) - should the decorator be a builtin? (The PEP currently says yes) - should the decorator be applied automatically to generators used to write __with__ methods? (The PEP currently says yes) Cheers, Nick. -- 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
Re: [Python-Dev] PEP 343 updated
On 10/16/05, Nick Coghlan [EMAIL PROTECTED] wrote: PEP 343 has been updated on python.org. Highlights of the changes: - changed the name of the PEP to be simply The 'with' Statement - added __with__() method - added section on standard terminology (that is, contexts/context managers) - changed generator context decorator name to context - Updated Resolved Issues section - updated decimal.Context() example - updated closing() example so it works for objects without close methods I also added a new Open Issues section with the questions: - should the decorator be called context or something else, such as the old contextmanager? (The PEP currently says context) - should the decorator be a builtin? (The PEP currently says yes) - should the decorator be applied automatically to generators used to write __with__ methods? (The PEP currently says yes) I hope you reverted the status to Proposed... On the latter: I think it shouldn't; I don't like this kind of magic. I'll have to read it before I can comment on the rest. -- --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
Re: [Python-Dev] PEP 343 updated
PEP 343 has been updated on python.org. Highlights of the changes: - changed the name of the PEP to be simply The 'with' Statement Do you mean PEP 346, perchance? PEP 343 is something else entirely. ___ 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