Re: [Python-Dev] Iterator version of contextlib.nested

2009-06-15 Thread Hagen Fürstenau
Part of the justification for the new with-statement syntax was that nested() doesn't have a way to finalize the constructors if one of them fails. I think the problem was a little bit more subtle: nested() gets passed managers, so their __init__()s should all have run when the first context

Re: [Python-Dev] Iterator version of contextlib.nested

2009-06-15 Thread Nick Coghlan
Hagen Fürstenau wrote: I actually almost asked for that to be changed to a PendingDeprecationWarning when it was first added - Benjamin, do you mind if I downgrade this warning to a pending one post rc2? I'm not sure what that would buy us. For the use case I mentioned it would be just as

Re: [Python-Dev] Iterator version of contextlib.nested

2009-06-15 Thread Hagen Fürstenau
Unlike a full DeprecationWarning, a PendingDeprecationWarning is ignored by default. You have to switch them on explicitly via code or a command line switch in order to see them. Sorry, I should have made myself more familiar with the warnings mechanism before writing. In that case I'm fine

Re: [Python-Dev] Iterator version of contextlib.nested

2009-06-15 Thread Nick Coghlan
Raymond Hettinger wrote: I suggest a PEP for 2.7 and 3.2 for building-out the with-statement to support tuples of context managers (perhaps modeled after the syntax for except-statements which allows either individual exceptions or tuples of exceptions). The reason I suggest a PEP is that

Re: [Python-Dev] CPython in the web browser under Native Client

2009-06-15 Thread Nick Coghlan
Mark Seaborn wrote: [3] http://lackingrhoticity.blogspot.com/2009/06/python-standard-library-in-native.html Very cool! Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ---

Re: [Python-Dev] python sendmsg()/recvmsg() implementation

2009-06-15 Thread Kálmán Gergely
Jean-Paul Calderone wrote: On Tue, 09 Jun 2009 16:46:54 +0200, Kálmán Gergely kalman.gerg...@duodecad.hu wrote: Hello, my name is Greg. I've just started using python after many years of C programming, and I'm also new to the list. I wanted to clarify this first, so that maybe I will get a

Re: [Python-Dev] python sendmsg()/recvmsg() implementation

2009-06-15 Thread Nick Coghlan
Kálmán Gergely wrote: Since I am not a python core developer the patch might still be in a pretty outdated state. I'd like someone to look it over and direct me to some documentation (the ones I've found so far were pretty sketchy), for it to be acceptable for inclusion. The sanity of the

Re: [Python-Dev] Exception for setting attributes of built-in type

2009-06-15 Thread Guido van Rossum
On Sun, Jun 14, 2009 at 4:19 PM, Guido van Rossumgu...@python.org wrote: In general, CPython isn't always consistent in raising AttributeError and TypeError when it comes to such policy issues: there are various places that raise TypeError in typeobject.c (and probably elsewhere) that simply

Re: [Python-Dev] [IronPython] Exception for setting attributes of built-in type

2009-06-15 Thread Dino Viehland
Guido wrote: I should add that this policy is also forced somewhat by the existence of the multiple interpreters in one address space feature, which is used e.g. by mod_python. This feature attempts to provide isolation between interpreters to the point that each one can have a completely

Re: [Python-Dev] [IronPython] Exception for setting attributes of built-in type

2009-06-15 Thread Michael Foord
Dino Viehland wrote: Guido wrote: I should add that this policy is also forced somewhat by the existence of the multiple interpreters in one address space feature, which is used e.g. by mod_python. This feature attempts to provide isolation between interpreters to the point that each one can

Re: [Python-Dev] [IronPython] Exception for setting attributes of built-in type

2009-06-15 Thread Guido van Rossum
On Mon, Jun 15, 2009 at 9:10 AM, Michael Foordfuzzy...@voidspace.org.uk wrote: Dino Viehland wrote: Guido wrote: I should add that this policy is also forced somewhat by the existence of the multiple interpreters in one address space feature, which is used e.g. by mod_python. This feature

Re: [Python-Dev] [IronPython] Exception for setting attributes of built-in type

2009-06-15 Thread Michael Foord
Guido van Rossum wrote: On Mon, Jun 15, 2009 at 9:10 AM, Michael Foordfuzzy...@voidspace.org.uk wrote: Dino Viehland wrote: Guido wrote: I should add that this policy is also forced somewhat by the existence of the multiple interpreters in one address space feature, which is

Re: [Python-Dev] Exception for setting attributes of built-in type

2009-06-15 Thread Benjamin Peterson
2009/6/15 Nick Coghlan ncogh...@gmail.com: Guido van Rossum wrote: In general, CPython isn't always consistent in raising AttributeError and TypeError when it comes to such policy issues: there are various places that raise TypeError in typeobject.c (and probably elsewhere) that simply forbid

