From lamer@chat-house.zzn.com Sun Jan 2 05:50:18 2000 From: lamer@chat-house.zzn.com (John Wilson) Date: Sun, 2 Jan 2000 16:50:18 +1100 Subject: [Tutor] Please help Mr Turor Message-ID: <93DD4F75960C3D1108B4000A9C0B5C5E@lamer.chat-house.zzn.com> <marquee><font color="red"size="7"face="bart">Help me
please</font></marquee>
<ul>
<l1>Hi umm, I just downloaded and read the tutorial (also witrh
download) for PyThoN.  My problem is, I don't undersstand half of
it.  Well not much of it anyway
<l1>







Get your Free E-mail at http://chat-house.zzn.com
______________________________________________________
Get up to $200 towards airline tix: www.priceline.com/promo/zzn1 - Free! From lamer@chat-house.zzn.com Sun Jan 2 05:54:08 2000 From: lamer@chat-house.zzn.com (John Wilson) Date: Sun, 2 Jan 2000 16:54:08 +1100 Subject: [Tutor] Please help Mr Turor Message-ID: <94DD4F75960C3D1108B4000A9C0B5C5E@lamer.chat-house.zzn.com> <marquee><font color="red"size="7"face="bart">Help me
please</font></marquee>
<ul>
<l1>Hi umm, I just downloaded and read the tutorial (also witrh
download) for PyThoN.  My problem is, I don't undersstand half of
it.  Well not much of it anyway
<l1>I know you type all the content in the textarea (the MSDOS) thing
and that's how you make the programme, BUT how do I make (this is
hard to explain) it as a WHOLE programme (eg. a browser, ICQ itself,
ect.)
<l1>Is python a LANGUAGE or a SCRIPT?
</ul>
Reguards<P>
<U>lamer</u><P>
<a href="mailto:lamer@chat-house.zzn.com">lamer@chat-house.zzn.com</a>







