Access to variable from external imported module

jim-on-linux inq1ltd at verizon.net
Fri Nov 24 13:49:35 EST 2006


On Friday 24 November 2006 13:20, jim-on-linux 
wrote:
> On Friday 24 November 2006 13:01, jim-on-linux
>
> wrote:
> > On Friday 24 November 2006 03:30, John Machin
> >
> > wrote:
> > > jim-on-linux wrote:
> > > > GinTon,
> > > >
> > > > I think this is what you want.
> > > >
> > > >
> > > > class Kdoi:
> > >
> > > Is that a typo?
> >
> >        No, it's a style. life seems to be
> > easier to me if one is consistent, all my
> > classes begin with K.
>
> Sorry, Kdoi should be Kod
Sorry again Kdoi should be Kdo 
(Haste makes waste.)
>
> > > >    def __init__(self) :
> > > >        self.Fdo()
> > >
> > > What is all this K and F stuff?
> >
> >    It's my style. life seems to be easier  to
> > me if one is consistent all my function begin
> > with F.
> >
> > I started doing things like this when the
> > only way to debug was to read each line of
> > code and try to figgure out if it was the
> > problem. They are my personal sign posts.
> >
> > > >    def Fdo(self):
> > > >
> > > >
> > > >      searchterm = 'help'
> > > >      print searchterm     #local
> > > >
> > > >      self.searchterm = searchterm
> > > >      print self.searchterm #used inside
> > > > the class
> > > >
> > > >      Kdo.searchterm = searchterm   #<<<<
> > > >      print Kdo.searchterm #used outside
> > > > the class Kdomore()
>
> the line above should be Kdomore(), not class
> Kdomore() (For the technocrats)
>
> > > > class Kdomore(Kdo):
> > > >      def __init__(self) :
> > > >          self.Fdomore()
> > > >
> > > >      def Fdomore(self):
> > > >          searchterm =  Kdo.searchterm   #
> > > > <<<< print searchterm
> > >
> > > It's not apparent what the print statements
> > > are for -- are they part of an attempt to
> > > debug your code?
> >
> > print shows the results wherever a print
> > statement turns up the results = 'help' .
> > I didn't run the code, and it has it has a
> > coding error but if removed, the results
> > should be;
> >
> >    searchterm = 'help'
> >    self.searchterm = 'help'
> >    Kdo.searchterm = 'help'
> >
> >    Sound silly but many people have trouble
> > with getting a variable from here to there in
> > their code. This shows that it can be done
> >
> > > What gives you the idea that this is what
> > > the OP wants or needs?
> >
> > If I remember right,  he refrased  his first
> > question and asked a second one.
> > Sometimes people don't take the time to write
> > correctly, the questions that are really in
> > their mind. So I guessed.  If Im wrong, he
> > will ignore it.  If I'm right, he will use
> > it.
> >
> > Also, I have found that other will latch on
> > to the ideas presented  in these email
> > responses. And they will use them, even
> > though the response was not exactly what the
> > original emailer wanted.
> >
> > And, I sometimes I do use print statements to
> > debug, I have used other ways but on linux, I
> > prefer a print statement.
>
 jim-on-linux
 http://www.inqvista.com



More information about the Python-list mailing list