Re: binding names doesn't affect the bound objects (was: print doesn't respect file inheritance?)

2008-07-28 Thread bukzor
On Jul 26, 7:08 am, D'Arcy J.M. Cain [EMAIL PROTECTED] wrote: On Sat, 26 Jul 2008 14:07:52 +1000 Ben Finney [EMAIL PROTECTED] wrote:     sys.stdout = n Re-binds the name 'sys.stdout' to the object already referenced by the name 'n'. No objects are changed by this; only bindings of names

Re: binding names doesn't affect the bound objects (was: print doesn't respect file inheritance?)

2008-07-26 Thread D'Arcy J.M. Cain
On Sat, 26 Jul 2008 14:07:52 +1000 Ben Finney [EMAIL PROTECTED] wrote: sys.stdout = n Re-binds the name 'sys.stdout' to the object already referenced by the name 'n'. No objects are changed by this; only bindings of names to objects. I do agree that the object formerly known as

binding names doesn't affect the bound objects (was: print doesn't respect file inheritance?)

2008-07-25 Thread Ben Finney
bukzor [EMAIL PROTECTED] writes: I was trying to change the behaviour of print (tee all output to a temp file) by inheriting from file and overwriting sys.stdout That's not what your code does, though. def main(): n = notafile('/dev/stdout', w) Creates a new instance of the 'notafile'