Re: portable /dev/null

2008-05-02 Thread Brendan Miller
On Fri, 02 May 2008 21:41:36 +0200, Christian Heimes wrote: > Brendan Miller schrieb: >> Hi, >> >> I have functions that take a file object and write to it. In some cases I >> just want to throw out what is written to that file object. I want >> something like open('/dev/null', 'w'), but portable

Re: portable /dev/null

2008-05-02 Thread Gabriel Genellina
En Fri, 02 May 2008 16:20:04 -0300, Brendan Miller <[EMAIL PROTECTED]> escribió: I have functions that take a file object and write to it. In some cases I just want to throw out what is written to that file object. I want something like open('/dev/null', 'w'), but portable. It needs to have a

Re: portable /dev/null

2008-05-02 Thread Martin v. Löwis
> I have functions that take a file object and write to it. In some cases I > just want to throw out what is written to that file object. I want > something like open('/dev/null', 'w'), but portable. > > It needs to have an underlying file descriptor/file handle, as it will be > passed to non pyth

Re: portable /dev/null

2008-05-02 Thread Christian Heimes
Brendan Miller schrieb: > Hi, > > I have functions that take a file object and write to it. In some cases I > just want to throw out what is written to that file object. I want > something like open('/dev/null', 'w'), but portable. import os null = open(os.devnull, "wb") :) Christian -- http://

Re: portable /dev/null

2008-05-02 Thread Giampaolo Rodola'
On 2 Mag, 21:20, Brendan Miller <[EMAIL PROTECTED]> wrote: > Hi, > > I have functions that take a file object and write to it. In some cases I > just want to throw out what is written to that file object. I want > something like open('/dev/null', 'w'), but portable. > > It needs to have an underlyi