Re: mode for file created by open

2012-06-09 Thread Cameron Simpson
On 09Jun2012 19:03, Terry Reedy wrote: | > So I would guess it wouldn't be difficult to add the creation mode argument. | | On posix system, probably not. On windows, just ignore it, unless 'root' | can be mapped to 'admin'. Oh please NO! Either implement it correctly, or raise a ValueError if

Re: mode for file created by open

2012-06-09 Thread Terry Reedy
On 6/9/2012 6:25 PM, Neal Becker wrote: Terry Reedy wrote: The original open builtin was a thin wrapper around old C's stdio.open. Open no longer has that constraint. After more discussion here, someone could open a tracker issue with a specific proposal. Keep in mind that 'mode' is already a p

Re: mode for file created by open

2012-06-09 Thread Cameron Simpson
On 09Jun2012 18:25, Neal Becker wrote: | I haven't seen the current code - I'd guess it just uses posix open. | So I would guess it wouldn't be difficult to add the creation mode argument. | How about call it cr_mode? What shall it contain on Windows? What shall it contain on Jython? -- Cameron

Re: mode for file created by open

2012-06-09 Thread Cameron Simpson
On 09Jun2012 07:42, Neal Becker wrote: | Cameron Simpson wrote: | Doesn't anyone else think it would be a good addition to open to specify a file | creation mode? Like posix open? Avoid all these nasty workarounds? -1 open() is cross platform. os.open() is platform specific, generally POSIX.

Re: mode for file created by open

2012-06-09 Thread Neal Becker
Terry Reedy wrote: > On 6/9/2012 10:08 AM, Devin Jeanpierre wrote: >> On Sat, Jun 9, 2012 at 7:42 AM, Neal Becker wrote: >>> Doesn't anyone else think it would be a good addition to open to specify a >>> file >>> creation mode? Like posix open? Avoid all these nasty workarounds? >> >> I do, alt

Re: mode for file created by open

2012-06-09 Thread Terry Reedy
On 6/9/2012 10:08 AM, Devin Jeanpierre wrote: On Sat, Jun 9, 2012 at 7:42 AM, Neal Becker wrote: Doesn't anyone else think it would be a good addition to open to specify a file creation mode? Like posix open? Avoid all these nasty workarounds? I do, although I'm hesitant, because this only

Re: mode for file created by open

2012-06-09 Thread Chris Angelico
On Sun, Jun 10, 2012 at 12:08 AM, Devin Jeanpierre wrote: > I do, although I'm hesitant, because this only applies when mode == > 'w', and open has a large and growing list of parameters. True, but keyword arguments don't cost much complexity. open(file, mode='r', buffering=-1, encoding=None, er

Re: mode for file created by open

2012-06-09 Thread Devin Jeanpierre
On Sat, Jun 9, 2012 at 7:42 AM, Neal Becker wrote: > Doesn't anyone else think it would be a good addition to open to specify a > file > creation mode?  Like posix open?  Avoid all these nasty workarounds? I do, although I'm hesitant, because this only applies when mode == 'w', and open has a la

Re: mode for file created by open

2012-06-09 Thread Neal Becker
Cameron Simpson wrote: > On 08Jun2012 14:36, Neal Becker wrote: > | If a new file is created by open ('xxx', 'w') > | > | How can I control the file permission bits? Is my only choice to use chmod > | after opening, or use os.open? > | > | Wouldn't this be a good thing to have as a keyword for

Re: mode for file created by open

2012-06-08 Thread Cameron Simpson
On 08Jun2012 14:36, Neal Becker wrote: | If a new file is created by open ('xxx', 'w') | | How can I control the file permission bits? Is my only choice to use chmod | after opening, or use os.open? | | Wouldn't this be a good thing to have as a keyword for open? Too bad what | python calls

Re: mode for file created by open

2012-06-08 Thread Devin Jeanpierre
On Fri, Jun 8, 2012 at 2:36 PM, Neal Becker wrote: > If a new file is created by open ('xxx', 'w') > > How can I control the file permission bits?  Is my only choice to use chmod > after opening, or use os.open? For whatever it's worth, in Python 3.3 you have the additional option of providing a

mode for file created by open

2012-06-08 Thread Neal Becker
If a new file is created by open ('xxx', 'w') How can I control the file permission bits? Is my only choice to use chmod after opening, or use os.open? Wouldn't this be a good thing to have as a keyword for open? Too bad what python calls 'mode' is like what posix open calls 'flags', and what