Re: [Tutor] unknown error in simple program

2006-02-13 Thread Ewald Ertl
Hi Eli! You have a lot of calls to input() in your code. When requesting help on input you get the following output: >>> help(input) Help on built-in function input: input(...) input([prompt]) -> value Equivalent to eval(raw_input(prompt)). As you can see, the data you input is put

[Tutor] unknown error in simple program

2006-02-13 Thread Eli Zabielski
I am reading "Python Programming for the absolute beginner" and am on chapter 4 challenges.It says to create a program to let the player guess letters of the word (I haven't tried to incorporate a guess limit yet like it says) my program looks fine to me, but I get a fat juicy error when I run itMy

Re: [Tutor] Interpackage access help-Please disregard other post with same name

2006-02-13 Thread Kent Johnson
Francesco A. Queirolo wrote: > Sorry about the double post but the first one was sent before I was > completed with my question. > > I have the following directory structure on Windows XP running python > 2.4.2 final: > > JavaInheritancePoly\ >HierarchicalInheritancePoly.py >

Re: [Tutor] [Edu-sig] nice()

2006-02-13 Thread Chuck Allison
There is a reliable way to compute the exact number of floating-point "intervals" (one less than the number of FP numbers) between any two FP numbers. It is a long-ago solved problem. I have attached a C++ version. You can't define closeness by a "distance" in a FP system - you should use this

[Tutor] Interpackage access help-Please disregard other post with same name

2006-02-13 Thread Francesco A. Queirolo
Sorry about the double post but the first one was sent before I was completed with my question. I have the following directory structure on Windows XP running python 2.4.2 final: JavaInheritancePoly\ HierarchicalInheritancePoly.py Animals\

Re: [Tutor] Instantiate a subClass using an instance of its baseClass

2006-02-13 Thread Kenny Li
Kent:   Overriding the accept() is an excellent idea. It looks more elegant than my original thinking of "total" subclassing. Thanks a lot; I have learned a great deal from you.   Kenny   On 2/13/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Kenny Li wrote:> Yep! I think that is what I want. I did no

Re: [Tutor] Instantiate a subClass using an instance of its baseClass

2006-02-13 Thread Kent Johnson
Kenny Li wrote: > Yep! I think that is what I want. I did not know enough to do (inside > C.__init__() ): > arg1.__class__=C > > As to my intent, I want to subclass socket.socket. By doing so, I may > get a socket (instance of my baseClass) after it (my subclass) accepts > an incoming

[Tutor] Fwd: Instantiate a subClass using an instance of its baseClass

2006-02-13 Thread Kenny Li
Sorry, keep forgetting "reply-all"-- Forwarded message --From: Kenny Li <[EMAIL PROTECTED] >Date: Feb 13, 2006 11:00 AMSubject: Re: [Tutor] Instantiate a subClass using an instance of its baseClassTo: Kent Johnson <[EMAIL PROTECTED]> Yep! I think that is what I want. I did not know

Re: [Tutor] IDE - Editors - Python

2006-02-13 Thread Darin William Lawson Hosking
I have looked at several "ide's" but still haven't found a true newbie python editor mainly need code completion and maybe drop in code like a wisiwig html editor would give me. I am looking at python for basically network admin scripts. If anyone knows of one I would really appreciate a link. By

Re: [Tutor] sys.argv

2006-02-13 Thread Terry Carroll
On Mon, 13 Feb 2006, [ISO-8859-1] J?nos Juh?sz wrote: > Is it any way to translate the sort DOS filename to the long NTSF one with > python ? You'll have to expand on this to handle files other than current directory, but basically: >>> win32api.FindFiles("FILEWI~1.TXT")[0][8] 'FileWithALongFil

Re: [Tutor] Instantiate a subClass using an instance of its baseClass

2006-02-13 Thread Kent Johnson
Kenny Li wrote: > Kent: > > I forgot to mention that no coping is allowed. Your two options > essentially are doing copying of the b. Not really. I make new references to the attributes of b. It sounds like you want c = C(b) to actually convert b to be an instance of C, instead of creating

Re: [Tutor] nice()

2006-02-13 Thread Smith
| From: Josiah Carlson <[EMAIL PROTECTED]> | "Alan Gauld" <[EMAIL PROTECTED]> wrote: || However I do dislike the name nice() - there is already a nice() in || the || os module with a fairly well understood function. perhaps trim(), nearly(), about(), defer_the_pain_of() :-) I've waited to think

[Tutor] Fwd: Instantiate a subClass using an instance of its baseClass

2006-02-13 Thread Kenny Li
Kent:   I forgot to mention that no coping is allowed. Your two options essentially are doing copying of the b. Furthermore, let's say, I don't even know the inside details of B, for example, I subclass the socket.socket, and I got a client socket after it accepting an incoming connection, and I

Re: [Tutor] sys.argv

2006-02-13 Thread János Juhász
Thanks Andre, The problem came from my wrong script calling. Python is just fine :) I corrected it, and I can call it now with """ Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\Shell\Flat2Xls\Command] @="python \"D:\\devel\\xlsxml.py\" \"%1\"" """ In this case there is a new menu

Re: [Tutor] sys.argv

2006-02-13 Thread Kent Johnson
János Juhász wrote: > Hi, > > I want to pass args to my python script on XP. > This code > print 'argv[0] %s' % sys.argv[0] > print 'argv[1] %s' % sys.argv[1] > print 'argv[2] %s' % sys.argv[2] > > shows this: > argv[0] D:\devel\home\devel\python\db\xlsxml.py > argv[1] "K:\IT\admin\test\Flat > ar

Re: [Tutor] sys.argv

2006-02-13 Thread Andre Roberge
On 2/13/06, János Juhász <[EMAIL PROTECTED]> wrote: > Hi, > > I want to pass args to my python script on XP. > This code > print 'argv[0] %s' % sys.argv[0] > print 'argv[1] %s' % sys.argv[1] > print 'argv[2] %s' % sys.argv[2] > > shows this: > argv[0] D:\devel\home\devel\python\db\xlsxml.py > argv[

[Tutor] sys.argv

2006-02-13 Thread János Juhász
Hi, I want to pass args to my python script on XP. This code print 'argv[0] %s' % sys.argv[0] print 'argv[1] %s' % sys.argv[1] print 'argv[2] %s' % sys.argv[2] shows this: argv[0] D:\devel\home\devel\python\db\xlsxml.py argv[1] "K:\IT\admin\test\Flat argv[2] Files\2006\06.02.2006-293753-gy" but

Re: [Tutor] Instantiate a subClass using an instance of its baseClass

2006-02-13 Thread Kent Johnson
Kenny Li wrote: > *class B(object): * > *''' the baseClass '''* > *def __init__(self, arg1, arg2):* > *self.a1=arg1* > *self.a2=arg2* > * * > *class C(B): * > *''' C is subClass of B '''* > *def __init__(self, arg1, arg2):* > *B.__init__(self, ar

Re: [Tutor] self

2006-02-13 Thread Ewald Ertl
Hi Shuying! Shuying Wang wrote: > Hi, > > I'm having problems understanding some code I came across: > > class Singleton: > __single = None > def __init__( self ): > if Singleton.__single: > raise Singleton.__single > Singleton.__single = self > > What does