Get your Free E-mail at http://chat-house.zzn.com
______________________________________________________
Get up to $200 towards airline tix: www.priceline.com/promo/zzn1 - Free! From bowman@montana.com Sun Jan 2 23:06:36 2000 From: bowman@montana.com (bowman@montana.com) Date: Sun, 2 Jan 2000 16:06:36 -0700 (MST) Subject: [Tutor] Re: Please help Mr Turor In-Reply-To: <20000102170008.5979D1CD9C@dinsdale.python.org> Message-ID: > <l1>I know you type all the content in the textarea (the MSDOS) thing
> and that's how you make the programme, BUT how do I make (this is
> hard to explain) it as a WHOLE programme (eg. a browser, ICQ itself,
> ect.)
First hint: posting to newsgroups and maillists in html format is not appreciated. Second hint: start with something simple that you CAN explain. What are you trying to do? > <l1>Is python a LANGUAGE or a SCRIPT?
Python is a language. This is open to debate; my personal divide is when trying to write a script for tcsh or whatever, one usually reaches a point where you either flat out cannot do what you want to, or it is exceeding ugly. I have never hit that point with Python or C, hence they both must be languages. From s349929@student.uq.edu.au Wed Jan 5 04:50:44 2000 From: s349929@student.uq.edu.au (Suzanne Little) Date: Wed, 5 Jan 2000 14:50:44 +1000 (GMT+1000) Subject: [Tutor] Updating windows Message-ID: Hello, I'm currently a bit confused about how to update windows. I've had a look at the update and update_idletasks methods but they seem to be doing some funny things. Firstly I have a main window with a listbox which contains elements from a list. I delete/add etc to this list and want the listbox to reflect the changes. I have a function defined in the main window's class, updateList, self.listbox.delete(0, END) for i in names: self.listbox.insert(END, i) self.update_idletasks() which removes all the members of the listbox and adds the ones now contained in the list. The other class, which does the adding and removing calls this method to refresh the listbox after stuff has been done. Now we come to the bit I can't figure out. If I run this by entering %python main.py (I'm in Unix btw) and try to perform functions, the functions work but the listbox isn't updated at all but if I start up python, %python, and then enter >>> from main import * >>> s = MainGUI() and then use the GUI as normal it updates perfectly. The second update question I have is how do I get a child window to reflect changes that have taken place in a its parent? I have the main window and when an item from the listbox is selected, a button can be clicked which will then bring up a window containing details about the item which was selected. I can get this to work ok but I want the details window to be updated when the item's attributes change. I don't really mind how. Ideally it should happen automatically but since I really had no idea how to do this I've added a button to the details window, Update, which I hoped I could click to refresh the information contained there. The function that I called just said self.update() and I'm not really sure what else to try. If anyone has some ideas why the first update only happens when I run the program through command prompt and any ideas for how to set about doing the second refresh, that would be great. Also any references about how updating works. TIA, Suzanne ----------------------------------------------------------------------- "Contrariwise," continued Tweedledee, "If it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic" -Lewis Carroll ------------------------------------------------------------------------ From conditioner@2888.com Wed Jan 5 21:42:41 2000 From: conditioner@2888.com (xiaojingxiang) Date: Thu, 06 Jan 2000 5:42:41 +0800 Subject: [Tutor] sell air-conditioner and other appliance Message-ID: <200001060542.NOQ5656@fflh.hdiqv.qvvv.com> Dear sir we are the biggest airconditioner in china,we can offer anytype conditioner and others appliance if you want.our company has the highest technolgy and best quality,we would like to search sole agent outside china. X-IMSTrailer: __IMail_5__ -------------------------------------------------------------------- 欢迎到http://2888.com 申请免费、多功能、大容量、中英文的电子信箱。 还有全个性化报纸及每日邮递、精美贺卡、自动秘书、随身信箱、随身笔记、 免费网址、供求、招聘求职、网上情缘信息等等很实用的免费服务。 世界论坛网(http://wforum.com )非常有看头,很值得参加。 Get your free, feature-rich, huge e-mailbox at http://2888.com --------------------------------------------------------------------- From fuzed@swbell.net Thu Jan 6 01:26:48 2000 From: fuzed@swbell.net (sammy ford) Date: Wed, 05 Jan 2000 19:26:48 -0600 Subject: [Tutor] Learn to Hack Message-ID: <001501bf57e5$1ad5a6c0$99e3c1cf@sford3> This is a multi-part message in MIME format. ------=_NextPart_000_0012_01BF57B2.CFABC800 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I want to learn programming, and have offered any services to help = towards the Programming for Everyone project. I guess the reason im = writing here is to see, exactly what this email address provides. So i = guess a few pointers would be nice. Thanks Sammy Ford ------=_NextPart_000_0012_01BF57B2.CFABC800 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

I want to learn programming, and have offered any = services to=20 help towards the Programming for Everyone project. I guess the reason im = writing=20 here is to see, exactly what this email address provides. So i guess a = few=20 pointers would be nice.
 
Thanks
Sammy Ford
 
------=_NextPart_000_0012_01BF57B2.CFABC800-- From chole03@yahoo.com Thu Jan 6 13:39:33 2000 From: chole03@yahoo.com (Nichole Nadermann) Date: Thu, 6 Jan 2000 05:39:33 -0800 (PST) Subject: [Tutor] hello Message-ID: <20000106133933.29163.qmail@web2005.mail.yahoo.com> hello, I would like to begin programming, only I haven't the slightest idea how to. Please inform me on the best way to begin and how to use PYTHON. Thank you. -nichole __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From spirou@carolo.net Thu Jan 6 17:49:26 2000 From: spirou@carolo.net (Denis) Date: Thu, 06 Jan 2000 18:49:26 +0100 Subject: [Tutor] hello References: <20000106133933.29163.qmail@web2005.mail.yahoo.com> Message-ID: <3874D5A6.1C7D989@carolo.net> Nichole Nadermann wrote: > > I would like to begin programming, only I haven't the > slightest idea how to. Please inform me on the best > way to begin and how to use PYTHON. Thank you. Good idea to start with Python ! The first thing to do would be to read the Python pages http://www.python.org There is a lot of information, a tutorial, references ... Have fun. Denis From jbragg@linkamericacorp.com Fri Jan 7 17:26:00 2000 From: jbragg@linkamericacorp.com (James Bragg) Date: Fri, 7 Jan 2000 11:26:00 -0600 Subject: [Tutor] using Tkinter Message-ID: <009001bf5934$44435ca0$2064a8c0@dev007> This is a multi-part message in MIME format. ------=_NextPart_000_008D_01BF5901.F9969D20 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Is there a tutorial somewhere on how to use TKinter? ------=_NextPart_000_008D_01BF5901.F9969D20 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Is there a tutorial somewhere on how to = use=20 TKinter?
 
------=_NextPart_000_008D_01BF5901.F9969D20-- From spirou@carolo.net Fri Jan 7 21:23:15 2000 From: spirou@carolo.net (Denis) Date: Fri, 07 Jan 2000 22:23:15 +0100 Subject: [Tutor] using Tkinter References: <009001bf5934$44435ca0$2064a8c0@dev007> Message-ID: <38765943.C604B555@carolo.net> > James Bragg wrote: > > Is there a tutorial somewhere on how to use TKinter? Yes : http://www.pythonware.com/library/tkinter/introduction/index.htm Denis --------------------------------------------------------- # File: hello1.py from Tkinter import * root = Tk() w = Label(root, text="Hello James!") w.pack() root.mainloop() From Python679@aol.com Fri Jan 7 21:33:09 2000 From: Python679@aol.com (Python679@aol.com) Date: Fri, 7 Jan 2000 16:33:09 EST Subject: [Tutor] hey question bout python Message-ID: hey to program do u have to create a bunch of indivual .py files then create one more .py file to import all those other files together From tescoil@rtpro.net Sat Jan 8 15:21:44 2000 From: tescoil@rtpro.net (Tesla Coil) Date: Sat, 08 Jan 2000 09:21:44 -0600 Subject: [Tutor] Letter Frequency Count. Message-ID: <38775608.40C13608@rtpro.net> # An uncertain-how-to-proceed effort to count the # frequency of alphabetic characters in a file. import sys, string simpsons = string.uppercase simpsons = list(simpsons) emperor = sys.stdin.read() emperor = string.upper(emperor) stringette = 0 while stringette < len(emperor)+1: individual = emperor[stringette:stringette+1] if individual in simpsons: # increment value of corresponding # member of another list. (?) stringette = stringette+1 From DOUGS@oceanic.com Sat Jan 8 18:02:07 2000 From: DOUGS@oceanic.com (Doug Stanfield) Date: Sat, 8 Jan 2000 08:02:07 -1000 Subject: [Tutor] Letter Frequency Count. Message-ID: <5650A1190E4FD111BC7E0000F8034D26A0F23A@huina.oceanic.com> A few comments on your start and then about your approach: > stringette = 0 > while stringette < len(emperor)+1: > individual = emperor[stringette:stringette+1] # ... some stuff processing individual... > stringette = stringette+1 This construct is sort of like: for individual in emperor: # ... some stuff processing individual... Where individual should be each single character from the file. In your case this won't work straight off because you've read the whole file in. You might need to do the following to get to each character assuming you just want to throw away newlines: for line in emperor: for individual in line: # ... process individual ... I hope a lot more understandable. As to how you should process each character, I'd suggest a dictionary. Create an empty dictionary at the top ("countDict = {}"). Once you've tested to see if you want to increment a count ("if individual in simpsons:"), use the character as the key into the dictionary: if countDict.has_key(individual): countDict[individual] = countDict[individual] + 1 else: countDict[individual] = 1 In many cases like this Python makes it easy to forget about using indices and multiple data constructs to accomplish things. Hope this helped. -Doug- From eroubinc@u.washington.edu Sat Jan 8 20:06:03 2000 From: eroubinc@u.washington.edu (Evgeny Roubinchtein) Date: Sat, 8 Jan 2000 12:06:03 -0800 (PST) Subject: [Tutor] Letter Frequency Count. In-Reply-To: <5650A1190E4FD111BC7E0000F8034D26A0F23A@huina.oceanic.com> Message-ID: On Sat, 8 Jan 2000, Doug Stanfield wrote: [...] >Where individual should be each single character from the file. In your >case this won't work straight off because you've read the whole file in. You >might need to do the following to get to each character assuming you just >want to throw away newlines: > >for line in emperor: > for individual in line: > # ... process individual ... > [...] Well, am confused by this: I thought the file object's read() method returns a single string, not a list of strings -- unlike readlines() -- so what's the need for nested loops? -- Evgeny BOMB: Burn Out Memory Banks From DOUGS@oceanic.com Sat Jan 8 21:03:58 2000 From: DOUGS@oceanic.com (Doug Stanfield) Date: Sat, 8 Jan 2000 11:03:58 -1000 Subject: [Tutor] Letter Frequency Count. Message-ID: <5650A1190E4FD111BC7E0000F8034D26A0F23B@huina.oceanic.com> You're right. I always have used readline() or readlines() thus my confusion. To clarify definitively, here are abridged definitions from the "Library Reference" (underline emphasis mine): read([size]) Read at most size bytes from the file (less if the read hits EOF before obtaining size bytes). If the size argument is negative or omitted, read all data until EOF is reached. The bytes are returned as _a_string_object._ readline([size]) Read one entire line from the file. A trailing newline character is kept in the _string_ (but may be absent when a file ends with an incomplete line). readlines([sizehint]) Read until EOF using readline() and return a _list_ containing the lines thus read. In the example case using read() allows the following with no nesting necessary to pass over the lines; for individual in emperor: if individual in simpsons: if countDict.has_key(individual): countDict[individual] = countDict[individual] + 1 else: countDict[individual] = 1 Thanks, -Doug- > -----Original Message----- > From: Evgeny Roubinchtein [mailto:eroubinc@u.washington.edu] > Sent: Saturday, January 08, 2000 10:06 AM > To: Doug Stanfield > Cc: tutor@python.org > Subject: RE: [Tutor] Letter Frequency Count. > > > On Sat, 8 Jan 2000, Doug Stanfield wrote: > > [...] > >Where individual should be each single character from the > file. In your > >case this won't work straight off because you've read the > whole file in. You > >might need to do the following to get to each character > assuming you just > >want to throw away newlines: > > > >for line in emperor: > > for individual in line: > > # ... process individual ... > > > [...] > > Well, am confused by this: I thought the file object's read() method > returns a single string, not a list of strings -- unlike > readlines() -- so > what's the need for nested loops? > > -- > Evgeny > > BOMB: Burn Out Memory Banks > From tescoil@rtpro.net Sun Jan 9 00:01:04 2000 From: tescoil@rtpro.net (Tesla Coil) Date: Sat, 08 Jan 2000 18:01:04 -0600 Subject: [Tutor] Letter Frequency Count. References: <5650A1190E4FD111BC7E0000F8034D26A0F23B@huina.oceanic.com> Message-ID: <3877CFC0.9C9AEA4F@rtpro.net> Thanks Doug. Dictionaries are my least familiar type, and I just gave up too early on using a for loop. Got it to work without, but wouldn't have won any prizes for economy, nor did it result in the most favorable data structures for further operations. Reading the whole file in one gulp isn't a problem here; test file was little over 1k, most would be much smaller. Was necessary to change countDict to stringette, and I'll need to crunch some numbers from wapcaplet... :) import sys, string simpsons = string.uppercase simpsons = list(simpsons) emperor = sys.stdin.read() emperor = string.upper(emperor) stringette = {} for individual in emperor: if individual in simpsons: if stringette.has_key(individual): stringette[individual] = stringette[individual] + 1 else: stringette[individual] = 1 wapcaplet = stringette.values() Thanks 'gain From eroubinc@u.washington.edu Sun Jan 9 01:04:06 2000 From: eroubinc@u.washington.edu (Evgeny Roubinchtein) Date: Sat, 8 Jan 2000 17:04:06 -0800 (PST) Subject: [Tutor] Letter Frequency Count. In-Reply-To: <3877CFC0.9C9AEA4F@rtpro.net> Message-ID: >simpsons = list(simpsons) This is not neccessary to see why, you can try this little interaction: >>> 'a' in "abcd" 1 >>> 'x' in "abcd" 0 -- Evgeny "Sure, vi is user friendly. It's just particular about who it makes friends with." From deicky@yahoo.com Sun Jan 9 01:29:48 2000 From: deicky@yahoo.com (deicky) Date: Sun, 09 Jan 2000 08:29:48 +0700 Subject: [Tutor] Newbie: how to print ? Message-ID: <3877E48C.2A60@dnet.net.id> i don't know how to make a program to print my data (from database). any one can tell me how to print to the printer ( may be using postscript.) ? From COLIN8@prodigy.net Sun Jan 9 01:40:52 2000 From: COLIN8@prodigy.net (DANNY BOWLING) Date: Sat, 8 Jan 2000 20:40:52 -0500 Subject: [Tutor] INTERESTED Message-ID: <000c01bf5a42$912dc320$4916fed1@computer> This is a multi-part message in MIME format. ------=_NextPart_000_0009_01BF5A18.A775E6A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable HELLO, =20 MY NAME IS DANNY BOWLING I'M 28YRS. OLD. I'M CURRENTLY LEARNING TO USE THE SOFTWARE TEST TOOL ( WIN-RUNNER) I'M = IN TRAINING TO BECOME A SOFTWARE TESTER. I SEEN THIS WEB SITE ON (ZDTV) = . I WAS WONDERING WHAT WOULD I HAVE TO DOWN LOAD TO IN ORDER TO BEING TO = USE=20 THIS PROGRAM? AND IS IT REALLY POSSIBLE FOR SOMEONE OF MY AGE TO LEARN = TO WRITE PROGRAMS?=20 THANK YOU VERY MUCH=20 DANNY BOWLING MY COMPUTER: COMPAQ 64 RAM; 4 GIG; WINDOWS 98'=20 ------=_NextPart_000_0009_01BF5A18.A775E6A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
HELLO,
 
     MY NAME IS DANNY BOWLING = I'M 28YRS.=20 OLD.
I'M CURRENTLY LEARNING TO USE THE SOFTWARE TEST TOOL = (=20 WIN-RUNNER) I'M IN TRAINING TO BECOME A SOFTWARE TESTER. I SEEN THIS WEB = SITE ON=20 (ZDTV) . I WAS WONDERING WHAT WOULD I HAVE TO DOWN LOAD TO IN ORDER TO = BEING TO=20 USE
THIS PROGRAM?  AND IS IT REALLY POSSIBLE FOR = SOMEONE OF=20 MY AGE TO LEARN TO WRITE PROGRAMS?
          =20 THANK YOU VERY MUCH
          &nbs= p;            = ; =20 DANNY BOWLING
MY COMPUTER:  COMPAQ 64 RAM; 4 GIG; WINDOWS 98' =
------=_NextPart_000_0009_01BF5A18.A775E6A0-- From faassen@vet.uu.nl Sun Jan 9 01:57:05 2000 From: faassen@vet.uu.nl (Martijn Faassen) Date: Sun, 9 Jan 2000 02:57:05 +0100 Subject: [Tutor] INTERESTED In-Reply-To: <000c01bf5a42$912dc320$4916fed1@computer> References: <000c01bf5a42$912dc320$4916fed1@computer> Message-ID: <20000109025705.A25731@vet.uu.nl> DANNY BOWLING wrote: > HELLO, Hi there. > MY NAME IS DANNY BOWLING I'M 28YRS. OLD. > I'M CURRENTLY LEARNING TO USE THE SOFTWARE TEST TOOL ( WIN-RUNNER) > I'M IN TRAINING TO BECOME A SOFTWARE TESTER. I SEEN THIS WEB SITE ON (ZDTV) . > I WAS WONDERING WHAT WOULD I HAVE TO DOWN LOAD TO IN ORDER TO BEING TO USE > THIS PROGRAM? Since you indicated you're on Windows, look here: http://www.python.org/download/download_windows.html Just py152.exe is enough, but the windows extensions are neat, so you may want to get win32-all too. The Python official documentation can be found here; it contains a tutorial, though this is aimed at programmers already. Still you'd might want to try it. http://www.python.org/doc/ Various other tutorials can be found through the Vaults of Parnassus (a really nice site for Python information). The vaults are here: http://www.vex.net/parnassus This is a reference to the tutorials page: http://www.vex.net/parnassus/apyllo.py/935043691.636055170 > AND IS IT REALLY POSSIBLE FOR SOMEONE OF MY AGE TO LEARN TO WRITE PROGRAMS? Yes, that should definitely be possible. Set yourself some goal (a program you'd like to see), and work towards it. Initially try not to be too ambitious! Try something simple with text or numbers first. Later on you may process to reading files and processing data, or to making a user interface for your program, and so on. Be sure not to give up too early; curiosity and perseverence are the key. And ask questions on this list! Python's a good language to start with if you're a beginning programmer. As an aside, it's conventional on the net not to write your mails in all capitals. It's interpreted as shouting by many readers, which isn't what you're trying to accomplish. Good luck! Regards, Martijn From tescoil@rtpro.net Mon Jan 10 13:43:33 2000 From: tescoil@rtpro.net (Tesla Coil) Date: Mon, 10 Jan 2000 07:43:33 -0600 Subject: [Tutor] Letter Frequency Count. References: Message-ID: <3879E205.43815844@rtpro.net> On 8 Jan 2000, Evgeny Roubinchtein wrote >> simpsons = list(simpsons) > > This is not neccessary to see why, you can try > this little interaction: > > >>> 'a' in "abcd" > 1 > >>> 'x' in "abcd" > 0 I'd overlooked this, remaining from my original formulation, when its absence would return a traceback to line 9: if individual in simpsons: TypeError: string member test needs char left operand From cstrubel@mail.com Tue Jan 11 07:22:18 2000 From: cstrubel@mail.com (Christian W. Strubel) Date: Tue, 11 Jan 2000 02:22:18 -0500 (EST) Subject: [Tutor] What do I need to download & install Message-ID: <385384508.947575338859.JavaMail.root@web36.pub01> What files do I need to download and install? It would be for an IBM Aptiva using Windows 98. I saw to new viersion on the python for Windows download page. Is that the one I should use or the earlier version listed? Mr. Christian W. Strubel Email: cstrubel@mail.com Address: 649 Harriet Ave. Shoreview, MN 55126-4085 If you like books, check out the offers at: barnesandnoble.com ______________________________________________ FREE Personalized Email at Mail.com Sign up at http://www.mail.com?sr=mc.mk.mcm.tag001 From alan.gauld@bt.com Tue Jan 11 10:08:40 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 11 Jan 2000 10:08:40 -0000 Subject: [Tutor] hey question bout python Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5F99@mbtlipnt02.btlabs.bt.co.uk> > hey to program do u have to create a bunch of indivual .py > files then create > one more .py file to import all those other files together You don't have to do it that way, you can put it all in 1 big file if you prefer. The advantage of splitting it down is that you can then reuse the files in other projects and it is usually easier to maintain too: easier to find the error, only one small file to re-test etc Alan G. From alan.gauld@bt.com Tue Jan 11 10:11:36 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 11 Jan 2000 10:11:36 -0000 Subject: [Tutor] Letter Frequency Count. Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5F9A@mbtlipnt02.btlabs.bt.co.uk> > # An uncertain-how-to-proceed effort to count the > # frequency of alphabetic characters in a file. Might I suggest using a dictionary? For an example see the case study on my tutor - it counts punctuation characters, which is kind of similar... http://www.crosswinfds.net/~agauld Alan G. PS. Regular readers may note that is a new site - it doesn't have the annoying adverts :-) From alan.gauld@bt.com Tue Jan 11 10:17:42 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 11 Jan 2000 10:17:42 -0000 Subject: [Tutor] INTERESTED Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5F9B@mbtlipnt02.btlabs.bt.co.uk> > MY NAME IS DANNY BOWLING I'M 28YRS. OLD. Hi Danny. > SEEN THIS WEB SITE ON (ZDTV) . I WAS WONDERING WHAT WOULD I > HAVE TO DOWN LOAD TO IN ORDER TO BEING TO USE > THIS PROGRAM? Go to the downloads section of python.org and pull down whichever version you need for your operating system. In your case its a ~5Mb download which is simply an install package that you double click and it does the rest for you... > AND IS IT REALLY POSSIBLE FOR SOMEONE OF MY > AGE TO LEARN TO WRITE PROGRAMS? Absolutely. Try my online tutor at: http://www.crosswinds.net/~agauld/ Then go through the tutor that comes with Python (in the docs area). > THANK YOU VERY MUCH You're welcome. BTW All caps is considered to be SHOUTING in email... we're not deaf so please use lower case i9n future - its much easier on the eye! :-) Alan G. From manub@plasma.ernet.in Tue Jan 11 19:36:09 2000 From: manub@plasma.ernet.in (Manu Bajpai) Date: Tue, 11 Jan 2000 14:36:09 -0500 (GMT) Subject: [Tutor] tutor subscription Message-ID: Whom I should report to if I want to discontinue tutor subscription temporarily or permanent. Manu manub@plasma.ernet.in From dyoo@hkn.EECS.Berkeley.EDU Tue Jan 11 19:30:55 2000 From: dyoo@hkn.EECS.Berkeley.EDU (Daniel Yoo) Date: Tue, 11 Jan 2000 11:30:55 -0800 (PST) Subject: [Tutor] Re: Tutor digest, Vol 1 #203 - 5 msgs In-Reply-To: <20000111170013.394281CE0E@dinsdale.python.org> Message-ID: > Message: 3 > From: alan.gauld@bt.com > To: tescoil@rtpro.net, tutor@python.org > Subject: RE: [Tutor] Letter Frequency Count. > Date: Tue, 11 Jan 2000 10:11:36 -0000 > > > # An uncertain-how-to-proceed effort to count the > > # frequency of alphabetic characters in a file. > > Might I suggest using a dictionary? I think that sorting might help. *grin* In all seriousness, you might be able to sort all the characters in the file, and find it easier to count character frequencies in one pass through the sorted list. From s349929@student.uq.edu.au Wed Jan 12 02:54:52 2000 From: s349929@student.uq.edu.au (Suzanne Little) Date: Wed, 12 Jan 2000 12:54:52 +1000 (GMT+1000) Subject: [Tutor] How do I update a listbox? Message-ID: Hello, I'm having some problems updating/refreshing elements in windows. I'm using tkinter to build a main gui which contains a listbox filled with elements of a list. When you click a button in this gui another window appears which contains buttons to perform actions upon the listbox such as add, delete. How do I get the listbox to reflect the changes? I have a method, updateList which removes all elements and inserts the new list but that doesn't seem to work. Code for a greatly simplified trial version is attached at the end of this email. Any direct comments on the code would be greatly appreciated but if anyone could also recommend some references or examples on updating that would be excellent since I have a few more problems to solve and I would like to have a good understanding of it. Thanks, Suzanne #####list.py##### from Tkinter import * from listComp import * names = ['hello1', 'hello2', 'hello3', 'hello4', 'hello5'] class TrialListbox(Frame): def __init__(self, parent=None): Frame.__init__(self, parent) self.pack() self.createWidgets() self.master.title('A Listbox Trial') self.master.iconname('tkpython') def createWidgets(self): self.makeList() self.makeButtons() def makeList(self): frame = Frame(self) frame.pack() scrollbar = Scrollbar(frame, orient=VERTICAL) self.listbox = Listbox(frame, yscrollcommand=scrollbar.set) scrollbar.config(command=self.listbox.yview) scrollbar.pack(side=RIGHT, fill=Y) self.listbox.pack(side=LEFT, fill=BOTH, expand=1) for i in names: self.listbox.insert(END, i) def updateList(self): self.listbox.delete(0, END) for i in names: self.listbox.insert(END, i) def makeButtons(self): bframe = Frame(self) bframe.pack(side=BOTTOM) Button(bframe, text='Call Print', command=self.callPrint).pack(side=BOTTOM) Button(bframe, text='Quit', command=self.getOut).pack(side=BOTTOM) def callPrint(self): w1 = Toplevel() w1.window = ListComp(w1, self) w1.window.pack() def getOut(self): Frame.quit(self) if __name__ == '__main__': TrialListbox().mainloop() #####listComp.py##### from Tkinter import * from list import * class ListComp(Frame): def __init__(self, parent=None, listBox=None): Frame.__init__(self, parent) self.trialListbox = listBox self.w1 = parent self.pack() self.createWidgets() def createWidgets(self): bframe = Frame(self) bframe.pack() Button(bframe, text='Print', command=self.Iprint).pack(side=LEFT) Button(bframe, text='Quit', command=self.Iquit).pack(side=LEFT) Button(bframe, text='Add', command=self.Iadd).pack(side=LEFT) Button(bframe, text='Delete', command=self.Idel).pack(side=LEFT) def Iprint(self): if self.trialListbox != None: item = self.trialListbox.listbox.curselection() member = self.trialListbox.listbox.get(item) print 'Term: ' + member def Iquit(self): self.w1.destroy() def Iadd(self): names.append('hello') self.trialListbox.updateList() def Idel(self): item = self.trialListbox.listbox.curselection() member = self.trialListbox.listbox.get(item) names.remove(member) self.trialListbox.updateList() ----------------------------------------------------------------------- "Contrariwise," continued Tweedledee, "If it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic" -Lewis Carroll ------------------------------------------------------------------------ From s349929@student.uq.edu.au Wed Jan 12 03:04:29 2000 From: s349929@student.uq.edu.au (Suzanne Little) Date: Wed, 12 Jan 2000 13:04:29 +1000 (GMT+1000) Subject: [Tutor] Dynamically changing the state of a button Message-ID: Hello, I decided to put this in a separate post since it really is two separate problems. For details on the general project and some sample code please see my previous post (How do I update a listbox?). I need to change the state option of buttons from disabled to normal depending upon whether an item is selected in a listbox. The things I've tried have been to bind an event to clicking the mouse in the listbox which causes a test of whether an item is selected and if so calls a function to remake the button frame and change the states. It does this by first destroying the button frame and then calling the make function and passing a value (normal/disabled). Obviously this is really messy and it doesn't work. The bind/event doesn't notice that an item has been selected until the second time you click and destroying/recreating the button frame looks awful. I've been reading around on python.org and my best guess is that I might need to do something with after_idle() and update() but I don't understand how either of these work. I need to extend this a bit as well (one button should only be enabled if a certain type of element is selected). If you're still with me after that rather confusing explanation, any suggestions would be greatly appreciated. Thanks, Suzanne ----------------------------------------------------------------------- "Contrariwise," continued Tweedledee, "If it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic" -Lewis Carroll ------------------------------------------------------------------------ From tescoil@rtpro.net Wed Jan 12 03:38:10 2000 From: tescoil@rtpro.net (Tesla Coil) Date: Tue, 11 Jan 2000 21:38:10 -0600 Subject: [Tutor] Letter Frequency Count. References: <38775608.40C13608@rtpro.net> Message-ID: <387BF722.1A73BB0C@rtpro.net> This is what I ended up doing altogether. A 0.0667 index of coincidence is statistically ideal English text; random text is about 0.0375. Would have been nice to print letter occurences sorted from highest to lowest frequency, but I wasn't sure how to go about that from here. Percentages might be Interesting--just haven't given that thought yet. # idxcon.py calculate index of coincidence # and return frequency of letter occurrence. import sys, string simpsons = string.uppercase emperor = sys.stdin.read() emperor = string.upper(emperor) stringette = {} for individual in emperor: if individual in simpsons: if stringette.has_key(individual): stringette[individual] = stringette[individual] + 1 else: stringette[individual] = 1 wapcaplet = stringette.values() def rectangle(x): return x*(x-1) mousebat = map(rectangle, wapcaplet) def sum(x, y): return x+y goosecreature = reduce(sum, mousebat) follicle = reduce(sum, wapcaplet) spong=rectangle(follicle) ic = float(goosecreature)/float(spong) print "The index of coincidence is", round(ic, 4), "\n" for ampersand in simpsons: if stringette.has_key(ampersand): print ampersand, ":", stringette[ampersand] else: print ampersand, ": 0" print "total letters:", follicle From eroubinc@u.washington.edu Wed Jan 12 15:51:19 2000 From: eroubinc@u.washington.edu (Evgeny Roubinchtein) Date: Wed, 12 Jan 2000 07:51:19 -0800 (PST) Subject: [Tutor] Letter Frequency Count. In-Reply-To: <387BF722.1A73BB0C@rtpro.net> Message-ID: On Tue, 11 Jan 2000, Tesla Coil wrote: >This is what I ended up doing altogether. A 0.0667 index >of coincidence is statistically ideal English text; random >text is about 0.0375. Would have been nice to print letter >occurences sorted from highest to lowest frequency, but >I wasn't sure how to go about that from here. Look up "Schwarzian Transform" in the Python FAQ (Q4.51 last time I checked), and sort the list you get by calling stringette.items() ? -- Evgeny Honey, I Formatted the Kid! From Emile van Sebille" Message-ID: <011801bf5d18$adb85400$01ffffc0@worldnet.att.net> ----- Original Message ----- From: Evgeny Roubinchtein To: Tesla Coil Cc: Sent: Wednesday, January 12, 2000 7:51 AM Subject: Re: [Tutor] Letter Frequency Count. > -- > Evgeny > > Honey, I Formatted the Kid! Is this how you: a) increase capacity; b) eliminate errors; c) change the operating system; d) a show of force; or e) erradicate unwanted behavior. Although, I think I'd settle for any one of the above. Please-post-your-formatter-routine-ly y'rs Emile van Sebille emile@fenx.com ------------------- From cgrant@medicine.adelaide.edu.au Thu Jan 13 01:16:42 2000 From: cgrant@medicine.adelaide.edu.au (Cliff Grant) Date: Thu, 13 Jan 2000 11:46:42 +1030 Subject: [Tutor] A python reference manager Message-ID: <387D277A.CCA166EC@medicine.adelaide.edu.au> Hello all, As a long time lurker on this list I have at last got a question for the group and hopefully a minor contribution to the global python karma. I have written a reference manager in python to manage BibTeX format files. It is a tkinter based application with a reasonably intuititive interface for adding/editing and deleting references. It also imports medline text files can convert between full and abbreviated journal names. It should run on any python system with tkinter - there are no other libraries required. If you are interested in such a beast visit : http:///www.anaesthesia.adelaide.edu.au/~dumas/software/pyref.html for more information. As a non-programmer with much self doubt I'd like some others, particularly Latex users, to try it, offer suggestions and tell me what's broken. I presume the appropriate forum for any real announcements is c.l.p.announce? I'm hoping the tutor group is a gentler way of getting some advice before the whole world has to see beta 0.1. On a back-patting type note, I believe it's a credit to the Python language itself, groups like this and the Python community in general that a bozo such as myself can write a useful application from information gleaned from newsgroups, python.org docs and the python demos. And along the way I've started to wrap my head around things such as lambda and classes etc.. Cheers, Cliff ************************************************************************* Cliff Grant cgrant@medcine.adelaide.edu.au From shankaram@usa.net Thu Jan 13 06:52:10 2000 From: shankaram@usa.net (SHANKAR RAMAMURTHY) Date: 12 Jan 00 23:52:10 MST Subject: [Tutor] Advice Message-ID: <20000113065210.24011.qmail@nwcst290.netaddress.usa.net> Hi, I am just beginning to learn programming. I'd like to know if Python is a= good language to begin with. I have no prior programming experience. suggestions i have received are for C and Java. Would appreciate advice. Shankar ____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=3D= 1 From Derek.Collins@tellabs.com Thu Jan 13 11:43:22 2000 From: Derek.Collins@tellabs.com (Derek Collins) Date: Thu, 13 Jan 2000 11:43:22 +0000 Subject: [Tutor] Problems installing Python. Message-ID: <387DBA59.DC7D140A@tellabs.com> Hi, I'm new to programming and want to try and learn python. After downloading and uncompressing the py152.tgz file and running ./configure, the last part of the procedure produces the following output creating Makefile creating Objects/Makefile Can't open ./Objects/Makefile.in creating Parser/Makefile Can't open ./Parser/Makefile.in creating Python/Makefile Can't open ./Python/Makefile.in creating Modules/Makefile.pre Can't open ./Modules/Makefile.pre.in creating Modules/Setup.thread Can't open ./Modules/Setup.thread.in creating config.h config.h is unchanged Then when I run make, I get (cd Modules; make -f Makefile.pre Makefile) make: Fatal error: Don't know how to make target `Makefile' Current working directory /export/home/python/Python-1.5.2/Modules *** Error code 1 make: Fatal error: Command failed for target `Makefiles' I'm trying to install pythin on a Sun Ultra 10 running Solaris 7. I'd really appreciate any help/assistance with this Derek Collins dcollins@shannon.tellabs.com From warren@nightwares.com Thu Jan 13 14:01:52 2000 From: warren@nightwares.com (Warren 'The Howdy Man' Ockrassa) Date: Thu, 13 Jan 2000 08:01:52 -0600 Subject: [Tutor] Advice References: <20000113065210.24011.qmail@nwcst290.netaddress.usa.net> Message-ID: <387DDAD0.23904643@nightwares.com> SHANKAR RAMAMURTHY wrote: > Hi, Hi there! > I am just beginning to learn programming. I'd like to know if Python is a good > language to begin with. I have no prior programming experience. It is *superb* for getting started, and pretty darn good even if you are proficient with programming. It's not as arcane as C, perl or Java (or permutations thereof), doesn't have extremely difficult syntactic restrictions, and generally makes your entire life a heck of a lot easier by doing most of the hard work for you. The biggest (perceived) disadvantage is you can lose some speed. But then with desktop machines ticking a gigaflop, who cares about a couple ticks? A great place to look over documentation is http://www.python.org/ if you have not been there yet. If you're the kind who likes decent manuals and such, they've got recommendations for books to supplement their already-teriffic online content and links. Enjoy! -- warren ockrassa | nightwares | mailto:warren@nightwares.com Bad news hits hard. Only The Indigestible punches back. http://www.the-indigestible.com/ From aa8vb@yahoo.com Thu Jan 13 14:16:37 2000 From: aa8vb@yahoo.com (Randall Hopper) Date: Thu, 13 Jan 2000 09:16:37 -0500 Subject: [Tutor] Re: Problems installing Python. In-Reply-To: <387DBA59.DC7D140A@tellabs.com> References: <387DBA59.DC7D140A@tellabs.com> Message-ID: <20000113091637.A63728@vislab.epa.gov> Derek Collins: | I'm new to programming and want to try and learn python. After |downloading and uncompressing the py152.tgz file and running | ./configure, the last part of the procedure produces the following |output | | creating Makefile |creating Objects/Makefile |Can't open ./Objects/Makefile.in |creating Parser/Makefile |Can't open ./Parser/Makefile.in ... | Then when I run make, I get | |(cd Modules; make -f Makefile.pre Makefile) |make: Fatal error: Don't know how to make target `Makefile' |Current working directory /export/home/python/Python-1.5.2/Modules ... Ok, looks like you may have file permission problems. An 'ls -l' will show you if this is the case. It could be that you expanded py152.tgz as root and are trying to build as a non-root user (?), or a few other possibliities. At the top of your python tree, do this: find . | xargs chown find . | xargs chmod u+w umask 22 Replace "" with your username on this Solaris box. The last line is just to make sure when you create files and directories that you're allowed to write to them. -- Randall Hopper aa8vb@yahoo.com From SKS@Sierra.net Thu Jan 13 17:30:20 2000 From: SKS@Sierra.net (Stacie S.) Date: Thu, 13 Jan 2000 09:30:20 -0800 Subject: [Tutor] newbie Message-ID: <000b01bf5deb$de693dc0$c5e287cf@sks> This is a multi-part message in MIME format. ------=_NextPart_000_0008_01BF5DA8.CF4A38A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I'm a programming newbie. I chose Python because Leo Laport said It was = powerful and easy (and free). I don't find it that easy. I've learned well from "dummies" books in = the past. I can program a little in QBASIC but python is different. = What books can I get on python (I learn well from books), and just how = powerfull is python? are there any share/freeware examples for download = ( or sold in stores)? Thank you = Adam T. ------=_NextPart_000_0008_01BF5DA8.CF4A38A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 I'm a programming newbie. I = chose Python=20 because Leo Laport said It was powerful and easy (and = free).
I don't find it that easy.  = I've learned=20 well from "dummies" books in the past. I can program a little = in=20 QBASIC but python is different.  What books can I get on python (I = learn=20 well from books), and just how powerfull is python?  are there any=20 share/freeware examples for download ( or sold in stores)?
          &nbs= p;            = ;            =             &= nbsp;           =20 Thank you
          &nbs= p;            = ;            =             &= nbsp;           &n= bsp;           &nb= sp;   =20 Adam T.
------=_NextPart_000_0008_01BF5DA8.CF4A38A0-- From eroubinc@u.washington.edu Thu Jan 13 22:22:12 2000 From: eroubinc@u.washington.edu (Evgeny Roubinchtein) Date: Thu, 13 Jan 2000 14:22:12 -0800 (PST) Subject: [Tutor] Advice In-Reply-To: <20000113065210.24011.qmail@nwcst290.netaddress.usa.net> Message-ID: On 12 Jan 2000, SHANKAR RAMAMURTHY wrote: >Hi, > >I am just beginning to learn programming. I'd like to know if Python is a good >language to begin with. I have no prior programming experience. Yes, Python is a very good first language. Look at http://www.python.org/, there are way too many useful resources there for me to list here. Also, you won't want to miss Alan Gould's excellent tutorial: http://members.xoom.com/alan_gauld/tutor/tutindex.htm >suggestions i have received are for C and Java. C is not really a good first language, and I would not recommend you start with it unless you have a project that specifically requires C: you can learn concepts, such as expressions, statements, conditions, loops, functions, variables, recursion, objects faster with Python and _then_ go on to learn C, if you need it. Java, like C, is a bit low-level. Neither Java nor C make it easy to test a few lines of code, or a single function interactively, while Python does -- this can be great help for learning the language, and trying things out as you go along. -- Evgeny You forgot to do your backup 16 days ago. Tomorrow you will need that version. From DOUGS@oceanic.com Thu Jan 13 22:33:33 2000 From: DOUGS@oceanic.com (Doug Stanfield) Date: Thu, 13 Jan 2000 12:33:33 -1000 Subject: [Tutor] newbie Message-ID: <5650A1190E4FD111BC7E0000F8034D26A0F25F@huina.oceanic.com> This to me is the best time to be learning Python. There have just been a bunch of very good books released and there are more on the way. The best place to find everything about Python is on the Python web site at http://www.python.org If you follow the links to the PSA Bookstore you'll find the full list with links to buy them from amazon.com. Unfortunately most of the current crop expects at least some familiarity with programming, some more than others. Your QBasic knowledge might help there and I think my current recommendation might be 'The Quick Python Book' by Daryl Harms and Kenneth McDonald. With anything, continued exposure over time will bring success, so I suggest reading as many of the available books as possible. Maybe "Programming Python" being my next recommended. How powerful is Python? In a word, very. Theres a good exposition on the subject in the "Quick" book. Usage examples abound in the above books and the rest now available, from the web site, and other sources linked to from the web site. Exploring the Python site in depth is well worth the time. Welcome, and good luck. -Doug- -----Original Message----- From: Stacie S. [mailto:SKS@Sierra.net] Sent: Thursday, January 13, 2000 7:30 AM To: tutor@python.org Subject: [Tutor] newbie I'm a programming newbie. I chose Python because Leo Laport said It was powerful and easy (and free). I don't find it that easy. I've learned well from "dummies" books in the past. I can program a little in QBASIC but python is different. What books can I get on python (I learn well from books), and just how powerfull is python? are there any share/freeware examples for download ( or sold in stores)? Thank you Adam T. From denis@carolo.net Fri Jan 14 02:22:02 2000 From: denis@carolo.net (Denis) Date: Fri, 14 Jan 2000 02:22:02 +0000 Subject: [Tutor] newbie References: <000b01bf5deb$de693dc0$c5e287cf@sks> Message-ID: <387E884A.3AABAF04@carolo.net> > "Stacie S." wrote: > > I'm a programming newbie. I chose Python because Leo Laport > said It was powerful and easy (and free). > I don't find it that easy. I've learned well from "dummies" > books in the past. > I can program a little in QBASIC but python is different. Yes, it's different. It's far more funny, flexible, powerfull, ... but to benefit from the Python power, you'll have to play with classes. > What books can I get on python (I learn well from books) Learning Python (ed.O'Reilly) by Lutz & Ascher, for example. > and just how powerfull is python? Up to where you can go. > are there any share/freeware examples for > download ( or sold in stores)? Examples in the book(s), Python's Tutorial ... If you want more, read the sources of the various modules. Keep trying, it's worth the effort. Denis From Python679@aol.com Fri Jan 14 12:57:22 2000 From: Python679@aol.com (Python679@aol.com) Date: Fri, 14 Jan 2000 07:57:22 EST Subject: [Tutor] hey a Question bout your program PYTHON!!!!!!! Message-ID: <14.b99d8.25b07732@aol.com> hey my friend send he heard python is not good to make hacking stuff is this true or false i heard it is but he heard it isnt so tell me which one it is From Python679@aol.com Sat Jan 15 04:09:12 2000 From: Python679@aol.com (Python679@aol.com) Date: Fri, 14 Jan 2000 23:09:12 EST Subject: [Tutor] Fwd: hey a Question bout your program PYTHON!!!!!!! Message-ID: <23.4b2306.25b14ce8@aol.com> --part1_23.4b2306.25b14ce8_boundary Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit --part1_23.4b2306.25b14ce8_boundary Content-Type: message/rfc822 Content-Disposition: inline Return-path: Python679@aol.com From: Python679@aol.com Full-name: Python 679 Message-ID: <14.b99d8.25b07732@aol.com> Date: Fri, 14 Jan 2000 07:57:22 EST Subject: hey a Question bout your program PYTHON!!!!!!! To: tutor@python.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Unknown (No Version) hey my friend send he heard python is not good to make hacking stuff is this true or false i heard it is but he heard it isnt so tell me which one it is --part1_23.4b2306.25b14ce8_boundary-- From warren@nightwares.com Sat Jan 15 06:24:41 2000 From: warren@nightwares.com (Warren 'The Howdy Man' Ockrassa) Date: Sat, 15 Jan 2000 00:24:41 -0600 Subject: [Tutor] Fwd: hey a Question bout your program PYTHON!!!!!!! References: <23.4b2306.25b14ce8@aol.com> Message-ID: <388012A9.83E79E67@nightwares.com> Coupla words of advice for you. 1. Python is, yes, a good hacking language, in the purest sense of the term, as it was always meant to be used, in the sense that hackers take extant code and cudgel it to fit a given OS, not abuse or "crack" someone else's system. If you are looking for a way to "crack" into others' computers this is not your language nor your mailing list; and 2. In general if you do not get a reply within 12 hours of posting a note to a listserv you do not have to re-post. 2 to 3 days is the usual grace period to wait before you re-send your original request. This is because listservs, unlike usenet or AOL, are generally frequented by industry professionals, not all of whom may have the time to immediately reply to your query, as we tend to have to work for a living. If you want to find out more about Python the very first place to go is its website, http://www.python.org/ , which is filled with stacks of great information, links, tutorials, help files and so on. If you want a book on the topic that site is a great place to check out the offerings and place an online order or browse titles to search for next time you're at a bookstore. Hope this helps! -- warren ockrassa | nightwares | mailto:warren@nightwares.com -- n i g h t w a r e s -- director faq lingo tutorial free files links http://www.nightwares.com/ Bad news hits hard. Only The Indigestible punches back. http://www.the-indigestible.com/ From warren@nightwares.com Sat Jan 15 06:26:41 2000 From: warren@nightwares.com (Warren 'The Howdy Man' Ockrassa) Date: Sat, 15 Jan 2000 00:26:41 -0600 Subject: [Tutor] Somewaht OT -- Python for Palms? Message-ID: <38801321.B85CC3FC@nightwares.com> Being an avid Palmist, I have to ask if anyone offhand knows of a port of Python to the Palm platform. I can't seem to find anything, but I might well be looking in the wrong places; pointers and two-by-fours, as warranted, are welcome upside my thick skull. Thanks! --WthmO From Emile van Sebille" Message-ID: <012801bf5f72$bd3f0e80$01ffffc0@worldnet.att.net> Look for Pyrite @ http://pyrite.linuxbox.com/pyrite/ This had been PalmPython, but I guess trademarks or some such got in the way. Enjoy! Emile van Sebille emile@fenx.com ------------------- ----- Original Message ----- From: Warren 'The Howdy Man' Ockrassa To: Sent: Friday, January 14, 2000 10:26 PM Subject: [Tutor] Somewaht OT -- Python for Palms? > Being an avid Palmist, I have to ask if anyone offhand knows of a port > of Python to the Palm platform. I can't seem to find anything, but I > might well be looking in the wrong places; pointers and two-by-fours, as > warranted, are welcome upside my thick skull. > > Thanks! > > --WthmO > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor From PaBe1@aol.com Sat Jan 15 17:33:04 2000 From: PaBe1@aol.com (PaBe1@aol.com) Date: Sat, 15 Jan 2000 12:33:04 EST Subject: [Tutor] installer Message-ID: I downloaded py152.exe but no installer what do I have to do to get the installer. Paul From gerrit@nl.linux.org Sat Jan 15 17:25:38 2000 From: gerrit@nl.linux.org (Gerrit Holl) Date: Sat, 15 Jan 2000 18:25:38 +0100 Subject: [Tutor] Re: Problems installing Python. In-Reply-To: <20000113091637.A63728@vislab.epa.gov>; from aa8vb@yahoo.com on Thu, Jan 13, 2000 at 09:16:37AM -0500 References: <387DBA59.DC7D140A@tellabs.com> <20000113091637.A63728@vislab.epa.gov> Message-ID: <20000115182538.A4808@stopcontact.palga.uucp> Randall Hopper wrote on 947751397: > find . | xargs chown > find . | xargs chmod u+w Offtopic, but... chown -R . chmod -R u+w . Since fileutils 4.0. Old fileutils? regards, Gerrit. -- Please correct any bad English you encounter in my email message! -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From fflores@arnet.com.ar Sat Jan 15 14:47:05 2000 From: fflores@arnet.com.ar (FFlores) Date: Sat, 15 Jan 2000 11:47:05 -0300 Subject: [Tutor] Win32 COM extensions Message-ID: <0c3894407001010MAIL2@mail2.arnet.com.ar> I just downloaded win32all from www.python.org and installed it, but it tells me the following: Registration of the AXScript Engine COM failed. exceptions.ImportError: DLL load failed: A device attached to the system is not functioning. Same for the Python Interpreter COM and the Python Dictionary COM. In each case it tells me I'll have to register these devices manually later. Do you have any idea what is or could be happening? And how do I install these COMs manually? Thanks in advance, --Pablo Flores http://www.geocities.com/pablo-david/index.html http://www.geocities.com/pablo-david/draseleq.html From insyte@emt-p.org Sun Jan 16 03:15:57 2000 From: insyte@emt-p.org (Ben Beuchler) Date: Sat, 15 Jan 2000 21:15:57 -0600 (CST) Subject: [Tutor] Sorting Message-ID: Any good references on sorting techniques? I don't have the programming background to be familiar with even the most basic algorithms... To start with, I just need to be able to sort a file of about 150 or so lines based on different columns on each line... Ben -- "There is no spoon" -- The Matrix From Python679@aol.com Sun Jan 16 12:49:22 2000 From: Python679@aol.com (Python679@aol.com) Date: Sun, 16 Jan 2000 07:49:22 EST Subject: [Tutor] Fwd: hey a Question bout your program PYTHON!!!!!!! Message-ID: <9a.91691.25b31852@aol.com> --part1_9a.91691.25b31852_boundary Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit --part1_9a.91691.25b31852_boundary Content-Type: message/rfc822 Content-Disposition: inline Return-path: Python679@aol.com From: Python679@aol.com Full-name: Python 679 Message-ID: <14.b99d8.25b07732@aol.com> Date: Fri, 14 Jan 2000 07:57:22 EST Subject: hey a Question bout your program PYTHON!!!!!!! To: tutor@python.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Unknown (No Version) hey my friend send he heard python is not good to make hacking stuff is this true or false i heard it is but he heard it isnt so tell me which one it is --part1_9a.91691.25b31852_boundary-- From arcege@shore.net Sun Jan 16 15:33:37 2000 From: arcege@shore.net (Michael P. Reilly) Date: Sun, 16 Jan 2000 10:33:37 -0500 (EST) Subject: [Tutor] Tkinter -- Is there a Gridwidget? In-Reply-To: <3.0.6.32.19800104122625.007b8950@pop.ctv.es> from "Barth Bellot, S.L." at Jan 04, 1980 12:26:25 PM Message-ID: <200001161533.KAA29926@northshore.shore.net> > I am writing a program that connects to a Database (Postgresql). > I want to represent the result in a Grid. > Is there a Grid-widget somewhere available for use in Tkinter? > Is it difficult to adabt the textwidget for using it as a Grid? Not so much a grid "widget", more of a Grid placement manager, to be used instead if Pack or Place. Here is an example, adapted from Fredrik Lundh's _Introduction to Tkinter_ Python 1.5.2 (#6, Apr 20 1999, 10:35:35) [GCC 2.7.2.2] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> from Tkinter import * >>> f = Frame() >>> Label(f, text="First:").grid(row=0, sticky=W) >>> Label(f, text="Second:").grid(row=1, sticky=W) >>> e1 = Entry(f) >>> e2 = Entry(f) >>> e1.grid(row=0, column=1) >>> e2.grid(row=1, column=1) >>> cb = Checkbutton(f, text="Hardcopy") >>> cb.grid(row=2, columnspan=2, sticky=W) >>> f.pack() >>> f.mainloop() Rows and columns start at zero. Grid is usually the easiest placement manager to use. There are some restrictions with using different managers in the widgets - if you need to mix then, create "invisible" Frame widgets (no border, no relief) with the different management styles, then pack each as needed. As for adapting the textwidget, I guess it would depend on what you want to do. Many a time, I feel the dynamic nature of the text widget makes addressing very difficult, but still doable. What I mean is, you have only as many columns on a line as you have characters on that like. But if you are just dumping data to the widget, then it's certainly easy to write out a formatted string to each line so the columns line up (just remember that the Text widget needs the newline to go to the next row/line - which has always annoyed me). Have fun! -Arcege -- ------------------------------------------------------------------------ | Michael P. Reilly, Release Engineer | Email: arcege@shore.net | | Salem, Mass. USA 01970 | | ------------------------------------------------------------------------ From warren@nightwares.com Sun Jan 16 16:17:56 2000 From: warren@nightwares.com (Warren 'The Howdy Man' Ockrassa) Date: Sun, 16 Jan 2000 10:17:56 -0600 Subject: [Tutor] installer References: Message-ID: <3881EF34.8944CD38@nightwares.com> PaBe1@aol.com wrote: > I downloaded py152.exe but no installer what do I have to do to get > the installer. That *is* the installer. Try running it. --WthmO From warren@nightwares.com Sun Jan 16 16:40:36 2000 From: warren@nightwares.com (Warren 'The Howdy Man' Ockrassa) Date: Sun, 16 Jan 2000 10:40:36 -0600 Subject: [Tutor] Fwd: hey a Question bout your program PYTHON!!!!!!! References: <9a.91691.25b31852@aol.com> Message-ID: <3881F484.AE9088A6@nightwares.com> If you are not going to bother to read replies to your questions, do not bother with this list. Python679@aol.com wrote: > Subject: hey a Question bout your program PYTHON!!!!!!! [snip] --WO From eroubinc@u.washington.edu Sun Jan 16 19:01:48 2000 From: eroubinc@u.washington.edu (Evgeny Roubinchtein) Date: Sun, 16 Jan 2000 11:01:48 -0800 (PST) Subject: [Tutor] installer In-Reply-To: <26.f2257a.25b31aa7@aol.com> Message-ID: On Sun, 16 Jan 2000 PaBe1@aol.com wrote: > I don't have any files with the extension exe., when I went back to download > it again I just get booted out. Where I have the file saved it just has Py152. > In that file there is no exe. extensions. Ohh, yes, that's a "feature" of Windows: it hides extensions by default. (You can change it under View->Options). Anyways, what happens when you try to run the file? -- Evgeny LINO: Last In, Never Out mode From michael@esm-software.com Sun Jan 16 19:04:40 2000 From: michael@esm-software.com (Michael McCormick) Date: Sun, 16 Jan 2000 13:04:40 -0600 Subject: [Tutor] file modification dates Message-ID: <200001161910.OAA11085@python.org> I've been starting to learn Python to do some programs that are too painful as shell scripts but not worth the effort to write in C. In that context, how can I discover the creation or modifiation date/time of a file? I didn't see anything in the documentation (but I've been known to read right over the answer I'm looking for). I'm looking for something beyond os.exec(...), and I'm mostly interested in Linux (if the solution is platform-dependent), but other platform info would be useful as tell. Any info is appreciated. Thanks, Mike - -- Michael McCormick michael@esm-software.com Polar exploration is at once the cleanest and most isolated way of having a bad time that has been devised. Apsley Cherry-Garrard _The_Worst_Journey_in_the_World_ From srichter@cbu.edu Sun Jan 16 20:02:35 2000 From: srichter@cbu.edu (Stephan Richter) Date: Sun, 16 Jan 2000 14:02:35 -0600 Subject: [Tutor] pyCVS Message-ID: <388223DB.4E6ADA09@cbu.edu> Is there a module that lets me use Python as a CVS client? Stephan -- Stephan Richter srichter@cbu.edu CBU - Physics, Chemistry and Electrical Computer Engineering Web2k - Technical Designs, Programming & Project Management From deirdre@deirdre.net Sun Jan 16 20:11:17 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Sun, 16 Jan 2000 12:11:17 -0800 (PST) Subject: [Tutor] pyCVS In-Reply-To: <388223DB.4E6ADA09@cbu.edu> Message-ID: On Sun, 16 Jan 2000, Stephan Richter wrote: > Is there a module that lets me use Python as a CVS client? Not yet afaik. I was in the middle of writing one but it's been on the back burner for some time. -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "Mars has been a tough target" -- Peter G. Neumann, Risks Digest Moderator "That's because the Martians keep shooting things down." -- Harlan Rosenthal , retorting in Risks Digest 20.60 From faassen@vet.uu.nl Sun Jan 16 20:32:43 2000 From: faassen@vet.uu.nl (Martijn Faassen) Date: Sun, 16 Jan 2000 21:32:43 +0100 Subject: [Tutor] pyCVS In-Reply-To: References: <388223DB.4E6ADA09@cbu.edu> Message-ID: <20000116213243.A3011@vet.uu.nl> Deirdre Saoirse wrote: > On Sun, 16 Jan 2000, Stephan Richter wrote: > > > Is there a module that lets me use Python as a CVS client? > > Not yet afaik. I was in the middle of writing one but it's been on the > back burner for some time. This isn't exactly what you want, but there may be useful code here: http://www.lyra.org/greg/python/viewcvs/ That's all that's listed at http://www.vex.net/Parnassus so we can reasonably assume a CVS module in Python does not yet exist. :) Regards, Martijn From arcege@shore.net Sun Jan 16 21:25:23 2000 From: arcege@shore.net (Michael P. Reilly) Date: Sun, 16 Jan 2000 16:25:23 -0500 (EST) Subject: [Tutor] pyCVS In-Reply-To: <388223DB.4E6ADA09@cbu.edu> from "Stephan Richter" at Jan 16, 2000 02:02:35 PM Message-ID: <200001162125.QAA15841@northshore.shore.net> > Is there a module that lets me use Python as a CVS client? I looked into making a C extension to CVS, but the CVS 1.9 and 1.10 sources isn't set up for nice integration into another product (which is very unfortunate). The best that I've done is made modules to parse the output for cvs-log, cvs-history and the work area files (./CVS/Entries, ./CVS/Tag, etc.). I use them at work quite a bit, but there are still a lot of bugs I haven't found. Some _really_ old stuff (about 2-3 years old) is available at . Some newer, buggy, package-based stuff is at . -Arcege -- ------------------------------------------------------------------------ | Michael P. Reilly, Release Engineer | Email: arcege@shore.net | | Salem, Mass. USA 01970 | | ------------------------------------------------------------------------ From dyoo@hkn.EECS.Berkeley.EDU Sun Jan 16 22:04:15 2000 From: dyoo@hkn.EECS.Berkeley.EDU (Daniel Yoo) Date: Sun, 16 Jan 2000 14:04:15 -0800 (PST) Subject: [Tutor] Sorting In-Reply-To: <20000116170009.5CA761CDA0@dinsdale.python.org> Message-ID: > Message: 4 > Date: Sat, 15 Jan 2000 21:15:57 -0600 (CST) > From: Ben Beuchler > To: Python Tutor > Subject: [Tutor] Sorting > > Any good references on sorting techniques? I don't have the programming > background to be familiar with even the most basic algorithms... > > To start with, I just need to be able to sort a file of about 150 or so > lines based on different columns on each line... The Art of Computer Programing (Vol 3: Searching and Sorting) is all about sorting techniques. It's one of the authoritative references. If you just want to sort a file, however, lists have a sorting routine. On Page 48 of Learning Python: L = ['eat, 'more', 'SPAM', 'please'] L.sort() L -> ['SPAM', 'eat', 'more', 'please'] and another example is on page 247 of Learning Python. From denis@carolo.net Sun Jan 16 23:18:31 2000 From: denis@carolo.net (Spirou) Date: Sun, 16 Jan 2000 23:18:31 +0000 Subject: [Tutor] file modification dates References: <200001161910.OAA11085@python.org> Message-ID: <388251C7.37A718B4@carolo.net> > In that context, how can I discover the creation > or modifiation date/time of a file? > I didn't see anything in the documentation extract from the Python Library Reference : docdir/html/lib/module-stat.html The stat module defines constants and functions for interpreting the results of os.stat(), os.fstat() and os.lstat() (if they exist). For complete details about the stat(), fstat() and lstat() calls, consult the documentation for your system. (...) ST_ATIME Time of last access. ST_MTIME Time of last modification. ST_CTIME Time of last status change (see manual pages for details). Would this be a satisfacting answer ? Denis From arcege@shore.net Mon Jan 17 01:40:15 2000 From: arcege@shore.net (Michael P. Reilly) Date: Sun, 16 Jan 2000 20:40:15 -0500 (EST) Subject: [Tutor] file modification dates In-Reply-To: <200001161910.OAA11085@python.org> from "Michael McCormick" at Jan 16, 2000 01:04:40 PM Message-ID: <200001170140.UAA15042@northshore.shore.net> > In that context, how can I discover the creation or modifiation > date/time of a file? I didn't see anything in the documentation (but > I've been known to read right over the answer I'm looking for). I'm > looking for something beyond os.exec(...), and I'm mostly interested in > Linux (if the solution is platform-dependent), but other platform info > would be useful as tell. There are some relatively new functions that are more platform independant: Python 1.5.2 (#6, Apr 20 1999, 10:35:35) [GCC 2.7.2.2] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import os, time >>> os.path.getsize('.profile') 4998 >>> time.ctime(os.path.getmtime('.profile')) 'Sat Jun 26 10:48:47 1999' >>> (There is a getatime() function also, but contains a bug which gets the mtime instead of the atime). For the less independant: >>> statinfo = os.stat('.profile') >>> statinfo[os.path.stat.ST_SIZE] 4998 >>> time.ctime(statinfo[os.path.stat.ST_MTIME]) 'Sat Jun 26 10:48:47 1999' >>> There is no "creation" time stored with files on a UNIX system (the ctime is the "inode change" time of the file on UNIX). -Arcege -- ------------------------------------------------------------------------ | Michael P. Reilly, Release Engineer | Email: arcege@shore.net | | Salem, Mass. USA 01970 | | ------------------------------------------------------------------------ From eroubinc@u.washington.edu Mon Jan 17 03:57:06 2000 From: eroubinc@u.washington.edu (Evgeny Roubinchtein) Date: Sun, 16 Jan 2000 19:57:06 -0800 (PST) Subject: [Tutor] installer Message-ID: OK, before we waste too much bandwidth with this: 1. Use your web browser to open http://www.python.org/ 2. Click the "Download" link at the top of the page, then click the "Windows95/98 and NT (Intel)" link 3a. If you use Internet Explorer skip to step 3b This step assumes you are using Netscape. Hold down the "Shift" key on you keyboard, and click the left mouse button on the "py152.exe" link. This will pop up a "Save As..." dialog. Save the file as "C:\py152.exe" 3b. If you are using Netscap skip to step 4 This step assumes you are using Internet Explorer. Right-click on the "py152.exe", and choose the "Save Target As..." from the menu that pops up. Sawe the file as "C:\py152.exe" 4. Click the Start button, then click "Run". Type in "C:\py152.exe", and click "OK" HTH -- Evgeny "Sure, vi is user friendly. It's just particular about who it makes friends with." From alan.gauld@bt.com Mon Jan 17 11:21:02 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 17 Jan 2000 11:21:02 -0000 Subject: [Tutor] Sorting Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5FBC@mbtlipnt02.btlabs.bt.co.uk> > Any good references on sorting techniques? I don't have the The definitive reference is Donald Knuth's books - one of which is dedicated to sorting and searching. However mere mortals sometimes find them a bit heavy going, in which case try Jon Bentleys Programming Pearls and More Programming Pearls - One at least gives several sorting algorithms in increasing efficiency. IMHO They are both must have books for any programmer... Alan G. From guido@CNRI.Reston.VA.US Mon Jan 17 17:20:01 2000 From: guido@CNRI.Reston.VA.US (Guido van Rossum) Date: Mon, 17 Jan 2000 12:20:01 -0500 Subject: [Tutor] pyCVS Message-ID: <200001171720.MAA11531@eric.cnri.reston.va.us> > Is there a module that lets me use Python as a CVS client? There's also some (*REALLY* old) code in Demo/pdist/cvslib.py that I once wrote when I wanted to use some CVS functionality from Python. It doesn't support remote CVS, but it used to parse the main CVS file format (CVS/Entries). Right now, it seems to be confused by 'D' records and by a change in the way dates are recorded, but that shouldn't be too hard to fix. Could be a starting point. --Guido van Rossum (home page: http://www.python.org/~guido/) From eroubinc@u.washington.edu Mon Jan 17 17:56:27 2000 From: eroubinc@u.washington.edu (Evgeny Roubinchtein) Date: Mon, 17 Jan 2000 09:56:27 -0800 (PST) Subject: [Tutor] installer In-Reply-To: Message-ID: On Mon, 17 Jan 2000 PaBe1@aol.com wrote: > I got it and I appreciate all the help you all have given me, now all > I have to do is figure out where to start. You could start by looking at the links in http://www.python.org/doc/Intros.html In particular, I warmly recommend Alan Gauld's "Learning to Program" at http://members.xoom.com/alan_gauld/tutor/tutindex.htm In general, when you have a question about Python, http://www.python.org/ should be the first place to look, and, of course, the tutor@python.org mailing list. -- Evgeny I must have slipped a disk; my pack hurts. From michael@esm-software.com Mon Jan 17 19:34:29 2000 From: michael@esm-software.com (Michael McCormick) Date: Mon, 17 Jan 2000 13:34:29 -0600 Subject: [Tutor] file modification dates Message-ID: <200001171949.OAA16829@python.org> Thanks to Michael Reilly and Denis for their timely and informative answers. They're just what I was looking for (silly me, I was looking in the wrong place). > There is no "creation" time stored with files on a UNIX system (the > ctime is the "inode change" time of the file on UNIX). Being pretty new to the UN*X world, I don't have all the terminology or concepts down yet. Little morsels like this help me get better. Thanks! Mike - -- Michael McCormick michael@esm-software.com Polar exploration is at once the cleanest and most isolated way of having a bad time that has been devised. Apsley Cherry-Garrard _The_Worst_Journey_in_the_World_ From julian_augustus@mailcity.com Tue Jan 18 03:56:49 2000 From: julian_augustus@mailcity.com (Josh D Gregorio) Date: Mon, 17 Jan 2000 20:56:49 -0700 Subject: [Tutor] How do I run a program? Message-ID: Hello group! I am using Win98. I downloaded Python 1.5 and it runs in an MSDOS prompt. My problem is that when I write a program in Notepad and save it I can't get it to run. How do I do this, and what DOS commands to I need to get the paths and directories right? Do I need to save Notepad in a special directory to find it when using the DOS prompt? I am lost. Thanks, Julian LYCOShop is now open. On your mark, get set, SHOP!!! http://shop.lycos.com/ From julian_augustus@mailcity.com Tue Jan 18 04:14:12 2000 From: julian_augustus@mailcity.com (Josh D Gregorio) Date: Mon, 17 Jan 2000 21:14:12 -0700 Subject: [Tutor] Re: How do I run a program? Message-ID: -- I just sent in my question, and then two minutes later I found another tutorial that answered it for me and gave me a whole bunch of other stuff to play with! Thanks anyway (I just don't want anyone to waste his time answering my question needlessly). Cordially, Julian LYCOShop is now open. On your mark, get set, SHOP!!! http://shop.lycos.com/ From alan.gauld@bt.com Tue Jan 18 17:17:50 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 18 Jan 2000 17:17:50 -0000 Subject: [Tutor] How do I run a program? Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5FCE@mbtlipnt02.btlabs.bt.co.uk> > Hello group! I am using Win98. I downloaded Python 1.5 and it > runs in an MSDOS prompt. My problem is that when I write a > program in Notepad and save it I can't get it to run. You should be able to double click on it in explorer and the installer should have set up the file associations for you. In fact the file(ending in .py) should have a little green snake icon... If for some reason its not set up then you will have to use the view|options dialog in exporer to set the association manually - do it for .py and .pyc Finally if you are creating modules and storing them in a common place you need to sert the PYTHONPATH environment variable in Autoexec.bat, otherwise when you try to import them from elsewhere Python won't know where to look. Last resort, start a DOS box and at the C:> prompt rtype: C:> python \foo.py where you fill in the full path to your python script. Alan G. From dyoo@hkn.EECS.Berkeley.EDU Tue Jan 18 21:19:58 2000 From: dyoo@hkn.EECS.Berkeley.EDU (Daniel Yoo) Date: Tue, 18 Jan 2000 13:19:58 -0800 (PST) Subject: [Tutor] Sorting In-Reply-To: Message-ID: > The specific problem I'm facing is that I'm going to be reading in a file > and using string.split() to turn each line into a list. This will give me > a "list of lists". (Is this what other languages call an array?) I want > to be able to sort based on any position in a line. Specifically, I would > like to be able to sort the entire file based on the same index offset on > each line. Effectively sorting based on a specific 'column' in the file. I believe that you can write a quick lambda expression to use with the python sort() routine that should work nicely. Here's an example program that sorts lines based on the character on the 4 column: import sys from string import * lines = sys.stdin.readlines() lines.sort(lambda x,y: x[3] > y[3]) for x in lines: print rstrip(x) There's probably another way to do it... *grin* From bryan.hann@pobox.com Wed Jan 19 14:26:00 2000 From: bryan.hann@pobox.com (Bryan Hann) Date: Wed, 19 Jan 2000 22:26:00 +0800 Subject: [Tutor] asking someone to helo with learning python... References: <3809DF79.AF6F98B9@990.net> <3831CA6C.87DBCA8B@pobox.com> <388488DB.C0835474@990.net> Message-ID: <3885C978.AFEAFFA9@pobox.com> Suggestions: (1) keep in contact with the tutorial list. There are more ppl than me willing to help. (2) browse the documentation (esp the tutorials) that do not come with the download but which are stored at www.python.org (3) Make sure your requests are as specific as possible, not just (eg) 'how do I learn how to program' (you're request below is general, but you did put it in some context which is good.) (4) Try converting some of your Pascal code to Python code. For each conversion, count and find the ratio between the lines of code before and after conversion. Publish these numbers to the list--this will show that you are keen, and that you might be willing to write up your findings for citation in order to help the python cause. ;) (5) After the conversion effort, learn about python's list and dictionary structures. If you can use lists and dictionaries in your conversion but did not use them before, try converting again. Post your new and even better ratios! ;) ;) (6) Take a look at the "string.py" file in the standard library, and see some fairly straightforward code at work. Modify it. 'Use The Source, Luke!'! Playing with source is a keen thing to do. (7) When you are feeling confident, start to look into python's class functionality, and learn about the wonderful world of object orientation. (8) Whenever you are stuck, ask for help. (My rule of thumb: make three attempts at solving the problem on your own first. (Fiddle, documentation, FAQ?)) The more you have tried, and the more precise your question, the better you help us to help you! (9) If things progress beautifully without a hitch , keep us up to date on your successes: it will endourage us all. (10) Finally, when you feel you know enough to share what you know, help others with their problems. Not only do you learn what you know even better through teaching, it will make you feel darn good about yourself! :) Cheers! - Bryan Hann Dickky Young wrote: > > Hey man how's going! > I am really sorry that I didnt reply to your mail about 2 months ago. I > was caught up with some school tasks that kept me so out of time. > Unfortunately, I have not made even a slight progress in Python > programming. I read the manual that comes along with the downloaded > version of Python, and though I have some concepts in computer languages > since I know Pascal a bit, I still find it hard to get started. > Could you help me on clearify a few concepts about what we can do with a > programming language such as Python, and once I get started, where do I > go to get myself enough practices or to find problems that I could > actually use my knowledges to solve. > Thank you so much. > Bryan Hann wrote: > > How is your programming quest coming along? > > Dickky Young wrote: > > > Hello! > > > I have just eagerly subscribed to this mailing list. I have no > > > programming experience but really really wanna get into it. Someone > > > suggested me to start with python. So, could any body help me? > > > Thank you. > > > _______________________________________________ > > > Tutor maillist - Tutor@python.org > > > http://www.python.org/mailman/listinfo/tutor From eroubinc@u.washington.edu Thu Jan 20 06:38:01 2000 From: eroubinc@u.washington.edu (Evgeny Roubinchtein) Date: Wed, 19 Jan 2000 22:38:01 -0800 (PST) Subject: [Tutor] Getting rid of temp files after fork/exec? Message-ID: This is Unix-specific, but since I understand many people on this list use Linux/Unix I thought I'd ask. I have a function that writes some data to a temp file, then fork()s; the child execv()s a program passing to it the name of the temp file as an argument, and the parent does some cleanup in the GUI and then returns. The problem is that leaves the temp file around, since the execv() doesn't really return, and I don't like that. I thought this was a common enough thing that someone might know what people normally do to get rid of the temp file. For reference, here's the function's code (it's part of a simple GUI to select a bunch of files to play with RealAudio Player, in case you are wondering). def call_rvplayer(self): l = [] for f in range(self.playlist.size()): l.append('file://' + self.ra_dir + self.playlist.get(f) + '.ra') tn = tempfile.mktemp() rf = tn + '.ram' t = open(rf, 'w') t.write(string.join(l, '\n')) t.write('\n') t.close() pid = os.fork() # XXX: how do I get rid of the temp file? if pid == 0: # child tempfile.template = None # per Library Reference os.execv('/home/eroubinc/RealPlayerG2/realplay', ('/home/eroubinc/RealPlayerG2/realplay', rf)) else: # parent self.playlist.delete(0, self.playlist.size()) return -- Evgeny Old mail has arrived. From DApugster@aol.com Thu Jan 20 23:03:39 2000 From: DApugster@aol.com (DApugster@aol.com) Date: Thu, 20 Jan 2000 18:03:39 EST Subject: [Tutor] learning python Message-ID: <8c.819dca.25b8ee4b@aol.com> Can you tell me a website that goes in-depth so I could learn python. Thank you From eroubinc@u.washington.edu Thu Jan 20 23:56:20 2000 From: eroubinc@u.washington.edu (Evgeny Roubinchtein) Date: Thu, 20 Jan 2000 15:56:20 -0800 (PST) Subject: Solved! Re: [Tutor] Getting rid of temp files after fork/exec? In-Reply-To: Message-ID: I think I got it now. My solution was to call fork() twice, like so: # cut --- rest of function unchanged. --- cut pid = os.fork() if pid == 0: # first child tempfile.template = None # per Library Reference pid2 = os.fork() if pid2 == 0: # grandhild -- exec the program os.execv('/home/eroubinc/RealPlayerG2/realplay', ('/home/eroubinc/RealPlayerG2/realplay', rf)) else: # child - wait on grandchild, then remove the file (p, s) = os.waitpid(pid2, 0) os.unlink(rf) sys.exit(0) else: # parent self.playlist.delete(0, self.playlist.size()) return The child does become a zombie in this scheme, but not for long; does this have any similarity to what is normally done? On Wed, 19 Jan 2000, Evgeny Roubinchtein wrote: ER> This is Unix-specific, but since I understand many people on this list ER> use Linux/Unix I thought I'd ask. ER> ER> I have a function that writes some data to a temp file, then fork()s; the ER> child execv()s a program passing to it the name of the temp file as an ER> argument, and the parent does some cleanup in the GUI and then returns. ER> The problem is that leaves the temp file around, since the execv() doesn't ER> really return, and I don't like that. I thought this was a common enough ER> thing that someone might know what people normally do to get rid of the ER> temp file. ER> ER> For reference, here's the function's code (it's part of a simple GUI to ER> select a bunch of files to play with RealAudio Player, in case you are ER> wondering). ER> ER> def call_rvplayer(self): ER> l = [] ER> for f in range(self.playlist.size()): ER> l.append('file://' + self.ra_dir + self.playlist.get(f) + ER> '.ra') ER> tn = tempfile.mktemp() ER> rf = tn + '.ram' ER> t = open(rf, 'w') ER> t.write(string.join(l, '\n')) ER> t.write('\n') ER> t.close() ER> pid = os.fork() ER> # XXX: how do I get rid of the temp file? ER> if pid == 0: # child ER> tempfile.template = None # per Library Reference ER> os.execv('/home/eroubinc/RealPlayerG2/realplay', ER> ('/home/eroubinc/RealPlayerG2/realplay', rf)) ER> ER> else: # parent ER> self.playlist.delete(0, self.playlist.size()) ER> return ER> ER> -- ER> Evgeny ER> ER> Old mail has arrived. ER> ER> ER> _______________________________________________ ER> Tutor maillist - Tutor@python.org ER> http://www.python.org/mailman/listinfo/tutor ER> ER> -- Evgeny A)bort, R)etry, I)gnore, V)alium? From taveren@bigfoot.com Fri Jan 21 03:59:58 2000 From: taveren@bigfoot.com (ge0desic) Date: Thu, 20 Jan 00 22:59:58 -0500 Subject: [Tutor] Interacting with Windows NT commads Message-ID: <200001210359.TAA15782@gull.prod.itd.earthlink.net> Hi, I've been working through Learning Python and am looking to start putting some of it into practice. I would like to start off by simplifying some repetitive NT Admin tasks. In particular I want to interact with NT command line commands. How do I call NT commands through Python? Thanks in advance, David From juanj_garcia@ieci.es Fri Jan 21 11:49:36 2000 From: juanj_garcia@ieci.es (juanj_garcia@ieci.es) Date: Fri, 21 Jan 2000 12:49:36 +0100 Subject: [Tutor] (no subject) Message-ID: SUSCRIBE From eroubinc@u.washington.edu Fri Jan 21 14:07:00 2000 From: eroubinc@u.washington.edu (Evgeny Roubinchtein) Date: Fri, 21 Jan 2000 06:07:00 -0800 (PST) Subject: [Tutor] Interacting with Windows NT commads In-Reply-To: <200001210359.TAA15782@gull.prod.itd.earthlink.net> Message-ID: On Thu, 20 Jan 2000, ge0desic wrote: D> I've been working through Learning Python and am looking to start putting D> some of it into practice. I would like to start off by simplifying some D> repetitive NT Admin tasks. In particular I want to interact with NT D> command line commands. How do I call NT commands through Python? Use the os module, probably os.system() and os.pipe() are most useful. -- Evgeny SPDS: Scramble PDS From jstok@bluedog.apana.org.au Sun Jan 23 00:50:58 2000 From: jstok@bluedog.apana.org.au (Jason Stokes) Date: Sun, 23 Jan 2000 11:50:58 +1100 Subject: [Tutor] Oh god, how stupid am I already Message-ID: <00ca01bf653b$ec083560$435a0cca@jstok> This is a multi-part message in MIME format. ------=_NextPart_000_00C7_01BF6598.1CF33B00 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable ------=_NextPart_000_00C7_01BF6598.1CF33B00 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 
------=_NextPart_000_00C7_01BF6598.1CF33B00-- From spirou@carolo.net Sun Jan 23 01:08:29 2000 From: spirou@carolo.net (Denis) Date: Sun, 23 Jan 2000 01:08:29 +0000 Subject: [Tutor] learning python References: <8c.819dca.25b8ee4b@aol.com> Message-ID: <388A548D.C645BF26@carolo.net> DApugster@aol.com wrote: > > Can you tell me a website that goes in-depth so I could learn python. > Did you try http://www.python.org/ and explore all the documentation links ? -- Denis "When you don't use your grey cells, you force me to use my fingers" From spirou@carolo.net Sun Jan 23 01:10:45 2000 From: spirou@carolo.net (Denis) Date: Sun, 23 Jan 2000 01:10:45 +0000 Subject: [Tutor] Oh god, how stupid am I already References: <00ca01bf653b$ec083560$435a0cca@jstok> Message-ID: <388A5515.E5B8FC3A@carolo.net> > Jason Stokes wrote: > > You told it. ;-) Don't forget your message next time. Denis From nconway@klamath.dyndns.org Sun Jan 23 19:38:20 2000 From: nconway@klamath.dyndns.org (Neil Conway -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I want to take the output of os.listdir() and test each entry to see if it is a directory, or a regular file. What is the best way to do this? I would prefer a method that works on Windows, Mac and UNIX, but if it is OS-dependant, UNIX is by far the most important. Sorry if this is in the standard documentation, I couldn't find it. Thanks in advance,, Neil - -- Neil Conway Get my GnuPG key from It should be first patch, not first post -- Alan Cox -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.1 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.5 and Gnu Privacy Guard iD8DBQE4i1iogmYXwds8KfwRAklOAJ4qBW7uy1u95s5ZmdNXcbnAzTfFYwCfTXsq g7R80GDo42OaJOW6hFWrATg= =AjXW -----END PGP SIGNATURE----- From arcege@shore.net Sun Jan 23 19:52:06 2000 From: arcege@shore.net (Michael P. Reilly) Date: Sun, 23 Jan 2000 14:52:06 -0500 (EST) Subject: [Tutor] Howto test if something is a directory? In-Reply-To: <14475.22700.846128.521181@metro.cr1006145-a> from "Neil Conway > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I want to take the output of os.listdir() and test each entry to see > if it is a directory, or a regular file. What is the best way to do > this? > > I would prefer a method that works on Windows, Mac and UNIX, but if it > is OS-dependant, UNIX is by far the most important. > > Sorry if this is in the standard documentation, I couldn't find it. The best way that I've found is: import os for fname in os.listdir(dirname): file = os.path.join(dirname, fname): if os.path.isdir(file): print fname, 'is a directory' elif os.path.islink(file): print fname, 'is a symbolic link' elif os.path.isfile(file): print fname, 'is a file' Unfortunately, there isn't a nice way to distinguish between other specific types of files (block and character devices, FIFO and sockets) without looking at the output of os.stat(). -Arcege -- ------------------------------------------------------------------------ | Michael P. Reilly, Release Engineer | Email: arcege@shore.net | | Salem, Mass. USA 01970 | | ------------------------------------------------------------------------ From cwebster@nevada.edu Sun Jan 23 19:57:03 2000 From: cwebster@nevada.edu (Corran Webster) Date: Sun, 23 Jan 2000 11:57:03 -0800 (PST) Subject: [Tutor] Howto test if something is a directory? In-Reply-To: <14475.22700.846128.521181@metro.cr1006145-a> Message-ID: On Sun, 23 Jan 2000, Neil Conway > I want to take the output of os.listdir() and test each entry to see > if it is a directory, or a regular file. What is the best way to do > this? > > I would prefer a method that works on Windows, Mac and UNIX, but if it > is OS-dependant, UNIX is by far the most important. > > Sorry if this is in the standard documentation, I couldn't find it. > > Thanks in advance,, I think you want the routines in os.path, such as os.path.isdir() and os.path.isfile(). You don't say what you want to use the info for, but if you are trying to walk a directory tree, look at os.path.walk(). Regarsd, Corran From insyte@emt-p.org Mon Jan 24 07:07:15 2000 From: insyte@emt-p.org (Ben Beuchler) Date: Mon, 24 Jan 2000 01:07:15 -0600 (CST) Subject: [Tutor] Creating a list of lists Message-ID: I will be working with a ';' delimited text file with customer information on each line. I would like to treat it as a 'list of lists' as it where. For some reason, I can't seem to come up with a way to add a list to a list as a list. ;-) I hope that didn't make sense to you, because it doesn't to me. What I can't figure out how to accomplish is combining lists inside another list without it just becoming smashed together in one big list. [1,2,3] and [4,5,6] should become [[1,2,3], [4,5,6]] not [1,2,3,4,5,6]. Thanks for any direction... Ben -- "There is no spoon" -- The Matrix From DOUGS@oceanic.com Mon Jan 24 08:26:42 2000 From: DOUGS@oceanic.com (Doug Stanfield) Date: Sun, 23 Jan 2000 22:26:42 -1000 Subject: [Tutor] Creating a list of lists Message-ID: <5650A1190E4FD111BC7E0000F8034D26A0F286@huina.oceanic.com> Go to the interpreter and do some experimenting. My session is below: [dougs@lawelawe dougs]$ python Python 1.5.2 (#1, Apr 18 1999, 16:03:16) [GCC pgcc-2.91.60 19981201 (egcs-1.1.1 on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> list1 = [1,2,3] >>> list2 = [2,3,4] >>> list3 = [3,4,5] >>> the_list = [] >>> the_list.append(list1) >>> the_list.append(list2) >>> the_list.append(list3) >>> the_list [[1, 2, 3], [2, 3, 4], [3, 4, 5]] >>> That will translate into more or less the following when you try to put into use: ...whatever preliminary stuff is required to read the file... import string the_outside_list = [] # this will be the final product # assuming 'lines' might be the output of a readlines() # someplace above, a list of strings that represent each line of # the input from the file. The statement below fills 'each' # with a single line for further processing. for each in lines: columns = string.split(each,';') # the output of the split method is a list the_outside_list.append(columns) # append the list from each line You'll end up with a list of lists as desired. -Doug- > -----Original Message----- > From: Ben Beuchler [mailto:insyte@emt-p.org] > Sent: Sunday, January 23, 2000 9:07 PM > To: Python Tutor > Subject: [Tutor] Creating a list of lists > > > I will be working with a ';' delimited text file with > customer information > on each line. I would like to treat it as a 'list of lists' > as it where. > > For some reason, I can't seem to come up with a way to add a list to a > list as a list. ;-) I hope that didn't make sense to you, because it > doesn't to me. > > What I can't figure out how to accomplish is combining lists inside > another list without it just becoming smashed together in one > big list. > > [1,2,3] and [4,5,6] should become [[1,2,3], [4,5,6]] not > [1,2,3,4,5,6]. > > Thanks for any direction... > > Ben > > -- > "There is no spoon" > -- The Matrix > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor > From alan.gauld@bt.com Mon Jan 24 12:58:31 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 24 Jan 2000 12:58:31 -0000 Subject: [Tutor] Interacting with Windows NT commads Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5FD2@mbtlipnt02.btlabs.bt.co.uk> > I've been working through Learning Python and am looking to > start putting > some of it into practice. I would like to start off by > simplifying some > repetitive NT Admin tasks. In particular I want to interact with NT > command line commands. How do I call NT commands through Python? 2 ways: 1) use the system() call from python 2) use the python enbgine for Windows Script Host which creates an object model for doing these things(including a Run() method The latter allows you to use any of: VBscript, Jscript, Perl or Python... Alan G. PS, Anyone know where do we get the python engine? - MS say it exists but I can't find it... From TBCOO@aol.com Mon Jan 24 17:32:42 2000 From: TBCOO@aol.com (TBCOO@aol.com) Date: Mon, 24 Jan 2000 12:32:42 EST Subject: [Tutor] will not work on 95? Message-ID: py152.exe I have installed this but it reads that it is for NT? I am running Win 95... what am I doing wrong? thanks in advance, Teddy Hale From insyte@emt-p.org Mon Jan 24 19:12:31 2000 From: insyte@emt-p.org (Ben Beuchler) Date: Mon, 24 Jan 2000 13:12:31 -0600 (Central Standard Time) Subject: [Tutor] Creating a list of lists In-Reply-To: <5650A1190E4FD111BC7E0000F8034D26A0F286@huina.oceanic.com> Message-ID: On Sun, 23 Jan 2000, Doug Stanfield wrote: > >>> list1 = [1,2,3] > >>> list2 = [2,3,4] > >>> list3 = [3,4,5] > >>> the_list = [] > >>> the_list.append(list1) > >>> the_list.append(list2) > >>> the_list.append(list3) > >>> the_list > [[1, 2, 3], [2, 3, 4], [3, 4, 5]] > >>> No I feel like a real moron. I was trying to do: the_list = the_list.append(list3) which is obviously the wrong idea. I forgot about append changing things in place... Thanks for pointing me back in the right direction! Ben -- Time is an illusion. Lunchtime doubly so. --- Ford Prefect From tim_one@email.msn.com Mon Jan 24 23:20:03 2000 From: tim_one@email.msn.com (Tim Peters) Date: Mon, 24 Jan 2000 18:20:03 -0500 Subject: [Tutor] will not work on 95? In-Reply-To: Message-ID: <000c01bf66c1$8ba60da0$a42d153f@tim> [TBCOO@aol.com] > py152.exe I have installed this but it reads that it is for NT? > I am running Win 95... > what am I doing wrong? > thanks in advance, > Teddy Hale The msg probably occurred while you were installing, and said that your version of CTL3D32.DLL is the wrong one for your system. Right? If so, it's not a Python problem, and doesn't hurt anything. Just keep going. To fix it, look for "CTL3D32" on the web; it's a problem with a Microsoft DLL and hundreds of web pages describe how to restore the correct version for your OS (something else you installed, in the past, replaced this DLL with the NT version; it's a nuisance but not harmful). From spirou@carolo.net Tue Jan 25 17:40:47 2000 From: spirou@carolo.net (Denis) Date: Tue, 25 Jan 2000 17:40:47 +0000 Subject: [Tutor] I am new to python and programming!.. it is not running the module References: <000c01bd1d75$dac40320$1def0618@union1.nj.home.com> Message-ID: <388DE01F.CA9E6833@carolo.net> > ryan mcmenamin wrote: > > I type in what my book tells me to for the code (...) > File "C:\Program Files\Python\hello.py", line 1 > Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on > win32 > ^ > SyntaxError: invalid syntax You try to write a module in the command line interpreter ... When you get the >>> prompt, you may write things like >>> a = 5 and then press enter, then you will get a new >>> prompt, there you could write >>> print a and then press enter, the interpreter will write : 5 and then you'll get a new >>> prompt and so on. If you want to type in a "HelloWorld.py", then you must first open a new window : File --> New Window (I guess it should be Ctrl-N under Windows). Then you'll get a brand new window completely white. Type your lines there in and run the file (F5 - Run) Don't forget the Idle doc if you want to know more about it. Have fun Denis From deirdre@deirdre.net Wed Jan 26 00:52:38 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Tue, 25 Jan 2000 16:52:38 -0800 (PST) Subject: [Tutor] hey... im a newbie.. trying to make a program that finds the lcm of multiple numbers numbers In-Reply-To: <001801bd1dc6$1e6f9080$1def0618@union1.nj.home.com> Message-ID: On Sat, 10 Jan 1998, ryan mcmenamin wrote: > Hey python community, > I got it to count 2 numbers multiples.... now how do i get it to find > the least multiple of each number. In general, you want to find the prime numbers that constitute each of the numbers (which you apparently have). Let's say the numbers are 18 and 15: 18 = 2 * 3 * 3 15 = 3 * 5 So you'd need to walk through the list of primes and make a list that contained all the elements of both: 90 = 2 * 3 * 3 * 5 There are several ways of approaching this; why don't you show us what you've done so far? -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "Mars has been a tough target" -- Peter G. Neumann, Risks Digest Moderator "That's because the Martians keep shooting things down." -- Harlan Rosenthal , retorting in Risks Digest 20.60 From insyte@emt-p.org Wed Jan 26 04:26:57 2000 From: insyte@emt-p.org (Ben Beuchler) Date: Tue, 25 Jan 2000 22:26:57 -0600 (CST) Subject: [Tutor] Sorting In-Reply-To: Message-ID: On Tue, 18 Jan 2000, Daniel Yoo wrote: > > The specific problem I'm facing is that I'm going to be reading in a file > > and using string.split() to turn each line into a list. This will give me > > a "list of lists". (Is this what other languages call an array?) I want > > to be able to sort based on any position in a line. Specifically, I would > > like to be able to sort the entire file based on the same index offset on > > each line. Effectively sorting based on a specific 'column' in the file. > > I believe that you can write a quick lambda expression to use with the > python sort() routine that should work nicely. Here's an example program > that sorts lines based on the character on the 4 column: > > import sys > from string import * > lines = sys.stdin.readlines() > lines.sort(lambda x,y: x[3] > y[3]) > for x in lines: print rstrip(x) I have to admit, the ability to pass extra arguments to x.sort() confuses me. Can you clarify a little what is happening in that lambda expression and how it talks sort into dealing with the fourth column instead of the first? Thanks, Ben -- "There is no spoon" -- The Matrix From tim_one@email.msn.com Wed Jan 26 05:39:15 2000 From: tim_one@email.msn.com (Tim Peters) Date: Wed, 26 Jan 2000 00:39:15 -0500 Subject: [Tutor] Sorting In-Reply-To: Message-ID: <000001bf67bf$aedb8620$592d153f@tim> [posted & mailed] [possibly Daniel Yoo -- hard to tell!] > I believe that you can write a quick lambda expression to use > with the python sort() routine that should work nicely. Here's > an example program that sorts lines based on the character on > the 4 column: > > import sys > from string import * > lines = sys.stdin.readlines() > lines.sort(lambda x,y: x[3] > y[3]) > for x in lines: print rstrip(x) [Ben Beuchler] > I have to admit, the ability to pass extra arguments to x.sort() > confuses me. Can you clarify a little what is happening in that > lambda expression and how it talks sort into dealing with the > fourth column instead of the first? Part of the confusion may be that the example above is incorrect. First do yourself a favor, and forget lambdas: use ordinary named functions. They're easier to understand and more powerful. Sorting works by comparing pairs of list elements. If you don't want the way Python compares elements by default, you can pass a function to list.sort() that tells Python how to compare elements the way *you* want them compared. Such a function takes two arguments, the elements to be compared. Call them x and y. The function should return -1 if xy (this strange interface is inherited from the C language's sorting routines). list.sort() calls this function each time it needs to compare a pair of elements. If you don't pass an argument, the builtin function "cmp" is used by default. So the normal list.sort() is equivalent to (except quicker than): def normal_compare(x, y): return cmp(x, y) list.sort(normal_compare) In turn, that's equivalent to list.sort(cmp) (putting a wrapper "normal_compare" around cmp doesn't change what cmp does!). If you want to sort in *reverse* order, one way to do it is def reverse_normal_compare(x, y): return cmp(y, x) # note the argument order is swapped list.sort(reverse_normal_compare) Another, trickier, way is: def reverse_normal_compare(x, y): return -cmp(x, y) # swaps +1 with -1, leaves 0 alone But don't do either of those . The best (simplest and by far fastest) way to reverse sort is list.sort() list.reverse() Once you understand how the "reverse sort" works, fancier applications are just details piled on top of the same basic idea. See Andrew Dalke's excellent examples at http://www.python.org/doc/howto/sorting/sorting.html From jan.sommerfeld@online-datenbank.de Wed Jan 26 13:42:37 2000 From: jan.sommerfeld@online-datenbank.de (Jan) Date: Wed, 26 Jan 2000 14:42:37 +0100 Subject: [Tutor] calling other ((Linux-) programs from python? Message-ID: <00012614450801.02089@linux> Hello, I磀 like to call a program called "Tidy" from python. Tidy gets some html file and returns a cleaned version of it to the _stdout. I want to write this _stdout with python to a file (maybe doing some other stuff before). Are there any docs this topic? TIA, Jan From dyoo@hkn.EECS.Berkeley.EDU Wed Jan 26 15:22:34 2000 From: dyoo@hkn.EECS.Berkeley.EDU (Daniel Yoo) Date: Wed, 26 Jan 2000 07:22:34 -0800 (PST) Subject: [Tutor] Sorting In-Reply-To: Message-ID: On Tue, 25 Jan 2000, Ben Beuchler wrote: > > lines.sort(lambda x,y: x[3] > y[3]) > > for x in lines: print rstrip(x) > > I have to admit, the ability to pass extra arguments to x.sort() confuses > me. Can you clarify a little what is happening in that lambda expression > and how it talks sort into dealing with the fourth column instead of the > first? The way that sort() works is that it compares pairs of elements to figure out which element is smaller than another. If it finds that the two elements are misplaced, it'll swap them and reduce the disorder of the list. If it does this enough times on different elements, eventually, the whole list gets sorted. More sophisticated sorting algorithms do more work, but essentially, this is the essence of comparison sorting. By default, since we're working with strings, it will compare the two elements based on lexiographic order, I think. However, we want to change the notion of which elements should come first in a sorted list. sort() supports this by letting us change the comparison function. From the Python reference library: "The sort() method takes an optional argument specifying a comparison function of two arguments (list items) which should return -1, 0 or 1 depending on whether the first argument is considered smaller than, equal to, or larger than the second argument. Note that this slows the sorting process down considerably; e.g. to sort a list in reverse order it is much faster to use calls to the methods sort() and reverse() than to use the built-in function sort() with a comparison function that reverses the ordering of the elements." The lambda expression, strictly speaking, shouldn't work, since it only returns either 0 or 1. I was careless. Sorry about that. *grin* But if we have a function like: def comparethirdcolumn(line1, line2): if line1[2] < line2[2]: return -1 elsif line1[2] > line2[2]: return 1 else: return 0 then it should be ok to call lines.sort(comparethirdcolumn). If you have any more questions, please send it to the whole python list too, just in case I blundered anywhere. From insyte@emt-p.org Sat Jan 22 01:53:37 2000 From: insyte@emt-p.org (Ben Beuchler) Date: Fri, 21 Jan 2000 19:53:37 -0600 (Central Standard Time) Subject: [Tutor] Sorting In-Reply-To: Message-ID: On Wed, 26 Jan 2000, Daniel Yoo wrote: > then it should be ok to call lines.sort(comparethirdcolumn). If you have > any more questions, please send it to the whole python list too, just in > case I blundered anywhere. Thanks! I think that was the most thorough dissertation on the subject I have encountered yet... It seems to be documented in a rather confusing fashion in the online documentation and not at all in "Learning Python." But it actually makes sense now! Thanks again, Ben -- Time is an illusion. Lunchtime doubly so. --- Ford Prefect From dyoo@hkn.EECS.Berkeley.EDU Thu Jan 27 20:37:32 2000 From: dyoo@hkn.EECS.Berkeley.EDU (Daniel Yoo) Date: Thu, 27 Jan 2000 12:37:32 -0800 (PST) Subject: [Tutor] Re: LCM problem In-Reply-To: <20000126170014.176CB1CEF0@dinsdale.python.org> Message-ID: > Hey python community, > I got it to count 2 numbers multiples.... now how do i get it to = > find the least multiple of each number. Are you familiar with the nice definition of LCM that involves the GCD? If you can find the GCD of a list of numbers, then you divide each number by the GCD, and then multiply the result list together. Let's pretend that we have a gcd(x,y) function. Then we could do the following on a list of numbers L: common_gcd = reduce(gcd, L) # this will find the gcd among all in L L2 = map( lambda x: x/common_gcd, L ) After that, just multiply all the numbers in L2 together, and you should have the LCM of those numbers. From alan.gauld@bt.com Fri Jan 28 17:27:39 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 28 Jan 2000 17:27:39 -0000 Subject: [Tutor] tkinter?? Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF6009@mbtlipnt02.btlabs.bt.co.uk> > runpy ??? > from tkinter import * from Tkinter import * #----> Python is case sensitive! > w = button(text="hello", command = "exit") w = Button(text="hello", command="exit") > w.pack() > w.mainloop() Try that. Alan G. From brian@plug15.fsnet.co.uk Fri Jan 28 22:21:05 2000 From: brian@plug15.fsnet.co.uk (brian smith) Date: Fri, 28 Jan 2000 22:21:05 -0000 Subject: [Tutor] help with python 1.5 wrong dos version Message-ID: <001101bf69de$1a65d240$a14a883e@brian> This is a multi-part message in MIME format. ------=_NextPart_000_000D_01BF69DD.F77FCCE0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_000E_01BF69DD.F77FCCE0" ------=_NextPart_001_000E_01BF69DD.F77FCCE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable please could you help me when i use python 1.5 on win98 when i gone = passed install hello world then get command prompt c:\python> any command i = give comes up incorrect dos version thank you bri. ------=_NextPart_001_000E_01BF69DD.F77FCCE0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
please could you help me when i use = python 1.5 on=20 win98 when i gone passed
install hello world then get command = prompt=20 c:\python> any command i give comes up incorrect dos version = thank  you=20 bri.
------=_NextPart_001_000E_01BF69DD.F77FCCE0-- ------=_NextPart_000_000D_01BF69DD.F77FCCE0 Content-Type: text/html; name="Intro.htm" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Intro.htm" Intro 3Dnext 3Dup 3Dprevious 3Dcontents
Next: = Hello, World Up: Non-Programmers Tutorial For Python = Previous: Contents   Contents