Re: [Python-Dev] Iterator version of contextlib.nested

2009-06-15 Thread Raymond Hettinger
I don't consider changing a DeprecationWarning to a PendingDeprecationWarning resurrecting its target. Seems like resurrection to me. Pending warnings are hidden by default, so someone has to go look for it (and no one does this). The problem with the nested() construct is not so much that it

Re: [Python-Dev] Iterator version of contextlib.nested

2009-06-15 Thread Benjamin Peterson
2009/6/15 Raymond Hettinger pyt...@rcn.com: P.S.  If you switch to PendingDeprecationWarning, the example in the docs should probably be switched to show the one valid use case (passing in a prepackaged nest of context managers). Right now, the current example just shows the hazardous pattern

Re: [Python-Dev] Iterator version of contextlib.nested

2009-06-15 Thread Terry Reedy
Raymond Hettinger wrote: P.S. If you switch to PendingDeprecationWarning, the example in the docs should probably be switched to show the one valid use case (passing in a prepackaged nest of context managers). It could even suggest that it only be used for this, since it may disappear, and

Re: [Python-Dev] Iterator version of contextlib.nested

2009-06-15 Thread Paul Moore
2009/6/15 Terry Reedy tjre...@udel.edu: Raymond Hettinger wrote: P.S.  If you switch to PendingDeprecationWarning, the example in the docs should probably be switched to show the one valid use case (passing in a prepackaged nest of context managers). It could even suggest that it only be

[Python-Dev] Is the py3k mercurial mirror broken?

2009-06-15 Thread Paul Moore
I get the following: hg version Mercurial Distributed SCM (version 1.2) Copyright (C) 2005-2008 Matt Mackall m...@selenic.com and others This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. hg clone

Re: [Python-Dev] Is the py3k mercurial mirror broken?

2009-06-15 Thread Benjamin Peterson
There seem to be some issues with Subversion, so that's probably affecting hg. 2009/6/15 Paul Moore p.f.mo...@gmail.com: I get the following: hg version Mercurial Distributed SCM (version 1.2) Copyright (C) 2005-2008 Matt Mackall m...@selenic.com and others This is free software; see the

Re: [Python-Dev] Exception for setting attributes of built-in type

2009-06-15 Thread Nick Coghlan
Benjamin Peterson wrote: 2009/6/15 Nick Coghlan ncogh...@gmail.com: Guido van Rossum wrote: In general, CPython isn't always consistent in raising AttributeError and TypeError when it comes to such policy issues: there are various places that raise TypeError in typeobject.c (and probably

Re: [Python-Dev] Iterator version of contextlib.nested

2009-06-15 Thread Nick Coghlan
Paul Moore wrote: 2009/6/15 Terry Reedy tjre...@udel.edu: Raymond Hettinger wrote: P.S. If you switch to PendingDeprecationWarning, the example in the docs should probably be switched to show the one valid use case (passing in a prepackaged nest of context managers). It could even suggest

Re: [Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

2009-06-15 Thread Greg Ewing
Cameron Simpson wrote: It seems like whenever I want to do some kind of opportunistic but non-blocking stuff with a remote service Do you actually do this with buffered streams? I find it's better to steer well clear of buffered I/O objects when doing non-blocking stuff, because they don't

Re: [Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

2009-06-15 Thread Cameron Simpson
On 16Jun2009 11:21, Greg Ewing greg.ew...@canterbury.ac.nz wrote: Cameron Simpson wrote: It seems like whenever I want to do some kind of opportunistic but non-blocking stuff with a remote service Do you actually do this with buffered streams? Sure, in C, python and perl quite happily. In

Re: [Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

2009-06-15 Thread MRAB
Cameron Simpson wrote: On 16Jun2009 11:21, Greg Ewing greg.ew...@canterbury.ac.nz wrote: Cameron Simpson wrote: It seems like whenever I want to do some kind of opportunistic but non-blocking stuff with a remote service Do you actually do this with buffered streams? Sure, in C, python and

Re: [Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

2009-06-15 Thread Cameron Simpson
On 16Jun2009 02:18, MRAB pyt...@mrabarnett.plus.com wrote: My itch is that peek() _feels_ like it should be look into the buffer but actually can block and/or change the buffer. Can block, but not if you don't want it too. You might just want to see what, if anything, is currently available,

Re: [Python-Dev] Avoiding file descriptors leakage in subprocess.Popen()

2009-06-15 Thread Cameron Simpson
On 14Jun2009 16:42, Mark Seaborn m...@mythic-beasts.com wrote: | I use a convenience function like this, so that GC takes care of the FDs: | | def make_pipe(): | read_fd, write_fd = os.pipe() | return os.fdopen(read_fd, r), os.fdopen(write_fd, w) Not guarrenteed to be timely. The