Re: [Tutor] IDLE Caching

2006-07-24 Thread Alan Gauld
> I have a problem with IDLE on Windows. > While I'm executing a python script in IDLE subsequence > editing and executions on the file sometimes doesn't reflect the > changes. This is a common issue, you are presumably importing your program rather than using IDLE's save/run feature? If so you w

Re: [Tutor] IDLE Caching

2006-07-24 Thread Bugra Cakir
class Tree:    def Tree(self):    self.rootNode = None    def Tree(self, rootNode):    self.rootNode = rootNode    def getRootNode(self):    return self.rootNode    def setRootNode(self, rootNode):     self.rootNode = rootNodeclass Node:    def Node(self):    self.content = ''  

Re: [Tutor] IDLE Caching

2006-07-24 Thread Luke Paireepinart
[snip code] > look at this code. Edit this code with IDLE. For example change one of > the 'self' statement > in the code. For instance change self => slf then save the file and > press F5(Run Module) > It doesn't complain about the code !!! this is my problem. > I think maybe you're just confuse

Re: [Tutor] IDLE Caching

2006-07-24 Thread Bugra Cakir
Really, I have realized the difference Luke said. However sometimes IDLE runs theold version, this is the thing I cant realized.On 7/24/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: [snip code]> look at this code. Edit this code with IDLE. For example change one of> the 'self' statement> in the

[Tutor] AssertionError issue

2006-07-24 Thread Akanksha Govil
Hi,I have a class in python which creates an ssh connection to a remote machine.In a function of the class, I have put the code in try/except block.try: -- --except AssertionError: print "Error Condition"In this code, when error occurs, it raises the AssertionError but t

Re: [Tutor] Joe's learning Tk

2006-07-24 Thread Danny Yoo
> Thanks for the great email.I am beginning to see the light on event > binding, callbacks and functions. I have attached my program to show my > efforts so far. I think I need a some help in application. Hi Joe, I haven't seen your message about this on Tutor yet; have you reposted your que

Re: [Tutor] IDLE Caching

2006-07-24 Thread Alan Gauld
> class Tree: > >def Tree(self): >self.rootNode = None >def Tree(self, rootNode): >self.rootNode = rootNode This second definition overrides the first - you cannot do function overloading based on parameters in Python. > > t = Tree() > n = Node() These just create instan

Re: [Tutor] IDLE Caching

2006-07-24 Thread Bugra Cakir
So from the answers, i want to imagine how python exercise the codewhen you push the button execute. My guess before looking at the docsor other material,1. check python syntax 2. transform to byte code.3. execute the byte code. ___ Tutor maillist - Tut

[Tutor] simple Model-View-Controller example for QT/PyQT

2006-07-24 Thread Tony Cappellini
Does anyone here have a  example/demo using the MVC pattern, in a simple QT/pyQT program?thanks ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Is there a method like this already?

2006-07-24 Thread Nathan Pinno
Is there a method in Python like this already:   [code] #This program calculates how many days it has been from one day to the other.   def first_date():    1y = int(raw_input("Enter the year of the first date: "))    1m = int(raw_input("Enter the month of the first date: "))    1d = int(ra

Re: [Tutor] Is there a method like this already?

2006-07-24 Thread John Fouhy
On 25/07/06, Nathan Pinno <[EMAIL PROTECTED]> wrote: > > Is there a method in Python like this already: > > [code] > #This program calculates how many days it has been from one day to the > other. Have a look at the datetime module: if date1 and date2 are both datetime.date instances, then (date1-

Re: [Tutor] Is there a method like this already?

2006-07-24 Thread Hugo González Monteverde
Nathan Pinno wrote: > Is there a method in Python like this already: > > [code] > #This program calculates how many days it has been from one day to the > other. Hi, Check the datetime module, it will give you distance between dates in the units you specify. It is included in the standard dis

[Tutor] What's the invalid syntax?

2006-07-24 Thread Nathan Pinno
What's the invalid syntax?   [code] from datetime import *   def menu():    print "(A)dd days to current date."    print "(F)ind how many days have passed since a date."    print "(E)xit."   def menu_choice():    choice = raw_input("Enter the letter of your choice: ")    return choice   def

Re: [Tutor] What's the invalid syntax?

2006-07-24 Thread Nathan Pinno
Ignore this. I've created too many errors to even begin to solve. - Original Message - From: Nathan Pinno To: Tutor mailing list Sent: Monday, July 24, 2006 7:24 PM Subject: What's the invalid syntax? What's the invalid syntax?   [code] from datetime impor

Re: [Tutor] What's the invalid syntax?

2006-07-24 Thread John Fouhy
On 25/07/06, Nathan Pinno <[EMAIL PROTECTED]> wrote: > > What's the invalid syntax? I don't know, what did python tell you when you tried to run the code? -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Is there a method like this already?

2006-07-24 Thread Alan Gauld
> Is there a method in Python like this already: > #This program calculates how many days it has been from one day to > the other. Look at the datetime module it has methods for getting differences in daes/times etc. > def first_date(): >1y = int(raw_input("Enter the year of the first date:

Re: [Tutor] IDLE Caching

2006-07-24 Thread Alan Gauld
> So from the answers, i want to imagine how python exercise the code > when you push the button execute. My guess before looking at the > docs > or other material, > > 1. check python syntax > 2. transform to byte code. > 3. execute the byte code. What you have is correct for a main program. If

Re: [Tutor] AssertionError issue

2006-07-24 Thread Alan Gauld
> In a function of the class, I have put the code in try/except block. > > try: > -- > -- > except AssertionError: > print "Error Condition" > > In this code, when error occurs, it raises the AssertionError > but the destuctor isnt called itself. The destructor will onl

[Tutor] confused by linked queue

2006-07-24 Thread Christopher Spears
I am working out of How To Think Like A Computer Scientist. I am on the chapter that covers linked queues. Here is some code that creates a linked queue class: class Queue: def __init__(self): self.length = 0 self.head = None def isEmpty(self):

Re: [Tutor] confused by linked queue

2006-07-24 Thread John Fouhy
On 25/07/06, Christopher Spears <[EMAIL PROTECTED]> wrote: >>>> from linked_queue import * > >>> queue = Queue() > >>> queue.isEmpty() > True > >>> queue.insert("cargo") > >>> print queue.head > cargo > >>> print queue.length > 1 > >>> queue.insert("more_cargo") > >>> print queue.le

[Tutor] confused by linked queue

2006-07-24 Thread Christopher Spears
After reading John's reply, I think I get it now: >>> from linked_queue import * >>> queue = Queue() >>> queue.isEmpty() True >>> queue.insert("cargo") >>> queue.length 1 >>> queue.insert("more cargo") >>> queue.length 2 >>> print queue.head cargo >>> print queue.head.next more cargo >>> queue.ins

Re: [Tutor] IDLE Caching

2006-07-24 Thread Bugra Cakir
let me dig into documentation before thinking in the blind :) thanks a lot Alan !On 7/25/06, Alan Gauld < [EMAIL PROTECTED]> wrote:> So from the answers, i want to imagine how python exercise the code > when you push the button execute. My guess before looking at the> docs> or other material,>> 1.