Re: [Python-Dev] Coding practice for context managers

2013-10-21 Thread Nick Coghlan
On 21 Oct 2013 23:54, "Antoine Pitrou" wrote: > > Le Mon, 21 Oct 2013 23:12:40 +1000, > Nick Coghlan a écrit : > > On 21 Oct 2013 22:10, "Antoine Pitrou" wrote: > > > > > > Le Mon, 21 Oct 2013 20:46:39 +1000, > > > Nick Coghlan a écrit : > > > > On 21 Oct 2013 12:44, "Raymond Hettinger" > > > >

Re: [Python-Dev] Coding practice for context managers

2013-10-21 Thread Barry Warsaw
On Oct 21, 2013, at 08:46 PM, Nick Coghlan wrote: >There's also the fact that I prefer the current lower case names, but >strongly dislike using lower case names for classes (despite the fact >closing was included in the original contextlib with a non PEP 8 compliant >class name). I think PEP 8 n

Re: [Python-Dev] Coding practice for context managers

2013-10-21 Thread Barry Warsaw
On Oct 21, 2013, at 08:46 PM, Nick Coghlan wrote: >There's also the fact that I prefer the current lower case names, but >strongly dislike using lower case names for classes (despite the fact >closing was included in the original contextlib with a non PEP 8 compliant >class name). Ha! The only t

Re: [Python-Dev] Coding practice for context managers

2013-10-21 Thread Antoine Pitrou
Le Mon, 21 Oct 2013 23:12:40 +1000, Nick Coghlan a écrit : > On 21 Oct 2013 22:10, "Antoine Pitrou" wrote: > > > > Le Mon, 21 Oct 2013 20:46:39 +1000, > > Nick Coghlan a écrit : > > > On 21 Oct 2013 12:44, "Raymond Hettinger" > > > wrote: > > > > > > > > Two of the new context managers in conte

Re: [Python-Dev] Coding practice for context managers

2013-10-21 Thread Nick Coghlan
On 21 Oct 2013 22:10, "Antoine Pitrou" wrote: > > Le Mon, 21 Oct 2013 20:46:39 +1000, > Nick Coghlan a écrit : > > On 21 Oct 2013 12:44, "Raymond Hettinger" > > wrote: > > > > > > Two of the new context managers in contextlib are now wrapped in > > pass-through factory functions. The intent is

Re: [Python-Dev] Coding practice for context managers

2013-10-21 Thread Antoine Pitrou
Le Mon, 21 Oct 2013 20:46:39 +1000, Nick Coghlan a écrit : > On 21 Oct 2013 12:44, "Raymond Hettinger" > wrote: > > > > Two of the new context managers in contextlib are now wrapped in > pass-through factory functions. The intent is to make the help() look > cleaner. This practice does have dow

Re: [Python-Dev] Coding practice for context managers

2013-10-21 Thread Nick Coghlan
On 21 Oct 2013 21:22, "R. David Murray" wrote: > > On Mon, 21 Oct 2013 12:11:57 +0100, Paul Moore wrote: > > On 21 October 2013 11:59, R. David Murray wrote: > > > On Sun, 20 Oct 2013 19:49:24 -0700, Ethan Furman wrote: > > >> On 10/20/2013 07:42 PM, Raymond Hettinger wrote: > > >> > > > >> > I

Re: [Python-Dev] Coding practice for context managers

2013-10-21 Thread R. David Murray
On Mon, 21 Oct 2013 07:21:11 -0400, "R. David Murray" wrote: > On Mon, 21 Oct 2013 12:11:57 +0100, Paul Moore wrote: > > On 21 October 2013 11:59, R. David Murray wrote: > > > On Sun, 20 Oct 2013 19:49:24 -0700, Ethan Furman > > > wrote: > > >> On 10/20/2013 07:42 PM, Raymond Hettinger wrote:

Re: [Python-Dev] Coding practice for context managers

2013-10-21 Thread R. David Murray
On Mon, 21 Oct 2013 12:11:57 +0100, Paul Moore wrote: > On 21 October 2013 11:59, R. David Murray wrote: > > On Sun, 20 Oct 2013 19:49:24 -0700, Ethan Furman wrote: > >> On 10/20/2013 07:42 PM, Raymond Hettinger wrote: > >> > > >> > In short, I recommend that efforts be directed at improving hel

Re: [Python-Dev] Coding practice for context managers

2013-10-21 Thread Paul Moore
On 21 October 2013 11:59, R. David Murray wrote: > On Sun, 20 Oct 2013 19:49:24 -0700, Ethan Furman wrote: >> On 10/20/2013 07:42 PM, Raymond Hettinger wrote: >> > >> > In short, I recommend that efforts be directed at improving help() rather >> > than limiting introspection by way of less clean

Re: [Python-Dev] Coding practice for context managers

2013-10-21 Thread R. David Murray
On Sun, 20 Oct 2013 19:49:24 -0700, Ethan Furman wrote: > On 10/20/2013 07:42 PM, Raymond Hettinger wrote: > > > > In short, I recommend that efforts be directed at improving help() rather > > than limiting introspection by way of less clean coding practices. > > +1 I'm also +1 on improving hel

Re: [Python-Dev] Coding practice for context managers

2013-10-21 Thread Nick Coghlan
On 21 Oct 2013 12:44, "Raymond Hettinger" wrote: > > Two of the new context managers in contextlib are now wrapped in pass-through factory functions. The intent is to make the help() look cleaner. This practice does have downsides however. > > The usual way to detect whether something is usable

Re: [Python-Dev] Coding practice for context managers

2013-10-20 Thread Ethan Furman
On 10/20/2013 07:42 PM, Raymond Hettinger wrote: In short, I recommend that efforts be directed at improving help() rather than limiting introspection by way of less clean coding practices. +1 We also have the option of adding a custom __dir__ to change what help() displays. -- ~Ethan~ ___

[Python-Dev] Coding practice for context managers

2013-10-20 Thread Raymond Hettinger
Two of the new context managers in contextlib are now wrapped in pass-through factory functions. The intent is to make the help() look cleaner. This practice does have downsides however. The usual way to detect whether something is usable with a with-statement is to check the presence of th