Access to variable from external imported module

jim-on-linux inq1ltd at verizon.net
Fri Nov 24 16:56:58 EST 2006


On Friday 24 November 2006 13:41, John Machin 
wrote:
> 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.
>
> and end with "i"?
>
> > > >    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.
>
> You left out a word; the correct way of
> phrasing that is: "All my function _are_ begin
> with F" :-)

No, for Non-Hungrian programmers it's "all-ah me" 
Functions gona begin witha F, not Func. anda 
"all-ah-me" classes gona begin witha K, not Klas.
Anda only me gona Know the Fdiff cause me codea is 
not opena. Anda I finda that it savea me time 
causea I doa thisa way fora a longa time.

Whena I gonna hava to changea maybe I willa.
 
>
> This appears to be a variation on "Hungarian
> notation"; google that for opinions pro & con.
>
> In a certain vernacular, it would be called "an
> effed concept" :-)
>
> > 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.
>
> When was that?
That was when bill gates just left Harvard,
basic was brand new, and 4k of memory was 
installed free when you bought a computer, 
(TRS80), my first,. Assemble was the alternative 
to Basic and you had to backup on tape because 
floppies didn't exist. And, most people on this 
site wern't even a gleem in their fathers eye.

> Even years ago, there were 
> slightly better ways. For example, my first
> boss' boss was an enthusiastic coder and
> debugger and also a workaholic. Colleagues who
> lived along the same railway line as he and
> were foolish enough not to hide behind a
> newspaper could have their morning or evening
> reverie disturbed by a cry of "Glad you're
> here! I'll hold the listing, you hold the
> dump!". I get the impression that debugging
> techniques have moved along a little bit since
> then. :-)
>
> > 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()
> > > >
> > > >
> > > >
> > > > 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
>
> I noticed.
>
> > but if removed, the results should be;
> >
> >    searchterm = 'help'
> >    self.searchterm = 'help'
> >    Kdo.searchterm = 'help'

Correct but when writing one must be clear.

Would it be better for me to write, your question
above was Is that a typo?

Or is it better if I were to write, your 
question above, "Is that a typo?", 
is a legimate question, but not clear.

So, to be clear one might write is "Kdoi" 
correct?. 

A clear response would be, it is not "Kdoi", it is 
"Kdo".  

But that's not correct either, it is Kdo.  

If one runs the code I don't expect the user to 
look for "help", I think we will see help and 
will THINK that the results are correct.

THINK is also incorrect, it should be written. 
think, or should it?

 
> No, the result would be
> help
> help
> help
>
> Plug in a text-to-speech module and a phone
> dialer and you're done ;-)
>
> >    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.
>
> With luck. Kindly consider another possibility:
> that you are wrong (or just marching to the
> beat of your own tambourine) and he (or she) is
> a newbie & will use it :-)
>

"Because he being of course judge of that tendency 
will make his opinions the rule of judgment, and 
approve or condemn the sentiments of others only 
as they shall square with or differ from his own…"
Thomas Jefferson



I enjoied this, but time is money,

jim-on-linux
http://www.inqvista.com











More information about the Python-list mailing list