Bidirectional communication through pipes: read/write popen()

Hrvoje Niksic hniksic at srce.hr
Sun Oct 17 13:17:04 EDT 1999


Oleg Broytmann <phd at sun.med.ru> writes:

> On Sun, 17 Oct 1999, Fredrik Lundh wrote:
> > Oleg Broytmann <phd at sun.med.ru> wrote:
> > > On 17 Oct 1999, Hrvoje Niksic wrote:
> > > > def rwpopen(input, command, args=[]):
> > >                               ^^^^^^^
> > >    There was well-know problem with passing mutable object as a default.
> > > Not sure if it was fixed in recent versions of Python...
> > 
> > well, that's only a problem if you modify the object
> > inside the function...
> 
> Sooner or later you forget about it and modify args and what?

No, I don't.  It's not generally nice to make destructive
modifications on sequences a function passes as an argument, so I
don't do that with ARGS, regardless of the default value.

> :) No, I better will avoid this completely until Python fixes it.

Your choice, not mine.

> > (and no, it hasn't been fixed.  I doubt it can be fixed without
> > breaking stuff).
> 
>    Mmm??? Are there a line of code that *relies* on that misfeature?

But of course.  A misfeature to you is a feature to someone else.




More information about the Python-list mailing list