Re: [Tutor] Calling a function

2005-06-09 Thread Max Noel
On Jun 9, 2005, at 07:45, Kevin Reeder wrote: > I'm having trouble with this code which is meant to run a time > comparison between two similar functions. The first module is > makezeros.py > > def lots_of_appends(): > zeros = [] > for i in range(1): > zeros.append(0) > > def one_

Re: [Tutor] Can't figure out syntax error

2005-06-09 Thread Dan Schellenberg
Phew -- thanks, Ziyad. That did the trick all right. In my frustration to figure out the problem, I just began explicitly type-casting as many variables as I could, and missed the fact that I had done the same to this as well. Thanks again, Dan On 9-Jun-05, at 7:32 PM, ZIYAD A. M. AL-BATLY -

[Tutor] Word COM interface

2005-06-09 Thread Chuck Allison
Hello, Does anyone know how to get the Microsoft Word 11.0 Object library working in ActiveState Python 2.4.1? When I go into PythonWin and try to load it under makePy, I get the following error: >>> Generating to >>> C:\Python24\lib\site-packages\win32com\gen_py\00020905---C000-

Re: [Tutor] Can't figure out syntax error

2005-06-09 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hi there, > > I'm in the process of learning Python, and need some help deciphering > the reason why the following code doesn't work: Ziyad has answered your immediate question but I have a few more comments. > > import sys, string > > def dec2bin(decNum): > #

Re: [Tutor] Can't figure out syntax error

2005-06-09 Thread ZIYAD A. M. AL-BATLY
On Thu, 2005-06-09 at 18:16 -0600, [EMAIL PROTECTED] wrote: > Hi there, > > I'm in the process of learning Python, and need some help deciphering > the reason why the following code doesn't work: > int(num) = int(num) / 2 # this is integer division, so we truncate the > decimal part Here's

[Tutor] Can't figure out syntax error

2005-06-09 Thread as . 20 . schellenberg
Hi there, I'm in the process of learning Python, and need some help deciphering the reason why the following code doesn't work: import sys, string def dec2bin(decNum): # validate the input as a postive integer number for char in decNum: if str(char).isdigit() ==

Re: [Tutor] Dynamically calling a class