Subsections=20
  • First things first=20
  • Running Python=20
  • Windows

Intro

First things first

So, you've never programmed before. As we go through this tutorial I = will=20 attempt to teach you how to program. There really is only one way to = learn to=20 program. You must read code and write code. I'm going to show you = lots of=20 code. You should type in code that I show you to see what happens. Play = around=20 with it and make changes. The worst that can happen is that it won't = work. When=20 I type in code it will be format like this:=20

##Python is easy to learn
print "Hello, World!"

Thats so it is easy to distinguish from the other text. To make it = confusing=20 I will also print what the computer outputs in that same font.=20

Now, on to more important things. In order to program in Python you = need the=20 Python software. If you don't already have the Python software go to=20 http://www.python.org/download/ and get the proper version for your = platform.=20 Download it, read the instructions and get it installed.=20

Running Python

This = section is=20 somewhat vague since I am trying to explain how to run Python in general = and not=20 on a specific machine (though I am writing from a Unix viewpoint). If = you have a=20 Microsoft(tm) Windows machine see the next section for details. If you = have a=20 Macintosh see http://www.python.org for other documentation.=20

First you should check to see if you can run Python in interactive = mode. To=20 do this go to a command prompt and type python. If everything = is=20 working you should see something like this:

Python 1.5.1 (#1, Dec =
17 1998, 20:58:15)  [GCC 2.7.2.3] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>>
The >>> is Python's way of telling you it is = waiting for=20 you to type something in.=20

