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

2009-06-14 Thread Benjamin Peterson
2009/6/14 Raymond Hettinger : > FWIW, I think resurrecting contextlib.nested() is a bad idea. > 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.   It is a pitfall for the unwary.  And now > that w

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

2009-06-14 Thread Raymond Hettinger
FWIW, I think resurrecting contextlib.nested() is a bad idea. 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. It is a pitfall for the unwary. And now that we have the new with-statement syntax, i

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

2009-06-14 Thread Cameron Simpson
On 15Jun2009 11:48, Greg Ewing wrote: >> For myself, I'd expect more often to want to see if there's stuff in the >> buffer _without_ doing any raw reads at all. > > What uses do you have in mind for that? It seems like whenever I want to do some kind of opportunistic but non-blocking stuff with

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

2009-06-14 Thread Cameron Simpson
On 14Jun2009 09:21, Benjamin Peterson wrote: | 2009/6/14 Cameron Simpson : | > On 14Jun2009 15:16, I wrote: | > | Is it possible to access the buffer? I see nothing in the docs. | > | > I've just found getvalue() in IOBase. Forget I said anything. | > It seems to be my day for that kind of post:-(

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

2009-06-14 Thread Greg Ewing
Cameron Simpson wrote: For myself, I'd expect more often to want to see if there's stuff in the buffer _without_ doing any raw reads at all. What uses do you have in mind for that? -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mai

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

2009-06-14 Thread Guido van Rossum
On Sun, Jun 14, 2009 at 3:42 PM, MRAB wrote: > Seo Sanghyeon wrote: >> >> Exception for setting attributes of built-in type differs between >> CPython and IronPython. This is not purely theoretical, as >> zope.interface tries to set Implements declaration as __implemented__ >> attribute of built-in

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

2009-06-14 Thread Guido van Rossum
Wow. I'm impressed. On Sun, Jun 14, 2009 at 9:09 AM, Mark Seaborn wrote: > I have been doing some work to extend Google's Native Client [1] to > support dynamic linking [2].  For those who haven't heard of it, > Native Client is a sandboxing system for running a subset of x86 code. > It is propose

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

2009-06-14 Thread MRAB
Seo Sanghyeon wrote: Exception for setting attributes of built-in type differs between CPython and IronPython. This is not purely theoretical, as zope.interface tries to set Implements declaration as __implemented__ attribute of built-in type object, and excepts TypeError. Python 2.6.1 object.f

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

2009-06-14 Thread Terry Reedy
Seo Sanghyeon wrote: Exception for setting attributes of built-in type differs between CPython and IronPython. This is not purely theoretical, as zope.interface tries to set Implements declaration as __implemented__ attribute of built-in type object, and excepts TypeError. Python 2.6.1 object.f

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

2009-06-14 Thread Seo Sanghyeon
Exception for setting attributes of built-in type differs between CPython and IronPython. This is not purely theoretical, as zope.interface tries to set Implements declaration as __implemented__ attribute of built-in type object, and excepts TypeError. Python 2.6.1 >>> object.flag = True TypeError

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

2009-06-14 Thread Mark Seaborn
Facundo Batista wrote: > errpipe_read, errpipe_write = os.pipe() > try: > try: > . > . > . > . > . > . > finally: > os.close(errpipe_write) > . > . > . > finally: > os.close(errpipe

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

2009-06-14 Thread Mark Seaborn
I have been doing some work to extend Google's Native Client [1] to support dynamic linking [2]. For those who haven't heard of it, Native Client is a sandboxing system for running a subset of x86 code. It is proposed as a way of running native code inside web apps. One of my aims has been to get

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

2009-06-14 Thread Benjamin Peterson
2009/6/13 Nick Coghlan : > Hagen Fürstenau wrote: >> I guess this is much too late for 3.1, but could we then at least >> un-deprecate "contextlib.nested" for now? As it is, you get a >> DeprecationWarning for something like >> >> with contextlib.nested(*my_managers): >> >> without any good way to

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

2009-06-14 Thread Benjamin Peterson
2009/6/14 Cameron Simpson : > On 14Jun2009 15:16, I wrote: > | Is it possible to access the buffer? I see nothing in the docs. > > I've just found getvalue() in IOBase. Forget I said anything. > It seems to be my day for that kind of post:-( Where are you seeing this? Only BytesIO and StringIO hav

Re: [Python-Dev] ctime: I don't think that word means what you think it means.

2009-06-14 Thread Scott David Daniels
Steven D'Aprano wrote: On Sun, 14 Jun 2009 10:40:53 am Greg Ewing wrote: Zooko Wilcox-O'Hearn wrote: 1. Add a "st_crtime" field which gets populated on filesystems (Windows, ZFS, Mac) which can do so. "crtime" looks rather too similar to "ctime" for my liking. People who think that the "c" in

Re: [Python-Dev] ctime: I don't think that word means what you think it means.

2009-06-14 Thread Steven D'Aprano
On Sun, 14 Jun 2009 10:40:53 am Greg Ewing wrote: > Zooko Wilcox-O'Hearn wrote: > > 1. Add a "st_crtime" field which gets populated on filesystems > > (Windows, ZFS, Mac) which can do so. > > "crtime" looks rather too similar to "ctime" for my > liking. People who think that the "c" in "ctime" > m

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

2009-06-14 Thread Hagen Fürstenau
> 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 annoying to get a Pending