Re: beginner question, function returning object.

2008-02-07 Thread bambam
Thank you. So example 2 was clearly wrong, and example 1 was not clear :~). pipe is a serial port object: when I print pipe it shows first that it is connected to port 5, then that it is connected to port 6. I'll discard the clearly wrong code, and concentrate on the unclear code: probably by th

Re: beginner question, function returning object.

2008-02-07 Thread Steven D'Aprano
On Thu, 07 Feb 2008 19:14:54 +1100, bambam wrote: > Second try (correction) > > I started with ths: > -- > def open_pipe(): > pipe=PIPE() > print pipe > return pipe What's PIPE() do? > pipe=open_pipe() (Extraneous space removed.) > pipe.parent = self.

Re: beginner question, function returning object.

2008-02-07 Thread Marc 'BlackJack' Rintsch
On Thu, 07 Feb 2008 19:14:54 +1100, bambam wrote: > I started with ths: > -- > def open_pipe(): > pipe=PIPE() > print pipe > return pipe > > pipe=open_pipe() > pipe.parent = self.parent > print pipe > -- > It didn't do what I

Re: beginner question, function returning object.

2008-02-07 Thread bambam
Second try (correction) I started with ths: -- def open_pipe(): pipe=PIPE() print pipe return pipe pipe=open_pipe() pipe.parent = self.parent print pipe -- It didn't do what I wanted: when I printed the pipe the second time i

beginner question, function returning object.

2008-02-06 Thread bambam
I started with ths: -- def open_pipe(): pipe=PIPE() print pipe return pipe pipe=open_pipe() pipe.parent = self.parent print pipe -- It didn't do what I wanted: when I printed the pipe the second time it was not the same object as