Re: [Tutor] Basic question -> How to use a class from a file?

2005-01-03 Thread Bernard Lebel
Alan Gauld wrote: Which tutor are you using? If its the standard Python tutor then its not really for beginners to OOP, Yes, I was talking about the one that comes with Python. Now I understand why I couldn't figure much of it! you might be better looking at some of the more basic tutors such as

Re: [Tutor] Basic question -> How to use a class from a file?

2005-01-03 Thread Alan Gauld
> I'm already confused! Seriously, I never done oop before, so even the > Python tutorial examples are extremely confusing to me atm. Which tutor are you using? If its the standard Python tutor then its not really for beginners to OOP, you might be better looking at some of the more basic tutors s

Re: [Tutor] Basic question -> How to use a class from a file?

2005-01-03 Thread Bernard Lebel
Alan Gauld wrote: You have 3 methods, functions and methods are similar but different! If you think of them asthe same thing you will probably get confused by OOP later on! [Bernard] I'm already confused! Seriously, I never done oop before, so even the Python tutorial examples are extremely confus

Re: [Tutor] Basic question -> How to use a class from a file?

2005-01-03 Thread Alan Gauld
> Okay here comes the next question. > > In that class, I have 3 functions. Actually, one of them calls the two > others. You have 3 methods, functions and methods are similar but different! If you think of them asthe same thing you will probably get confused by OOP later on! > However when I cal

Re: [Tutor] Basic question -> How to use a class from a file?

2005-01-02 Thread Rich Krauter
Bernard Lebel wrote: Okay here comes the next question. In that class, I have 3 functions. Actually, one of them calls the two others. However when I call these functions (wich are placed before the caller in the file), I get an error saying that the global name x (the function name) is not def

Re: [Tutor] Basic question -> How to use a class from a file?

2005-01-02 Thread Bernard Lebel
Okay here comes the next question. In that class, I have 3 functions. Actually, one of them calls the two others. However when I call these functions (wich are placed before the caller in the file), I get an error saying that the global name x (the function name) is not defined. What am I doin

Re: [Tutor] Basic question -> How to use a class from a file?

2005-01-02 Thread Bernard Lebel
All righty, thanks a lot! Bernard tanja pislar wrote: hi Bernard, you have to specify the module as well: let's say your module is called rtModule.py, then in your case you'd do: import rtModule testClass = rtModule.rt() testClass.walk() or: from rtModule import rt testClass = rt() testClass.walk()

Re: [Tutor] Basic question -> How to use a class from a file?

2005-01-02 Thread tanja pislar
hi Bernard, you have to specify the module as well: let's say your module is called rtModule.py, then in your case you'd do: import rtModule testClass = rtModule.rt() testClass.walk() or: from rtModule import rt testClass = rt() testClass.walk() regards, tanja On Sun, 02 Jan 2005 17:43:07

[Tutor] Basic question -> How to use a class from a file?

2005-01-02 Thread Bernard Lebel
Hello, An easy one to start the year. Trying to write my first class, already running into problems after 3 lines! :-( So have this little class: class rt: def walk(self): print 'yeah' So if I write this in the Python shell, instantiate rt and call walk(), I get the prope