2005-06-09 Thread jfouhy
Quoting Ryan Parrish <[EMAIL PROTECTED]>: > example - > > list_of_classes = ['A', 'B', B', 'A'] > > class A: > doingsomething > class B: > doing something > > for x in list_of_classes: > x() > > my problem is that i get 'TypeError: 'str' object is not callable', of > which i

[Tutor] Dynamically calling a class

2005-06-09 Thread Ryan Parrish
example - list_of_classes = ['A', 'B', B', 'A'] class A: doingsomething class B: doing something for x in list_of_classes: x() my problem is that i get 'TypeError: 'str' object is not callable', of which i understand what the error is saying, i just want to know how to

Re: [Tutor] Newsreader list name?

2005-06-09 Thread Lee Cullens
Thanks for the reply Karl. In the last couple days I have carefully read through the Gmane site several times. I'm on OS X 10.4.1 and downloaded Hogwasher to try. Using my ISPs news server I found the two lists I mentioned, but I can't get anything nntp://news.gmane.org alone or in combin

Re: [Tutor] keylogger

2005-06-09 Thread Liam Clarke
That is true. For what it's worth, I wouldn't write a keylogger in Python. C, C++ or Assembly would be the best option. On 6/10/05, David Holland <[EMAIL PROTECTED]> wrote: You might want to write a keylogger because you have Children living in your house and you might want to protect them or you

Re: [Tutor] Newsreader list name?

2005-06-09 Thread Karl Pflästerer
On 9 Jun 2005, [EMAIL PROTECTED] wrote: > I'm switching over from email digests to a newsreader and I can't > find a reference for this tutor list. > > For example, I have the lists comp.lang.python and > comp.lang.python.announce setup, but can't find something like > comp.lang.python.tuto

Re: [Tutor] Newsreader list name?

2005-06-09 Thread Lee Cullens
I'm switching over from email digests to a newsreader and I can't find a reference for this tutor list. For example, I have the lists comp.lang.python and comp.lang.python.announce setup, but can't find something like comp.lang.python.tutor? There must be others on this list using a newsrea

Re: [Tutor] learning how to use python

2005-06-09 Thread Douglas Soares de Andrade
Hi ! This is the text idle says when you open it: Personal firewall software may warn about the connection IDLE makes to its subprocess using this computer's internal loopback interface. This connection is not visible on any extern

[Tutor] learning how to use python

2005-06-09 Thread Goofball223
I am new to programming and this is the first language that I will be learning. I am trying to get the shell to print "hello world". I followed all of the steps to save it and then run the file to get it to print in the shell. the shell gives me an error and also says that personal firewall softwar

Re: [Tutor] finding path to resource files in a GUI application

2005-06-09 Thread Alan G
> The class Goals is in a file called Help.py, located in '/gui_lib/' as > seen from my main script. > > class Goals(wx.Frame): > def __init__(self,parent,frame,title,size,pos=wx.DefaultPosition): > wx.Frame.__init__(self,parent, > -1,title,size,style=wx.DEFAULT_FRAME_STYLE) > self.frame = frame >

Re: [Tutor] keylogger

2005-06-09 Thread David Holland
You might want to write a keylogger because you have Children living in your house and you might want to protect them or yourself from their stupidity. (Ie downloading music illegally or giving out their address in a chat room, ideally the logger would sit there and send you an email if someone e

Re: [Tutor] Just a Python formatting question

2005-06-09 Thread Alberto Troiano
Kristiano Don't worry about it. I'm sure everyone passed over this before. The identation errors are errors in the tabulation of a line Let's take your code in example >number=78 >guess=0 > >while guess != number: > guess=input ("Guess a number:") > if guess > number: > print "To

Re: [Tutor] finding path to resource files in a GUI

2005-06-09 Thread Christian Meesters
On 9 Jun 2005, at 12:00, Michael Lange wrote: > Hi Christian, > > try > > self.cwd = os.path.abspath(sys.path[0]) > > sys.path[0] is the directory of your main program file, with > os.path.abspath() you can > get rid of the "../../" stuff at the beginning of the path if the > program is call

Re: [Tutor] Calling a function

2005-06-09 Thread Joal Heagney
Kevin Reeder said: >def do_timing(num_times, *funcs): Took me a while to work out what went wrong, but the first part occurs here. The *funcs bit means that any extra arguments passed to do_timing will be put into a tuple called funcs. So do_timing(100, dosomething, dosomethingelse) will pass

Re: [Tutor] Calling a function

2005-06-09 Thread Kevin Reeder
Ewald & John, thanks for the help. i'll work on it some more with your ideas in mind (after getting some sleep). Kevin ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] finding path to resource files in a GUI application

2005-06-09 Thread Michael Lange
On Thu, 9 Jun 2005 08:52:59 +0200 Christian Meesters <[EMAIL PROTECTED]> wrote: > Hi > > Currently I'm writing a GUI application with wxPython (on OS X, but I > guess the problem is the same, regardless of the UNIX derivative one is > using). When I start the main script where it is located t

Re: [Tutor] Calling a function

2005-06-09 Thread jfouhy
Quoting Kevin Reeder <[EMAIL PROTECTED]>: > The second module is timings.py. > > import time, makezeros > > def do_timing(num_times, *funcs): > totals = {} > for func in funcs: totals[func] = 0.0 > for x in range(num_times): > for func in funcs: >starttime = time.time() >

Re: [Tutor] Calling a function

2005-06-09 Thread Ewald Ertl
Hi! I don't know if I'm right here, because I've tested a simple model of what you're trying to do: on Wed, 8 Jun 2005 23:45:59 -0700 Kevin Reeder <[EMAIL PROTECTED]> wrote : - Kevin Reeder > import t