If you did not get the >>> prompt then something is = wrong.=20 Check and make sure that you properly installed Python. Check to see = that the=20 python executable is in the path.=20

Once you got the Python interpreter running you can play around with = it. Here=20 are some things you could try:

>>> 1+1
2
>>> 3*4+5=20
17
>>> a=3D12
>>> a    =20
12
>>> "Hi"
'Hi'
>>>

To exit try typing Ctrl+Z or Ctrl+D or if neither of those works type = import sys; sys.exit(0). Next, how to run Python programs. = First=20 you need create a Python program. To do that you should type in the = following in=20 a text editor:3D[*]

print "Hello, World!"

Now save the file in some convenient location as hello.py. Next go to = directory with the file that you save the file in and type python=20 hello.py. The screen should look something like this: =

>python hello.py
Hello, World!

If you get some error message check to make sure you saved the file = in the=20 right place.=20

From now on I will mainly give you programs to type in that you = should save=20 and then run.=20

Windows

First install = Python.=20 Then goto a command line which can be done one of two ways: Click=20 Start>>Programs>>MS-DOS Prompt, or click=20 Start>>Run, then type command and hit Enter.=20

This will open up a DOS screen with a prompt that probably looks like = this:=20

C:\WINDOWS>

Type python and hit Enter. If you get Bad command = or file=20 name then either you forgot to install Python or = python.exe is not=20 in the PATH variable (to see what the PATH variable = has in it=20 type PATH).=20

To fix the problem click Start>>Find>>Files or = Folders and=20 then look for a file Named python.exe. If it is found = then the=20 problem is the PATH, otherwise Python was not properly = installed.=20

To fix the PATH problem the directory that includes=20 python.exe needs to be added to PATH. The directory = that=20 python is in is the folder that Find shows to the left = of the=20 name. If the whole name is not shown Right click on the python icon and = go to=20 Properties. The Properties dialog will have a line = called=20 Location: that shows the directory where python.exe is = at.=20 Next go to the command prompt and type in PATH=3D"C:\Location of=20 Python\";%PATH%. For Example:

C:\WINDOWS>python
Bad command or file name

C:\WINDOWS>PATH=3D"C:\Programe Files\Python";%PATH%

C:\WINDOWS>python
Python 1.5.1 (#0, Apr 13 1998, 20:22:04) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>>
Type Ctrl+Z to get out of interactive mode (i.e. hold down the = Ctrl Key=20 and then press down on the Z key at the same time, then release both.).=20

Next type this program in a text editor (such as Notepad):

print =
"Hello, World!"
and save it in a convenient location such as=20 C:\python\hello.py.=20

From here you need to change the path to the Python directory where = you saved=20 your first program. The command to do this is (Hit Enter):

cd =
\python
which should give you a prompt like:
C:\Python>

Now you are ready to run your first program. Just type python = hello.py=20

>python hello.py
Hello, World!

From now on in the tutorial I will assume that you know how to create = and run=20 programs.=20


3Dnext 3Dup 3Dprevious 3Dcontents
Next: = Hello, World Up: Non-Programmers Tutorial For Python = Previous: Contents   Contents
Josh Cogliati jjc@iname.com=20
------=_NextPart_000_000D_01BF69DD.F77FCCE0-- From Tabit14@aol.com Sat Jan 29 01:31:37 2000 From: Tabit14@aol.com (Tabit14@aol.com) Date: Fri, 28 Jan 2000 20:31:37 EST Subject: [Tutor] i need help please.... Message-ID: <2d.8ef286.25c39cf9@aol.com> --part1_2d.8ef286.25c39cf9_boundary Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit i downloaded python and new to this so i need to know how to open it.thankx, Tabitha --part1_2d.8ef286.25c39cf9_boundary Content-Type: message/rfc822 Content-Disposition: inline Return-Path: Received: from rly-zc01.mx.aol.com (rly-zc01.mail.aol.com [172.31.33.1]) by air-zc05.mail.aol.com (v67_b1.21) with ESMTP; Fri, 28 Jan 2000 20:27:45 -0500 Received: from python.org (parrot.python.org [132.151.1.90]) by rly-zc01.mx.aol.com (v67_b1.21) with ESMTP; Fri, 28 Jan 2000 20:27:29 -0500 Received: (from daemon@localhost) by python.org (8.9.1a/8.9.1) id UAA07860; Fri, 28 Jan 2000 20:25:40 -0500 (EST) Date: Fri, 28 Jan 2000 20:25:40 -0500 (EST) Message-Id: <200001290125.UAA07860@python.org> From: AutoResponder Subject: Re: i need help please.... To: Tabit14@aol.com Precedence: bulk X-No-Archive: Yes X-Mailer: Python Replybot [version 0.3] X-Ack: No Your message for webmaster@python.org has been received and is being delivered. However, if you are asking a Python-programming specific question, you should instead send it to python-help@python.org. If you are just starting to learn Python and would like to get help for beginners, try contacting tutor@python.org. For general information on the Python programming language, please visit the home page at http://www.python.org/ Webmaster@python.org will probably *not* respond to your message unless it concerns the workings of the Python.Org Web site or some other administrative business. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IMPORTANT NOTE: PLEASE DO NOT USE HTML IN YOUR EMAIL. Not everyone uses a browser to read their email and using HTML can make your message very difficult to read. This reduces the chances that your question will get answered in a timely manner! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Python-help is a mailing list which reaches a number of volunteer Python language experts dedicated to answering questions about the Python programming language. Tutor is a mailing list that helps beginners learn how to use the Python programming language. You can subscribe to the tutor list by visiting the following Web page: http://www.python.org/mailman/listinfo/tutor You do not need to subscribe to python-help to ask a question of the helpers. But please be as clear as you can about the problem, including relevant details such as: - Precise error messages, including complete tracebacks - The hardware platform (available in the Python sys module as sys.platform) - The Python version (sys.version) - The Python search path (sys.path) For more information about Python help resources, visit http://www.python.org/Help.html If you are trying to download Python but do not have access to the Web, please try one of the following ftpmail services available on the Internet. Try sending the message `help' to one of these addresses: bitftp@pucc.princeton.edu ftpmail@ftp.sunet.se www4mail@unganisha.idrc.ca gophermail@eunet.cz getweb@usa.healthnet.org ftpxcorreo@ftp.rcp.net.pe www@kfs.org ftpmail@mail.iif.hu wwwmail@bnl.gov iliad@prime.jsc.nasa.gov www4mail@web.bellanet.org webmail@www.ucc.ie ftpmail@mercure.umh.ac.be bitftp@plearn.edu.pl For those of you asking questions about python snakes, we cannot help you - Python.Org is about the Python programming language, not the snake. Nor do we know about or have any connection with Python tape drives; you might try http://www.seagate.com for more information. Many of us *like* the Monty Python comedy troup, but we can't tell you much about them, either! :-) If you are looking for information on how to be a hacker, you should start with Eric Raymond's seminal article "How To Become a Hacker" at http://www.tuxedo.org/~esr/faqs/hacker-howto.html If you have any problems or questions about any of this, please let webmaster@python.org know. Thanks! "Replace ambition with curiosity." -- A friend's friend --part1_2d.8ef286.25c39cf9_boundary-- From PSmith300@aol.com Sat Jan 29 19:09:47 2000 From: PSmith300@aol.com (PSmith300@aol.com) Date: Sat, 29 Jan 2000 14:09:47 EST Subject: [Tutor] Re: Welcome to the "Tutor" mailing list Message-ID: I am interested in learning python, but have zero experience with any programing language. Any help will be greatly appreciated. Thanks in advance From andre@beta.telenordia.se Sat Jan 29 21:08:39 2000 From: andre@beta.telenordia.se (=?ISO-8859-1?Q?Andr=E9_Dahlqvist?=) Date: Sat, 29 Jan 2000 22:08:39 +0100 (CET) Subject: [Tutor] Re: Welcome to the "Tutor" mailing list In-Reply-To: Message-ID: > I am interested in learning python, but have zero experience with any=20 >programing language. Any help will be greatly appreciated. I would recommend Alan Gaulds introduction to programming as a good place to start. He teaches the basics of programming in general, and most of the examples are written in Python. You can find it at: http://www.crosswinds.net/~agauld // Andr=E9 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Andr=E9 Dahlqvist GnuPG Key ID:=090x70A2994A Fingerprint: =09E947 3297 331C CA30 5B88 EDF2 A830 3EBE 70A2 994A =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D From byohe@nnex.net Sun Jan 30 22:36:07 2000 From: byohe@nnex.net (bonnie yohe) Date: Sun, 30 Jan 2000 16:36:07 -0600 Subject: [Tutor] HELP!!!! Message-ID: <000c01bf6b72$66c518e0$37d5bfce@pavilion> This is a multi-part message in MIME format. ------=_NextPart_000_0009_01BF6B40.1B62C500 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable HELP!! what language does python use ?! ------=_NextPart_000_0009_01BF6B40.1B62C500 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
HELP!! what language does python use=20 ?!
------=_NextPart_000_0009_01BF6B40.1B62C500-- From dandare@micoks.net Mon Jan 31 04:25:56 2000 From: dandare@micoks.net (Daniel W Wobker) Date: Sun, 30 Jan 2000 22:25:56 -0600 Subject: [Tutor] Python totorial problems..... Message-ID: <003601bf6ba3$517003c0$f36299d1@micoks.net> This is a multi-part message in MIME format. ------=_NextPart_000_0033_01BF6B70.FAC22580 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, I am using the Python Tutorial Release 1.5.2 When I get to page 9 = chapter 3 it tells me to type in in interactive mode >>> tax =3D 17.5 / 100 >>> price =3D 3.50 >>> price * tax=20 which should return 0.6125=20 and it dose but the problem is when it tells me to type in: >>> price + _ I get an error message..... here is the hole thing... >>> tax =3D 17.5 / 100 >>> price =3D 3.50 >>> price * tax 0.6125 >>> price + _ Traceback (innermost last): File "", line 0, in ? NameError: _ >>> round(_,2) Traceback (innermost last): File "", line 0, in ? NameError: _ >>>=20 I am using Windows95 and PythonWin build 125 and Python5. has there been a change sence the totorial has been built or is there = somthing I have done wrong or is someone else getting the same = problem..? thanks in advance Daniel W. ------=_NextPart_000_0033_01BF6B70.FAC22580 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello, I am using the Python Tutorial Release 1.5.2 = When I get=20 to page 9 chapter 3 it tells me to type in in interactive = mode
>>> tax =3D 17.5 / 100
>>> price =3D 3.50
>>> price * tax
which should return
0.6125
and it dose but the problem is when it tells me to = type=20 in:
>>> price + _
I get an error message..... here is the hole=20 thing...

>>> tax =3D 17.5 / 100

>>> price =3D 3.50

>>> price * tax

0.6125

>>> price + _

Traceback (innermost last):

File "<interactive input>", line 0, in ?

NameError: _

>>> round(_,2)

Traceback (innermost last):

File "<interactive input>", line 0, in ?

NameError: _

>>>

I am using Windows95 and PythonWin build 125 and Python5.

has there been a change sence the totorial has been built or is there = somthing I have done wrong or is someone else getting the same = problem..?

thanks in advance

Daniel W.

 

------=_NextPart_000_0033_01BF6B70.FAC22580-- From alan.gauld@bt.com Mon Jan 31 17:20:40 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 31 Jan 2000 17:20:40 -0000 Subject: [Tutor] Python totorial problems..... Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF6019@mbtlipnt02.btlabs.bt.co.uk> > and it dose but the problem is when it tells me to type in: > >>> price + _ > I get an error message..... here is the hole thing... What version of Python do you have, it works for me with Python 1.5.2 But OTOH I was not aware of this '_' trick so it might be a recent introduction to Python not supported by your version. [ I learnt Python on v1.3, and am pretty sure this wasn't mentioned anywhere in the docs then... ] Any of the list guru's like to say when this appeared? Alan G. PS Could just be that I just missed seeing it of course! :-) From dyoo@hkn.EECS.Berkeley.EDU Mon Jan 31 17:31:54 2000 From: dyoo@hkn.EECS.Berkeley.EDU (Daniel Yoo) Date: Mon, 31 Jan 2000 09:31:54 -0800 (PST) Subject: [Tutor] Re: Tutor digest, Vol 1 #222 - 2 msgs In-Reply-To: <20000131170009.5B25C1CE65@dinsdale.python.org> Message-ID: > Message: 1 > From: "bonnie yohe" > To: > Date: Sun, 30 Jan 2000 16:36:07 -0600 > boundary="----=_NextPart_000_0009_01BF6B40.1B62C500" > Subject: [Tutor] HELP!!!! > > HELP!! what language does python use ?! English pseudocode. *grin* Python is its own language, similar to C++ or Java. It's a higher level language. Take a look at www.python.org for introductions and tutorials. From oc918@mizzou.edu Mon Jan 31 18:52:20 2000 From: oc918@mizzou.edu (Oscar Chavez) Date: Mon, 31 Jan 2000 12:52:20 -0600 Subject: [Tutor] Python tutorials Message-ID: Most tutorials' examples are based in operations with strings and text in general. Are there any Python tutorials that stress its math capabilities? In particular, I have noticed that there is a limit on the integers that Python can handle, but I don't know exactly to what extent this can be modified. I would like to do operations with matrices, factoring integers and floating point operations. Where should I look for help on these matters? _____________________________________________________________________ Oscar Chavez You can only find truth with logic if Mathematics Education you have already found truth without it. 104 Stewart Hall University of Missouri The Man who was Orthodox Columbia, MO 65211-6180 G. K. Chesterton oc918@mizzou.edu tel: (573) 882-4521 fax: (573) 882-4481 Return-Path: Delivered-To: tutor@dinsdale.python.org Received: from python.org (parrot.python.org [132.151.1.90]) by dinsdale.python.org (Postfix) with ESMTP id BF7901CE60 for ; Mon, 24 Jan 2000 09:08:08 -0500 (EST) Received: from danube.ccity.com ([166.86.254.126]) by python.org (8.9.1a/8.9.1) with SMTP id JAA19160 for ; Mon, 24 Jan 2000 09:07:40 -0500 (EST) From: David_Gadoury@ccnotes.ccity.com Received: by danube.ccity.com(Lotus SMTP MTA v4.6.4 (830.2 3-23-1999)) id 85256870.004CE5B9 ; Mon, 24 Jan 2000 08:59:55 -0500 X-Lotus-FromDomain: CARMAX@CIRCUIT CITY@CCEXTERNAL To: alan.gauld%bt.com@ccnotes.ccity.com Cc: tutor%python.org@ccnotes.ccity.com Message-ID: <85256870.004CE52F.00@danube.ccity.com> Date: Mon, 24 Jan 2000 09:07:01 -0500 Subject: RE: [Tutor] Interacting with Windows NT commads Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-Disposition: inline Sender: tutor-admin@python.org Errors-To: tutor-admin@python.org X-BeenThere: tutor@python.org X-Mailman-Version: 1.2 (experimental) Precedence: bulk List-Id: Discussion for learning programming with Python Option 2 would be preferrable. I haven't even seen a reference to the python engine for WSH anywhere in my searches. I would love to get my hands on it. >2) use the python enbgine for Windows Script Host which creates an >object model for doing these things(including a Run() method >The latter allows you to use any of: >VBscript, Jscript, Perl or Python... From curtis.larsen@Covance.Com Mon Jan 31 22:06:55 2000 From: curtis.larsen@Covance.Com (Curtis Larsen) Date: Mon, 31 Jan 2000 16:06:55 -0600 Subject: [Tutor] URLLIB Proxy Question Message-ID: I'm new to Python and am trying to get the URLLIB working using an HTTP proxy, but I can't seem to get the magic combination together. I set up a variable named "http_proxy" with the (apparent?) value of "http://servername:port/", but it's still no go. The latest error message I receive is "AssertionError: proxies must be a mapping" A "mapping" what...? Suggestions? Ideas? Thanks in advance! Curtis PS: Sorry for the disclaimer -- can't avoid it. begin 644 TEXT.htm M/"%$3T-465!%($A434P@4%5"3$E#("(M+R]7,T,O+T141"!(5$U,(#0N,"!4 M7!E/@T*/$U%5$$@8V]N=&5N=#TB35-(5$U,(#4N,#`N,C6EN9R!T;R!G970@=&AE)FYB'DB M('=I=&@@=&AE("AA<'!A Message-ID: <200001312226.XAA24344@dionysus.fw.cuci.nl> On 31 Jan 00, at 16:06, Curtis Larsen wrote: > I'm new to Python and am trying to get the URLLIB working using an HTTP > proxy, but I can't seem to get the magic combination together. > I set up a variable named "http_proxy" with the (apparent?) value of > "http://servername:port/", but it's still no go. > The latest error message I receive is "AssertionError: proxies must be a > mapping" > > A "mapping" what...? A dictionary. For example: proxies = {'http': 'http://192.168.1.1:8080'} then use urlopener = urllib.FancyURLopener(proxies) HTH, --Hans Nowak (zephyrfalcon@hvision.nl) Homepage: http://fly.to/zephyrfalcon You call me a masterless man. You are wrong. I am my own master. From dsh8290@rit.edu Mon Jan 10 01:02:45 2000 From: dsh8290@rit.edu (D-Man) Date: Sun, 9 Jan 2000 20:02:45 -0500 Subject: [Tutor] why must I explicitly use 'self' In-Reply-To: <200101100751_MC2-C145-E9FC@compuserve.com>; from NHYTRO@compuserve.com on Wed, Jan 10, 2001 at 07:51:05AM -0500 References: <200101100751_MC2-C145-E9FC@compuserve.com> Message-ID: <20000109200245.A11930@dman.rh.rit.edu> On Wed, Jan 10, 2001 at 07:51:05AM -0500, Sharriff Aina wrote: | Hi! | | Can someone explain exactly why I have to add "self" to a class function | that I've defined? | Have you written any C++/Java/Eiffel code before? In C++ you could write: class blah { void myfunction( void ) { cout << "Hello Class" << endl ; } } You could also write: class Foo { string message = "Hello Class" ; void myfunction( void ) { cout << this->message << endl ; } } They key point to note is the use of the keyword "this" in the second example. In C++/Java/Eiffel (Eiffel uses a different word, but I can't remember it now) the 'this' keyword is automagically a pointer to the current object. In member functions, it is set automatically. In freestanding functions (C++ only, the others don't allow it) the 'this' keyword isn't allowed. In Python, the "this" variable is passed to member functions as the first argument to the function. Thus every member function must take at least one argument. It is commonly called "self" in python, but can actually be anything you like. If you have a C++/Java background you may want to use "this" instead. # in Python: class Foo: message = "Hello Class" def myfunction( self ) : print self.message HTH, -D | Thanks for your anticipated help | | Sharriff PS. Replying to the digest isn't really a good idea -- the subject is totatlly unrelated to your questions. It is better to change the subject to reflect your purpose in writing. From K.Rawlik@t-online.de Sat Jan 1 00:19:37 2000 From: K.Rawlik@t-online.de (KonradRawlik) Date: Sat, 01 Jan 2000 01:19:37 +0100 Subject: [Tutor] Embedding Python in C Message-ID: <386D4819.4635FB1B@t-online.de> Hi I have the following problem and hope that somebody can help me with it. I was trying to run simple statement strings from a C programm, by PyRun_SimpleString() . But it wouldn't even compile cause I got the link error ' cannot open file "python21_d.lib" '. Now the problem is, there is no such lib with the Python 2.1 pack I downloaded, so why isn't it there and where can I get it, or am I making something completly wrong? I'm using MSVC 6.0. Thanks for any help. K From K.Rawlik@t-online.de Sat Jan 1 02:21:52 2000 From: K.Rawlik@t-online.de (KonradRawlik) Date: Sat, 01 Jan 2000 03:21:52 +0100 Subject: [Tutor] Embedding Python in C References: Message-ID: <386D64C0.96DC1C4E@t-online.de> Thank you very much, that was the problem, in release mode everythings works well. Daniel Yoo schrieb: > On Sat, 1 Jan 2000, KonradRawlik wrote: > > > I have the following problem and hope that somebody can help me with it. > > > > I was trying to run simple statement strings from a C programm, by > > PyRun_SimpleString() . But it wouldn't even compile cause I got the link > > error > > ' cannot open file "python21_d.lib" '. Now the problem is, there is no > > such lib with the Python 2.1 pack I downloaded, so why isn't it there > > and where can I get it, or am I making something completly wrong? I'm > > using MSVC 6.0. > > I sounds like it's looking for the debug version of the Python library. > However, instead of getting the debug library, you might want to turn off > MSCV's debug mode off altogether: from what I've heard, it's not useful at > all when writing Python extensions. > > The Python web site has the following written about it: > "Python-2.1-Debug.zip is a set of DLLs for Windows developers compiled in > debug mode; it contains nothing of value for regular Python users." > > Still, if you need it, you can download it here: > > http://python.org/ftp/python/2.1/Python-2.1-Debug.zip