From glingl@aon.at Thu Aug 1 05:40:01 2002 From: glingl@aon.at (Gregor Lingl) Date: Thu, 01 Aug 2002 06:40:01 +0200 Subject: [Tutor] Use? Abuse? Amusement? Amendments? References: <3D485C3F.3060304@aon.at> <20020731235822.4334e2e9.ckasso@sprynet.com> Message-ID: <3D48BBA1.3030008@aon.at> Chris Kassopulo schrieb: >Running Python 2.0.1 > >$ python /home/ckasso/python/turtles.py > File "/home/ckasso/python/turtles.py", line 7 > yield 1 > ^ >SyntaxError: invalid syntax > > > Of course, I forgot to mention: trees.py needs Python 2.2 or higher This is because it's intention was (among others) to have some visual representation of how generators work - an those were introduced in Python only with V2.2 Gregor From aris.santillan@summitmedia.com.ph Thu Aug 1 06:38:05 2002 From: aris.santillan@summitmedia.com.ph (Aris Santillan) Date: Thu, 1 Aug 2002 13:38:05 +0800 Subject: [Tutor] SCP / SFTP Message-ID: Hello guys! im a newbie does anyone had a script for wrapping a SCP / SFTP command in python, coz i want to embed it on a DTML? Aris Santillan From pydan@danshafer.com Thu Aug 1 06:49:06 2002 From: pydan@danshafer.com (Dan Shafer) Date: Wed, 31 Jul 2002 22:49:06 -0700 Subject: [Tutor] Tkinter Editor Message-ID: <5.1.0.14.0.20020731224717.00aa3d70@mail.hurrah.com> Check out PythonCard (http://www.pythoncard.org), a GUI-creation tool being patterned after the mold of HyperCard and Visual Basic and built on top of wxWindows. While the current release (0.6.8.1) is not commercial software and you need to understand Python coding a bit to get the most out of it, it's quite usable as it is. It comes with a ton of great samples (caveat..I wrote some of them!) and good (though incomplete) docs (another caveat...I wrote most of them). It has its own mailing list, too. Dan Shafer, Chief Scribe and Tablet Keeper PythonCard Open Source Project http://pythoncard.sourceforge.net From scot@possum.in-berlin.de Thu Aug 1 10:15:15 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Thu, 1 Aug 2002 11:15:15 +0200 Subject: [Tutor] Skipping elements from inside generator loops Message-ID: <200208011115.15161.scot@possum.in-berlin.de> Hello there, So here I am playing around with generators, and just for the heck of it I see if I can get a for-loop to skip one element from inside the loop. To my surprise, this works (in Python 2.2): ================================================== from __future__ import generators procession= ['black cat', 'white cat', 'grey cat', 'ALARM!', 'the evil dog', 'fat cat', 'slow cat'] def animal_walk(animal_list): for one_animal in animal_list: yield one_animal cat_parade = animal_walk(procession) for animal in cat_parade: if animal == 'ALARM!': # Skip one animal on list cat_parade.next() else: print animal ============================================= This produces: =================== black cat white cat grey cat fat cat slow cat =================== Somehow, it doesn't seem right to be able to change what amounts to a loop counter from the inside, even though it is useful here. Fooling around some more, I find that you can not do this with "normal" for loops: =============================== for a in range(len(procession)): if procession[a] == 'ALARM!': a = a+1 else: print procession[a] =============================== lets fido into the fun (in other words, ignores the 'a=a+1'. It only works with a while-loop and a counter: =============================== counter = 0 while counter < len(procession): if procession[counter] == 'ALARM!': counter = counter+2 else: print procession[counter] counter = counter+1 =============================== Now I'm curious: Is this ability to manipulate generator loops from the inside considered a bug or a feature? It certainly makes the "normal" for loop behave differently than the generator for loop, and that alone seems like a good way to shoot yourself in the foot... [While we're at it: I assume that there is a way to solve the problem with list comprehensions, but I can't figure it out. Note that looking for the dog directly is considered cheating: All you get to do is skip one list entry when somebody sounds the alarm.] Thanks again for the help, Y, Scot Who is off to feed his own cat -- Scot W. Stevenson -- scot@possum.in-berlin.de -- Zepernick, Germany From iumarumo@eidosnet.co.uk Thu Aug 1 11:06:33 2002 From: iumarumo@eidosnet.co.uk (ibraheem umaru-mohammed) Date: Thu, 1 Aug 2002 11:06:33 +0100 Subject: [Tutor] Skipping elements from inside generator loops Message-ID: <20020801100633.GJ1595@micromuse.com> [Scot W. Stevenson wrote...] ... -| -| Somehow, it doesn't seem right to be able to change what amounts to a loop -| counter from the inside, even though it is useful here. Fooling around -| some more, I find that you can not do this with "normal" for loops: -| -| =============================== -| for a in range(len(procession)): -| if procession[a] == 'ALARM!': -| a = a+1 -| else: -| print procession[a] -| =============================== -| Hmmnn...This works for me: ibraheem@ignoramus:$ python2.2 Python 2.2.1 (#1, Apr 25 2002, 14:21:58) [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2 Type "help", "copyright", "credits" or "license" for more information. rlcompleter2 0.9.6 activated >>> procession=['black cat', >>> ... 'white cat', >>> ... 'grey cat', >>> ... 'ALARM!', >>> ... 'evil dog', >>> ... 'fat cat', >>> ... 'slow cat'] >>> for a in range(len(procession)): >>> ... if procession[a] == 'ALARM!': >>> ... a = a + 1 >>> ... else: >>> ... print procession[a] >>> ... >>> black cat >>> white cat >>> grey cat >>> evil dog >>> fat cat >>> slow cat >>> But I guess most people would use a 'continue' instead: >>>for a in range(len(procession)): >>>... if procession[a] == 'ALARM!': >>>... continue >>>... else: >>>... print procession[a] >>>... >>>black cat >>>white cat >>>grey cat >>>evil dog >>>fat cat >>>slow cat >>> >>>procession >>>['black cat', 'white cat', 'grey cat', 'ALARM!', 'evil dog', 'fat cat', 'slow cat'] >>> ... Kindest regards, --ibs. -- ibraheem umaru-mohammed www.micromuse.com --0-- -- ibraheem umaru-mohammed www.micromuse.com --0-- From Doug.Shawhan@gecits.ge.com Thu Aug 1 15:40:57 2002 From: Doug.Shawhan@gecits.ge.com (Doug.Shawhan@gecits.ge.com) Date: Thu, 1 Aug 2002 10:40:57 -0400 Subject: [Tutor] Meeester bell. Message-ID: <47B6167F8E69D31194BA0008C7918D4205C54D18@msxcvg02itscge.gecits.ge.com> I have been looking through the modules for a text-mode bell that will work in windows (i.e. not in curses or Tkinter). I am postitive I have seen this beastie somewhere... Any clues? d From hiddenworlds@hotmail.com Thu Aug 1 17:40:24 2002 From: hiddenworlds@hotmail.com (Jerry Brady) Date: Thu, 01 Aug 2002 16:40:24 +0000 Subject: [Tutor] on mailing list Message-ID:

Hi:

Is there anyone thats from Kentucky on your mailing list.. Like to find someone closes to me in

kentucky

Thanks

Jerry

>From: tutor-request@python.org
>Reply-To: tutor@python.org
>To: tutor@python.org
>Subject: Tutor digest, Vol 1 #1807 - 10 msgs
>Date: Thu, 01 Aug 2002 12:00:05 -0400
>
>Send Tutor mailing list submissions to
> tutor@python.org
>
>To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.python.org/mailman/listinfo/tutor
>or, via email, send a message with subject or body 'help' to
> tutor-request@python.org
>
>You can reach the person managing the list at
> tutor-admin@python.org
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of Tutor digest..."
>
>
>Today's Topics:
>
> 1. Re: listdir, ispath and unicode (followup question) (Danny Yoo)
> 2. Re: Use? Abuse? Amusement? Amendments? (Kalle Svensson)
> 3. Problem - how to solve it ? (A)
> 4. Re: Problem - how to solve it ? (Matthew Sherborne)
> 5. Re: Use? Abuse? Amusement? Amendments? (Gregor Lingl)
> 6. SCP / SFTP (Aris Santillan)
> 7. Re: Tkinter Editor (Dan Shafer)
> 8. Skipping elements from inside generator loops (Scot W. Stevenson)
> 9. Re: Skipping elements from inside generator loops (ibraheem umaru-mohammed)
> 10. Meeester bell. (Doug.Shawhan@gecits.ge.com)
>
>--__--__--
>
>Message: 1
>Date: Wed, 31 Jul 2002 15:04:44 -0700 (PDT)
>From: Danny Yoo
>To: Poor Yorick
>cc: tutor@python.org
>Subject: Re: [Tutor] listdir, ispath and unicode (followup question)
>
>
>
>On Wed, 31 Jul 2002, Poor Yorick wrote:
>
> > I am running Windows 2000 English edition. The filename contains
> > cyrillic characters typed with a standard Windows 2000 IME when I
> > created the file. Here is the result of your suggestion:
> >
> > filename = os.path.join(os.getcwd(), os.listdir(os.getcwd())[0])
> >
> > >>> filename
> > 'd:\\tmp2\\???????'
> > >>> os.stat(filename)
> > Traceback (most recent call last):
> > File "", line 1, in ?
> > os.stat(filename)
> > OSError: [Errno 2] No such file or directory: 'd:\\tmp2\\???????'
>
>
>Hmmm... now I'm suspecting that the cyrillic characters might be making a
>difference. I did a scan through the Python Enhancement Proposal 277:
>
> http://www.python.org/peps/pep-0277.html
>
>which implies that Unicode filenames might not work out-of-the-box. If
>your locale at that point where you're running the Python script isn't
>Cyrillic, that can potentially cause problems.
>
>
>The PEP above provides an implementation that's supposed to handle Unicode
>filenames properly, without the intermediate LOCALE translation stuff; can
>you see if this works for you? Sorry about the roundabout way of
>answering your question.
>
>
>
>--__--__--
>
>Message: 2
>Date: Thu, 1 Aug 2002 00:26:41 +0200
>From: Kalle Svensson
>To: tutor@python.org
>Subject: Re: [Tutor] Use? Abuse? Amusement? Amendments?
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>[Sean 'Shaleh' Perry]
> > where does one get turtle?
>
>It seems to be a part of the standard library.
>http://www.python.org/doc/current/lib/module-turtle.html
>
>Peace,
> Kalle
>- --
>Kalle Svensson, http://www.juckapan.org/~kalle/
>Student, root and saint in the Church of Emacs.
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.0.7 (GNU/Linux)
>Comment: Processed by Mailcrypt 3.5.6
>
>iD8DBQE9SGQadNeA1787sd0RAngkAKCdbxhdNJd6J4zawWLAYVhbh9vWDwCgtIA4
>acTGCIaZTaeik061IPDr6BM=
>=GtY4
>-----END PGP SIGNATURE-----
>
>
>--__--__--
>
>Message: 3
>From: "A"
>To: python-list@python.org, tutor@python.org,
> activepython@listserv.activestate.com, python-help@python.org
>Reply-to: printers@sendme.cz
>Date: Wed, 31 Jul 2002 20:54:41 +0200
>Subject: [Tutor] Problem - how to solve it ?
>
>Hi,
>I have a program that I compiled( with Installer) into exe for using
>on Win32 systems. It works well on Windows Me, Windows 9x but
>on some computers with Windows 2000 it causes General
>Protection Error and the programs is finished. It would be nice if the
>program wrote a line number or something similar that could help a
>user find out which command caused that General Protection
>Error. Is there any solution for that?
>Thank you for help
>Ladislav
>
>
>_______________________________________________
>ActivePython mailing list
>ActivePython@listserv.ActiveState.com
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython
>
>
>
>--__--__--
>
>Message: 4
>Date: Thu, 01 Aug 2002 10:08:16 +1200
>From: Matthew Sherborne
>To: printers@sendme.cz
>Cc: python-list@python.org, tutor@python.org,
> activepython@listserv.activestate.com, python-help@python.org
>Subject: [Tutor] Re: Problem - how to solve it ?
>
>GPFs are fired when some C code crashes not python code. In the error it
>should give the name of a DLL or say python.exe.
>
>To find what part of your code is causing the error, do print messages,
>or write to a log file in the area around where the program crashes.
>
>Start in the highest level of the code, print a line before and after
>each sub routine is called, where the print outs stop, go to the sub
>routine after the last print out and put a bunch of print lines between
>all the sections in that and re-run. Keep narrowing it down like this. :)
>
>It may a bug in some windows DLL, so you could either fix it, or release
>a "Known Issues.txt" file with the program, letting them know that they
>must update their windows release if this happens. :)
>
>GBU
>Matthew Sherborne
>
>A wrote:
>
> >Hi,
> >I have a program that I compiled( with Installer) into exe for using
> >on Win32 systems. It works well on Windows Me, Windows 9x but
> >on some computers with Windows 2000 it causes General
> >Protection Error and the programs is finished. It would be nice if the
> >program wrote a line number or something similar that could help a
> >user find out which command caused that General Protection
> >Error. Is there any solution for that?
> >Thank you for help
> >Ladislav
> >
> >
> >_______________________________________________
> >ActivePython mailing list
> >ActivePython@listserv.ActiveState.com
> >To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> >Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython
> >
> >
> >
> >
> >
>
>
>
>
>
>
>--__--__--
>
>Message: 5
>Date: Thu, 01 Aug 2002 06:40:01 +0200
>From: Gregor Lingl
>To: Chris Kassopulo , tutor@python.org
>Subject: Re: [Tutor] Use? Abuse? Amusement? Amendments?
>
>
>Chris Kassopulo schrieb:
>
> >Running Python 2.0.1
> >
> >$ python /home/ckasso/python/turtles.py
> > File "/home/ckasso/python/turtles.py", line 7
> > yield 1
> > ^
> >SyntaxError: invalid syntax
> >
> >
> >
>Of course, I forgot to mention: trees.py needs Python 2.2 or higher
>
>This is because it's intention was (among others) to have some visual
>representation of how generators work - an those were introduced
>in Python only with V2.2
>
>Gregor
>
>
>
>
>
>--__--__--
>
>Message: 6
>From: "Aris Santillan"
>To:
>Date: Thu, 1 Aug 2002 13:38:05 +0800
>Subject: [Tutor] SCP / SFTP
>
>Hello guys!
>
>im a newbie
>
>does anyone had a script for wrapping a SCP / SFTP command
>in python, coz i want to embed it on a DTML?
>
>Aris Santillan
>
>
>--__--__--
>
>Message: 7
>Date: Wed, 31 Jul 2002 22:49:06 -0700
>From: Dan Shafer
>Subject: Re: [Tutor] Tkinter Editor
>To: tutor@python.org
>
>Check out PythonCard (http://www.pythoncard.org), a GUI-creation tool being
>patterned after the mold of HyperCard and Visual Basic and built on top of
>wxWindows. While the current release (0.6.8.1) is not commercial software
>and you need to understand Python coding a bit to get the most out of it,
>it's quite usable as it is. It comes with a ton of great samples (caveat..I
>wrote some of them!) and good (though incomplete) docs (another caveat...I
>wrote most of them).
>
>It has its own mailing list, too.
>
>Dan Shafer, Chief Scribe and Tablet Keeper
>PythonCard Open Source Project
>http://pythoncard.sourceforge.net
>
>
>
>--__--__--
>
>Message: 8
>From: "Scot W. Stevenson"
>Organization: Hexenhaus Zepernick
>To: Tutor
>Date: Thu, 1 Aug 2002 11:15:15 +0200
>Subject: [Tutor] Skipping elements from inside generator loops
>
>Hello there,
>
>So here I am playing around with generators, and just for the heck of it I
>see if I can get a for-loop to skip one element from inside the loop. To
>my surprise, this works (in Python 2.2):
>
>==================================================
>from __future__ import generators
>
>procession= ['black cat',
> 'white cat',
> 'grey cat',
> 'ALARM!',
> 'the evil dog',
> 'fat cat',
> 'slow cat']
>
>def animal_walk(animal_list):
> for one_animal in animal_list:
> yield one_animal
>
>cat_parade = animal_walk(procession)
>
>for animal in cat_parade:
> if animal == 'ALARM!':
> # Skip one animal on list
> cat_parade.next()
> else:
> print animal
>=============================================
>
>This produces:
>
>===================
>black cat
>white cat
>grey cat
>fat cat
>slow cat
>===================
>
>Somehow, it doesn't seem right to be able to change what amounts to a loop
>counter from the inside, even though it is useful here. Fooling around
>some more, I find that you can not do this with "normal" for loops:
>
>===============================
>for a in range(len(procession)):
> if procession[a] == 'ALARM!':
> a = a+1
> else:
> print procession[a]
>===============================
>
>lets fido into the fun (in other words, ignores the 'a=a+1'. It only works
>with a while-loop and a counter:
>
>===============================
>counter = 0
>while counter < len(procession):
> if procession[counter] == 'ALARM!':
> counter = counter+2
> else:
> print procession[counter]
> counter = counter+1
>===============================
>
>Now I'm curious: Is this ability to manipulate generator loops from the
>inside considered a bug or a feature? It certainly makes the "normal" for
>loop behave differently than the generator for loop, and that alone seems
>like a good way to shoot yourself in the foot...
>
>[While we're at it: I assume that there is a way to solve the problem with
>list comprehensions, but I can't figure it out. Note that looking for the
>dog directly is considered cheating: All you get to do is skip one list
>entry when somebody sounds the alarm.]
>
>Thanks again for the help,
>Y, Scot
>
>Who is off to feed his own cat
>
>--
> Scot W. Stevenson -- scot@possum.in-berlin.de -- Zepernick, Germany
>
>
>
>--__--__--
>
>Message: 9
>Date: Thu, 1 Aug 2002 11:06:33 +0100
>From: ibraheem umaru-mohammed
>To: tutor@python.org
>Subject: Re: [Tutor] Skipping elements from inside generator loops
>
>[Scot W. Stevenson wrote...]
>...
>-|
>-| Somehow, it doesn't seem right to be able to change what amounts to a loop
>-| counter from the inside, even though it is useful here. Fooling around
>-| some more, I find that you can not do this with "normal" for loops:
>-|
>-| ===============================
>-| for a in range(len(procession)):
>-| if procession[a] == 'ALARM!':
>-| a = a+1
>-| else:
>-| print procession[a]
>-| ===============================
>-|
>
>Hmmnn...This works for me:
>
> ibraheem@ignoramus:$ python2.2
> Python 2.2.1 (#1, Apr 25 2002, 14:21:58)
> [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> rlcompleter2 0.9.6 activated
> >>> procession=['black cat',
> >>> ... 'white cat',
> >>> ... 'grey cat',
> >>> ... 'ALARM!',
> >>> ... 'evil dog',
> >>> ... 'fat cat',
> >>> ... 'slow cat']
> >>> for a in range(len(procession)):
> >>> ... if procession[a] == 'ALARM!':
> >>> ... a = a + 1
> >>> ... else:
> >>> ... print procession[a]
> >>> ...
> >>> black cat
> >>> white cat
> >>> grey cat
> >>> evil dog
> >>> fat cat
> >>> slow cat
> >>>
>
>But I guess most people would use a 'continue' instead:
>
> >>>for a in range(len(procession)):
> >>>... if procession[a] == 'ALARM!':
> >>>... continue
> >>>... else:
> >>>... print procession[a]
> >>>...
> >>>black cat
> >>>white cat
> >>>grey cat
> >>>evil dog
> >>>fat cat
> >>>slow cat
> >>>
> >>>procession
> >>>['black cat', 'white cat', 'grey cat', 'ALARM!', 'evil dog', 'fat cat', 'slow cat']
> >>>
>
>...
>
>Kindest regards,
>
> --ibs.
>--
> ibraheem umaru-mohammed
> www.micromuse.com
> --0--
>
>
>--
> ibraheem umaru-mohammed
> www.micromuse.com
> --0--
>
>
>--__--__--
>
>Message: 10
>From: Doug.Shawhan@gecits.ge.com
>To: tutor@python.org
>Date: Thu, 1 Aug 2002 10:40:57 -0400
>Subject: [Tutor] Meeester bell.
>
>I have been looking through the modules for a text-mode bell that will work
>in windows (i.e. not in curses or Tkinter).
>
>I am postitive I have seen this beastie somewhere... Any clues?
>
>d
>
>
>
>--__--__--
>
>_______________________________________________
>Tutor maillist - Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>
>End of Tutor Digest


MSN Photos is the easiest way to share and print your photos: Click Here
From jeff@ccvcorp.com Thu Aug 1 17:45:38 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Thu, 01 Aug 2002 09:45:38 -0700 Subject: [Tutor] Skipping elements from inside generator loops References: <20020801100633.GJ1595@micromuse.com> Message-ID: <3D4965B1.24F23C3E@ccvcorp.com> ibraheem umaru-mohammed wrote: > [Scot W. Stevenson wrote...] > ... > -| > -| Somehow, it doesn't seem right to be able to change what amounts to a loop > -| counter from the inside, even though it is useful here. [...] > > Hmmnn...This works for me: [...] > > >>> ... > >>> black cat > >>> white cat > >>> grey cat > >>> evil dog > >>> fat cat > >>> slow cat > >>> The point here was that the generator version (and the while-loop version) skipped the "evil dog" entry. Thus, sounding the "alarm" allowed the felines to frolick unmolested. To my mind, this greater control of the iteration is a very positive feature of generators. By the way, the effect *can* be created with a for-loop: procession= ['black cat', 'white cat', 'grey cat', 'ALARM!', 'the evil dog', 'fat cat', 'slow cat'] cat_parade = procession[:] for n in range(len(cat_parade)): if cat_parade[n] == 'ALARM!': clear = cat_parade.pop(n+1) else: print cat_parade[n] -------- output is ----------- black cat white cat grey cat fat cat slow cat ------------------------------ Note that I am iterating over a copy of the list -- popping an item from the list permanently modifies it, so I'm using a copy that I can throw away just in case the original procession list is needed later. Also, pop() returns the item that was removed from the list -- I'm assigning it to 'clear', an otherwise unused variable, because otherwise the returned item is printed in the interactive shell. It would *not* be printed in a direct execution, though -- this is strictly a feature of the interactive shell that it will display unassigned results, the same feature that lets you do this sort of thing: >>> procession ['black cat', 'white cat', 'grey cat', 'ALARM!', 'the evil dog', 'fat cat', 'slow cat'] >>> BTW, the reason that the original for-loop solution (adding 1 to the loop counter) didn't work has to do with the *way* that for-loops work in Python. In C/C++ (and many other languages), a for loop has a counter that starts at some number, and is incremented until it reaches (or exceeds) some other number, but that's *not* what for-loops do in Python. Instead, they take a list, and sequentially assign each element of the list to the "loop counter" variable. This is pretty apparent when you're iterating over a list of strings, but it's easy to forget when you're using an integer counter. The trick here is that range(len(cat_parade)) actually creates a list of integers. When you added 1 to the counter, you didn't modify that (unnamed) list of integers, and that list is all that the for-loop looks at. Hope that helps... Jeff Shannon Technician/Programmer Credit International From tbrauch@tbrauch.com Thu Aug 1 18:14:07 2002 From: tbrauch@tbrauch.com (Timothy M. Brauch) Date: Thu, 1 Aug 2002 13:14:07 -0400 Subject: [Tutor] on mailing list References: Message-ID: <002d01c2397e$d8bb20c0$9c21840a@tmbrau00> From: "Jerry Brady" To: > Hi: > > Is there anyone thats from Kentucky on your mailing list.. Like to find someone closes to me in > > kentucky > > Thanks > > Jerry I'm from Kentucky, actually Northern Kentucky which almost a completely seperate state. But, I am moving to North Carolina at the end of the week for a job with Wake Forest. Go Demon Deacons! I do know that Centre College in Danville, KY (just outside Lexington) teaches Python in the introductory computer science class. - Tim From abli@freemail.hu Thu Aug 1 18:56:00 2002 From: abli@freemail.hu (Abel Daniel) Date: Thu, 1 Aug 2002 19:56:00 +0200 Subject: [Tutor] Meeester bell. In-Reply-To: <47B6167F8E69D31194BA0008C7918D4205C54D18@msxcvg02itscge.gecits.ge.com> References: <47B6167F8E69D31194BA0008C7918D4205C54D18@msxcvg02itscge.gecits.ge.com> Message-ID: <20020801175600.GB1039@hooloovoo> Doug.Shawhan@gecits.ge.com wrote: > I have been looking through the modules for a text-mode bell that will work > in windows (i.e. not in curses or Tkinter). > > I am postitive I have seen this beastie somewhere... Any clues? > > d I you run the python program in a shell window, you might try >>> print"\007" which beeps (at least for me). This works by echoing a ASCII code 7 which is represented by a beep. Or you can use the winsound module on M$ platforms. abli abli@freemail.hu From Blake.Garretson@dana.com Thu Aug 1 20:40:35 2002 From: Blake.Garretson@dana.com (Blake.Garretson@dana.com) Date: Thu, 1 Aug 2002 15:40:35 -0400 Subject: [Tutor] Meeester bell. Message-ID: Doug.Shawhan@gecits.ge.com wrote: >I have been looking through the modules for a text-mode bell that will work >in windows (i.e. not in curses or Tkinter). > >I am postitive I have seen this beastie somewhere... Any clues? I think you just want: >>>print "\a" The escape signal '\a' is the system alarm (hence the "a" notation.) This is a carry-over from printf in C. -Blake Garretson From Doug.Shawhan@gecits.ge.com Thu Aug 1 20:47:38 2002 From: Doug.Shawhan@gecits.ge.com (Doug.Shawhan@gecits.ge.com) Date: Thu, 1 Aug 2002 15:47:38 -0400 Subject: [Tutor] Meeester bell. Message-ID: <47B6167F8E69D31194BA0008C7918D4205C54D1A@msxcvg02itscge.gecits.ge.com> That's the ticket! (Just prints an ansi character in IDLE, but works like a charm in text!) Thanks for your help. d -------Thus Spake Blake----------------- I think you just want: >>>print "\a" The escape signal '\a' is the system alarm (hence the "a" notation.) This is a carry-over from printf in C. -Blake Garretson From dyoo@hkn.eecs.berkeley.edu Thu Aug 1 21:20:01 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Thu, 1 Aug 2002 13:20:01 -0700 (PDT) Subject: [Tutor] on mailing list In-Reply-To: <002d01c2397e$d8bb20c0$9c21840a@tmbrau00> Message-ID: On Thu, 1 Aug 2002, Timothy M. Brauch wrote: > From: "Jerry Brady" > To: > > Hi: > > > > Is there anyone thats from Kentucky on your mailing list.. Like to > > find someone closes to me in Hi Jerry, By the way, I did some searching for Python user groups here: http://www.onlamp.com/pub/a/python/2001/11/15/pythonnews.html http://python.org/UserGroups.html I didn't see anything in Kentucky yet, but these lists may be outdated. You may want to ask on the newsgroup 'comp.lang.python' to see if there are some people there as well who are close to you. I feel that the Internet is meant to bring people closer, despite physical distance. If you have any questions about Python, please feel free to bring them up here on the Tutor mailing list. We may not be literally at your doorstep, but we'll do our best to discuss Python stuff with you. Good luck! From dyoo@hkn.eecs.berkeley.edu Thu Aug 1 21:28:15 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Thu, 1 Aug 2002 13:28:15 -0700 (PDT) Subject: [Tutor] Tkinter Editor [studying PythonCard's source?] In-Reply-To: <5.1.0.14.0.20020731224717.00aa3d70@mail.hurrah.com> Message-ID: On Wed, 31 Jul 2002, Dan Shafer wrote: > Check out PythonCard (http://www.pythoncard.org), a GUI-creation tool > being patterned after the mold of HyperCard and Visual Basic and built > on top of wxWindows. While the current release (0.6.8.1) is not > commercial software and you need to understand Python coding a bit to > get the most out of it, it's quite usable as it is. It comes with a ton > of great samples (caveat..I wrote some of them!) and good (though > incomplete) docs (another caveat...I wrote most of them). Hi Dan, Would it be ok if we took chunks of PythonCard and do critiques of the code on Tutor? There was a discussion a while back where some of us wanted to see extended examples of Python code with explanations. http://mail.python.org/pipermail/tutor/2002-July/015750.html By doing so, we could see how Python could be used to build bigger and better things, and how one could improve or edit code. But we couldn't decide on what to delve into. PythonCard sounds like a fun project. Best of wishes! From CWyglendowski@greenville.edu Thu Aug 1 22:58:51 2002 From: CWyglendowski@greenville.edu (Christian Wyglendowski) Date: Thu, 01 Aug 2002 16:58:51 -0500 Subject: [Tutor] Python information Message-ID: >>> Isaac Hall 07/30/02 12:48PM >>> The things that I would have really appreciated=20 at that time which I found difficult to find were general OOP 'good=20 behaviours'. for example maybe pointers on when one benifits from creating classes, when one=20 benefits from creating a function outside a class as opposed to a method inside a=20 class. <> I agree with Isaac on this one. I am having a hard time grasping the = object oriented "mindset", or what have you. Perhaps it is not something = that can be learned from a single tutorial, but maybe there are some = conceptual things that could point us OOP newbies in the right direction. Christian +-------------------------------------------------+ Christian Wyglendowski PC Support Specialist Information Technology Greenville College cwyglendowski@greenville.edu 618-664-7073 +-------------------------------------------------+ From rob@uselesspython.com Fri Aug 2 04:22:57 2002 From: rob@uselesspython.com (Rob) Date: Thu, 1 Aug 2002 22:22:57 -0500 Subject: [Tutor] Python information In-Reply-To: Message-ID: OOP does seem to be an interesting situation. We think in objects all day long, and yet when it comes time to program along the same lines, struggle seems common. Perhaps we should put our collective heads together and create a Python equivalent to Robocode, which is designed to teach OOP in Java by having you program battling robot tanks. Let's say you want to write a "Dungeons & Dragons"-type game. You know you'll need it to have certain things (objects). You make a list of some of them: -monsters -dungeons -non-player characters -player characters -weapons -treasure -equipment -etc. Some of these can be lumped into more general categories. For instance, non-player characters and player characters can both fall under the category (class), which can just be called "character". All characters can possess certain characteristics in common, such as: -amount of damage that may be survived -height -weight -name -species -vocation -inventory -etc. The process goes on and on, really. The idea is to think of what kind of objects you will want/need in your program, create classes for these objects, and then create instances of these classes. A class instance can be "Banglor the Elf", a specific instance of class character. Objects have two general things the programmer needs to fuss over: attributes and behavior. Attributes can be the character's name, hair color, fondness for dirty poetry, etc. and behaviors can be throwing spears, running, singing, sleeping, and stopping going forward when bumping into walls. Does any of this sort of discussion help at all? Rob (who should really be studying for tomorrow's C++ final ;-) http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > Christian Wyglendowski > Sent: Thursday, August 01, 2002 4:59 PM > To: tutor@python.org > Subject: Re: [Tutor] Python information > > > >>> Isaac Hall 07/30/02 12:48PM >>> > The things that I would have really appreciated > at that > time which I found difficult to find were general OOP 'good > behaviours'. for example > maybe pointers on when one benifits from creating classes, when one > benefits from > creating a function outside a class as opposed to a method inside a > class. > <> > > I agree with Isaac on this one. I am having a hard time grasping > the object oriented "mindset", or what have you. Perhaps it is > not something that can be learned from a single tutorial, but > maybe there are some conceptual things that could point us OOP > newbies in the right direction. > > Christian > > +-------------------------------------------------+ > Christian Wyglendowski > PC Support Specialist > Information Technology > Greenville College > cwyglendowski@greenville.edu > 618-664-7073 > +-------------------------------------------------+ > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From slime@vsnl.net Thu Aug 1 17:13:30 2002 From: slime@vsnl.net (Prahlad Vaidyanathan) Date: Thu, 1 Aug 2002 21:43:30 +0530 Subject: [Tutor] Re: Meeester bell. In-Reply-To: <47B6167F8E69D31194BA0008C7918D4205C54D18@msxcvg02itscge.gecits.ge.com> References: <47B6167F8E69D31194BA0008C7918D4205C54D18@msxcvg02itscge.gecits.ge.com> Message-ID: <20020801161330.GA910@localhost.localdomain> Hi, On Thu, 01 Aug 2002 Doug.Shawhan@gecits.ge.com spewed into the ether: > I have been looking through the modules for a text-mode bell that will work > in windows (i.e. not in curses or Tkinter). This should work : >>> print "\a" HTH, pv. -- Prahlad Vaidyanathan Government's Law: There is an exception to all laws. From k.boehm@ewt.de Fri Aug 2 08:58:10 2002 From: k.boehm@ewt.de (Klaus Boehm) Date: Fri, 02 Aug 2002 09:58:10 +0200 Subject: [Tutor] directory size Message-ID: <3D4A3B92.4EB1A4EE@ewt.de> How can i determine the size of a directory? In Linux there is a command like " du -hc ." . Is there a similar way in python. Thanks -- ewt gmbh data management group tel: ++49 821 3106 319 fax: ++49 821 3106 399 url: www.ewt.de From shey@argonaut.com Fri Aug 2 09:31:03 2002 From: shey@argonaut.com (shey crompton) Date: Fri, 2 Aug 2002 09:31:03 +0100 Subject: [Tutor] Python information Message-ID: <415C917D807AD411B72C00805FF7330B038362FD@MAILSRV> Hi Rob et al, A python Robocode game sounds like a great idea for a newbie like me. I wish I had the knowhow to write a game like that as it would probably be quite beneficial to complete newbies, and programmers checking out Python. One initial idea would be to have a tutorial that takes you through each part of the robot code. For example, changing the hit points on the enemies (newbie), adding a bigger weapon with graphics etc to your own robot (intermediate), and rewriting the AI for the enemies (expert). I am currently going through Alan Gauld's book and How to Think Like a Computer Scientist. I am setting myself little goals and trying to find out how to achieve them with the knowledge I have. I feel having a game to adjust the attributes in the code would help all round to show off Python's versatility, while helping people to learn how to program. I am interested to hear what people on this list feel about my idea. As I said, I don't have the knowledge (Yet!) to make the game, but I would like to give it a go one day, or help someone with the design, and/or testing of such a program. I think I'll stop now. :-) Shey -----Original Message----- From: Rob [mailto:rob@uselesspython.com] Sent: 02 August 2002 04:23 To: 'Tutor@Python. Org' Subject: RE: [Tutor] Python information OOP does seem to be an interesting situation. We think in objects all day long, and yet when it comes time to program along the same lines, struggle seems common. Perhaps we should put our collective heads together and create a Python equivalent to Robocode, which is designed to teach OOP in Java by having you program battling robot tanks. Let's say you want to write a "Dungeons & Dragons"-type game. You know you'll need it to have certain things (objects). You make a list of some of them: -monsters -dungeons -non-player characters -player characters -weapons -treasure -equipment -etc. Some of these can be lumped into more general categories. For instance, non-player characters and player characters can both fall under the category (class), which can just be called "character". All characters can possess certain characteristics in common, such as: -amount of damage that may be survived -height -weight -name -species -vocation -inventory -etc. The process goes on and on, really. The idea is to think of what kind of objects you will want/need in your program, create classes for these objects, and then create instances of these classes. A class instance can be "Banglor the Elf", a specific instance of class character. Objects have two general things the programmer needs to fuss over: attributes and behavior. Attributes can be the character's name, hair color, fondness for dirty poetry, etc. and behaviors can be throwing spears, running, singing, sleeping, and stopping going forward when bumping into walls. Does any of this sort of discussion help at all? Rob (who should really be studying for tomorrow's C++ final ;-) http://uselesspython.com From ajs@ix.netcom.com Thu Aug 1 13:22:46 2002 From: ajs@ix.netcom.com (Arthur) Date: Thu, 1 Aug 2002 08:22:46 -0400 Subject: [Tutor] Use? Abuse? Amusement? Amendments? References: <3D485C3F.3060304@aon.at> Message-ID: <006201c23a0b$478401c0$9865fea9@arthur> > Your opinion? Very cool! Especially for someone like myself who would like to be getting a handle on generators. Not just the how, but the why and when. The only amendment I would like to see is tutorial type annotations. Recursive generators is a bit more than I seem to be able to fully follow without some help. Is this a good candidate for Useless Python? Art From rob@uselesspython.com Fri Aug 2 14:01:53 2002 From: rob@uselesspython.com (Rob) Date: Fri, 2 Aug 2002 08:01:53 -0500 Subject: [Tutor] Use? Abuse? Amusement? Amendments? In-Reply-To: <006201c23a0b$478401c0$9865fea9@arthur> Message-ID: I think it's a *great* candidate for Useless Python. Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > Arthur > Sent: Thursday, August 01, 2002 7:23 AM > To: Gregor Lingl; tutor@python.org > Cc: edu-sig@python.org > Subject: Re: [Tutor] Use? Abuse? Amusement? Amendments? > > > > Your opinion? > > Very cool! Especially for someone like myself who > would like to be getting a handle on generators. > > Not just the how, but the why and when. > > The only amendment I would like to see is tutorial > type annotations. Recursive generators is a bit > more than I seem to be able to fully follow without > some help. > > Is this a good candidate for Useless Python? > > Art > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From rob@uselesspython.com Fri Aug 2 14:05:47 2002 From: rob@uselesspython.com (Rob) Date: Fri, 2 Aug 2002 08:05:47 -0500 Subject: [Tutor] Python information In-Reply-To: <415C917D807AD411B72C00805FF7330B038362FD@MAILSRV> Message-ID: I have been thinking of doing something like this. However, my current skill level would only enable me to be a part of a development team on such a project. I also think that embedding a python/jython interpreter in a training game would give this project an edge unmatched by anything else I've seen out there. Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > shey crompton > Sent: Friday, August 02, 2002 3:31 AM > To: 'tutor@python.org' > Subject: RE: [Tutor] Python information > > > Hi Rob et al, > A python Robocode game sounds like a great idea for a newbie like > me. I wish > I had the knowhow to write a game like that as it would probably be quite > beneficial to complete newbies, and programmers checking out Python. > One initial idea would be to have a tutorial that takes you through each > part of the robot code. For example, changing the hit points on > the enemies > (newbie), adding a bigger weapon with graphics etc to your own robot > (intermediate), and rewriting the AI for the enemies (expert). > I am currently going through Alan Gauld's book and How to Think Like a > Computer Scientist. I am setting myself little goals and trying > to find out > how to achieve them with the knowledge I have. I feel having a game to > adjust the attributes in the code would help all round to show > off Python's > versatility, while helping people to learn how to program. > I am interested to hear what people on this list feel about my idea. As I > said, I don't have the knowledge (Yet!) to make the game, but I would like > to give it a go one day, or help someone with the design, and/or > testing of > such a program. > > I think I'll stop now. :-) > > Shey > > -----Original Message----- > From: Rob [mailto:rob@uselesspython.com] > Sent: 02 August 2002 04:23 > To: 'Tutor@Python. Org' > Subject: RE: [Tutor] Python information > > OOP does seem to be an interesting situation. We think in objects all day > long, and yet when it comes time to program along the same lines, struggle > seems common. > > Perhaps we should put our collective heads together and create a Python > equivalent to Robocode, which is designed to teach OOP in Java by > having you > program battling robot tanks. > > Let's say you want to write a "Dungeons & Dragons"-type game. You know > you'll need it to have certain things (objects). You make a list > of some of > them: > > -monsters > -dungeons > -non-player characters > -player characters > -weapons > -treasure > -equipment > -etc. > > Some of these can be lumped into more general categories. For instance, > non-player characters and player characters can both fall under > the category > (class), which can just be called "character". All characters can possess > certain characteristics in common, such as: > > -amount of damage that may be survived > -height > -weight > -name > -species > -vocation > -inventory > -etc. > > The process goes on and on, really. The idea is to think of what kind of > objects you will want/need in your program, create classes for these > objects, and then create instances of these classes. A class > instance can be > "Banglor the Elf", a specific instance of class character. > > Objects have two general things the programmer needs to fuss over: > attributes and behavior. Attributes can be the character's name, > hair color, > fondness for dirty poetry, etc. and behaviors can be throwing spears, > running, singing, sleeping, and stopping going forward when bumping into > walls. > > Does any of this sort of discussion help at all? > > Rob (who should really be studying for tomorrow's C++ final ;-) > http://uselesspython.com > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From shey@argonaut.com Fri Aug 2 14:41:03 2002 From: shey@argonaut.com (shey crompton) Date: Fri, 2 Aug 2002 14:41:03 +0100 Subject: [Tutor] Python information Message-ID: <415C917D807AD411B72C00805FF7330B03836305@MAILSRV> Would you even need to do that though? Using IDLE (sorry I don't know much about Unix/Linux), could be part of the tutorial (uber-newbies). Having had a bit of time to think about it, I'm not sure of how you could combine all skill levels of programming into a game where you program yourself, and your enemies; short of choosing your level of programming skills first. I think this is one for your uselesspython challenges, Rob. :-) Thanks, Shey -----Original Message----- From: Rob [mailto:rob@uselesspython.com] Sent: 02 August 2002 14:06 To: 'Tutor@Python. Org' Subject: RE: [Tutor] Python information I have been thinking of doing something like this. However, my current skill level would only enable me to be a part of a development team on such a project. I also think that embedding a python/jython interpreter in a training game would give this project an edge unmatched by anything else I've seen out there. Rob http://uselesspython.com From lumbricus@gmx.net Fri Aug 2 14:57:30 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Fri, 2 Aug 2002 15:57:30 +0200 (MEST) Subject: [Tutor] directory size References: <3D4A3B92.4EB1A4EE@ewt.de> Message-ID: <11573.1028296650@www55.gmx.net> > How can i determine the size of a directory? > In Linux there is a command like " du -hc ." . > Is there a similar way in python. $ man stat $ python [ snip ] >>> import os >>> print os.stat.__doc__ > Thanks HTH,HAND J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From rob@uselesspython.com Fri Aug 2 15:00:24 2002 From: rob@uselesspython.com (Rob) Date: Fri, 2 Aug 2002 09:00:24 -0500 Subject: [Tutor] Python information In-Reply-To: <415C917D807AD411B72C00805FF7330B03836305@MAILSRV> Message-ID: Actually, the way I think of programming, each object is the master of its own existence in a way. Let's say you're programming your robot dinosaur to trash the GauldBot and the YooMinator. You don't need to worry about programming a way to affect their hit points. Each bot is programmed such that if XYZ damage happens to it, a certain toll is taken on its systems (such as a hit point drop, although we could make it more interesting, like if your targeting array is hit you can't target). The code for each object is only concerned with the operations of that object, not with the operations of other objects. For instance, the cannonball object isn't worried about the implementations of the objects firing it or that it's being fired at. But if you want to fire one, you program your bot to fire a cannonball, etc. This is some of the simple beauty of object-oriented programming (OOP). Rob > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > shey crompton > Sent: Friday, August 02, 2002 8:41 AM > To: 'tutor@python.org' > Subject: RE: [Tutor] Python information > > > > > Would you even need to do that though? Using IDLE (sorry I don't know much > about Unix/Linux), could be part of the tutorial (uber-newbies). > Having had a bit of time to think about it, I'm not sure of how you could > combine all skill levels of programming into a game where you program > yourself, and your enemies; short of choosing your level of programming > skills first. > > I think this is one for your uselesspython challenges, Rob. :-) > > Thanks, > > Shey > > > -----Original Message----- > From: Rob [mailto:rob@uselesspython.com] > Sent: 02 August 2002 14:06 > To: 'Tutor@Python. Org' > Subject: RE: [Tutor] Python information > > I have been thinking of doing something like this. However, my > current skill > level would only enable me to be a part of a development team on such a > project. > > I also think that embedding a python/jython interpreter in a training game > would give this project an edge unmatched by anything else I've seen out > there. > > Rob > http://uselesspython.com > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From alan.gauld@bt.com Fri Aug 2 15:02:46 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 2 Aug 2002 15:02:46 +0100 Subject: [Tutor] Skipping elements from inside generator loops Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB2165C722E@mbtlipnt02.btlabs.bt.co.uk> > ... I find that you can not do this with "normal" for loops: > > =============================== > for a in range(len(procession)): > if procession[a] == 'ALARM!': > a = a+1 > else: > print procession[a] > =============================== This has nothing to do with the processing of the list, just how the value of a is assigned. for a in range(len...) creates a line like: for a in [0,1,2,3,...,] your a = a+1 changes a inside the loop but when it comes round to the beginning a is set to the next value in the list regardless of what you have set it to. Instead try deleting the a+1 element from the list, that will be closer. The only snag there is that you will now run off the end of the list because it doesn't correspond to the original length! Bad idea. Alternative technique is to use a while loop and manually maintain the list length. generators etc provide a nicer way of dealing with these kinds of issue. Alan G From alan.gauld@bt.com Fri Aug 2 15:02:47 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 2 Aug 2002 15:02:47 +0100 Subject: [Tutor] Meeester bell. Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB2165C722F@mbtlipnt02.btlabs.bt.co.uk> > I have been looking through the modules for a text-mode bell > that will work in windows (i.e. not in curses or Tkinter). printing the standard ASCII BEL character (ESC G I think) should do it. > I am postitive I have seen this beastie somewhere... Any clues? Alternatively there is a beep() function that works slightly differently on NT and Win9x. On one you can control frequency and duration on the other you can't... I don't recall which OS does which. Alan g From alan.gauld@bt.com Fri Aug 2 15:02:44 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 2 Aug 2002 15:02:44 +0100 Subject: [Tutor] listdir, ispath and unicode (followup question) Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB2165C722D@mbtlipnt02.btlabs.bt.co.uk> > >>> filename = os.path.join(os.getcwd(), os.listdir(os.getcwd())[0]) > >>> filename > 'd:\\tmp2\\???????' > >>> os.path.isfile(filename) > 0 > The file, 'd:\\tmp2\\???????', is a text file which I created for > testing this problem. Hmm, I'm surprised you could create that. The '?' character is a wildcard character in DOS so that you can, for example, specify: foo??.doc In explorer and get a list of all the .doc files starting with foo then 2 characters. eg foo01.doc, foo02.doc etc So a file ??????? will match any file that has exactly 7 characters in its name and no extension. What happens when you create a file called "???????" I have no idea! Its probably a bad policy IMHO Alan G. From max_ig@yahoo.com Fri Aug 2 16:02:06 2002 From: max_ig@yahoo.com (MIG) Date: Fri, 2 Aug 2002 08:02:06 -0700 (PDT) Subject: Fwd: RE: [Tutor] Meeester bell. Message-ID: <20020802150206.50220.qmail@web11305.mail.yahoo.com> How can I do a beep in a Tkinter + Windows 98/linux environment? Max --- alan.gauld@bt.com wrote: > From: alan.gauld@bt.com > To: Doug.Shawhan@gecits.ge.com, tutor@python.org > Subject: RE: [Tutor] Meeester bell. > Date: Fri, 2 Aug 2002 15:02:47 +0100 > > > I have been looking through the modules for a text-mode bell > > that will work in windows (i.e. not in curses or Tkinter). > > printing the standard ASCII BEL character (ESC G I think) > should do it. > > > I am postitive I have seen this beastie somewhere... Any clues? > > Alternatively there is a beep() function that works slightly > differently on NT and Win9x. On one you can control frequency > and duration on the other you can't... I don't recall which > OS does which. > > Alan g > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From alan.gauld@bt.com Fri Aug 2 15:47:10 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 2 Aug 2002 15:47:10 +0100 Subject: [Tutor] Python information Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7CD@mbtlipnt02.btlabs.bt.co.uk> > >>> Isaac Hall 07/30/02 12:48PM >>> > The things that I would have really appreciated > at that time which I found difficult to find were > general OOP 'good > behaviours'. > > I agree with Isaac on this one. I am having a hard time > grasping the object oriented "mindset", or what have you. OOP seems to be one of those things that people either "get" straight away or struggle with for ages. I was in the latter camp when I first encountered OOP back about 1985 or so. I read several articles, books and newsgroups covering OOP in C++, Lisp, Smalltalk and Objective C before it started to gel. I'd say it took me about 4-6 months of fairly intensive work. However it's not a Python issue, the same happens in any OO language. The good news is that there is a huge array of learning tools nowadays both in dead tree form as well as online. Try http://www.cetus-links.org for links to every level and type of OO resource imaginable... Alan G. From yduppen@xs4all.nl Fri Aug 2 16:33:58 2002 From: yduppen@xs4all.nl (Yigal Duppen) Date: Fri, 2 Aug 2002 17:33:58 +0200 Subject: [Tutor] Python information In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7CD@mbtlipnt02.btlabs.bt.co.uk> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7CD@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <200208021733.58922.yduppen@xs4all.nl> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > OOP seems to be one of those things that people > either "get" straight away or struggle with for ages. Speaking from personal experience, I suspect that it depends on previous programming exposure. My first encounter with objects was in the days of Turbo Pascal 5.5; I never got it. Then I learned about Abstract Data Types at university, and it slowly dawned - -- but I still didn't "get" it completely. It took a full year of Java exposure and an experienced colleague to finally see the impact of OO. And once I understood it in Java, OO in SmallTalk, Python, Object Pascal... all made sense _automatically_. Only Perl OO remains a mystery :-) But getting back to my original point: I suspect that once you have been contaminated by purely procedural programming, it takes a lot of mind bending to understand OO in its entirety. YDD - -- http://www.xs4all.nl/~yduppen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9SqZmLsKMuCf5EdwRAujLAKCkuSKdbjtQmZjrnREXYL1RTn4rQACfTmKs ljacoy6gJmDLtsFGc3VXRvw= =yJsL -----END PGP SIGNATURE----- From einarth@decode.is Fri Aug 2 16:57:11 2002 From: einarth@decode.is (Einar Th. Einarsson) Date: Fri, 2 Aug 2002 15:57:11 +0000 Subject: [Tutor] platform info Message-ID: <200208021557.12899.einarth@decode.is> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hey gang. In my ongoing quest to write truly portable and dynamic code, I need my=20 application to be able to gather the following system information at runtim= e: CPU info: o - number of cpu's o - cpu load (per cpu in case of smp systems) o - cpu speed and type Memory: o - total RAM o - total swap space o - free ram o - free swap Disk: o - list of partitions/filesystems=20 o - must distinguish between local and networked filesystems o - Free space per partition Information as to how to retrieve any of the above without directly using=20 system specific function or system calls would be greatly appreciated.=20 In case anyone needs som background info, my application is a slave daemon = for=20 an asynchronious clustering system which I originally wrote in perl & C, bu= t=20 has proved to be a porting nightmare (it must run on Linux and win2k+, and = preferably *bsd, and mac osX...) - --=20 E-mail returned to sender -- insufficient voltage. Yours etc. Einar Th. -----BEGIN PGP SIGNATURE----- Version: PGP 6.5.8 iQA/AwUBPUqr121/ORZtyd/tEQIB+wCgikWKSb+ulQ9zQcakQ8AxYRiPJ3YAnjuZ zOu2JU5+qJUNLVUEBIg8b7yY =3D+LCj -----END PGP SIGNATURE----- From jeff@ccvcorp.com Fri Aug 2 17:12:50 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Fri, 02 Aug 2002 09:12:50 -0700 Subject: [Tutor] listdir, ispath and unicode (followup question) References: <5104D4DBC598D211B5FE0000F8FE7EB2165C722D@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <3D4AAF81.F03F9D5C@ccvcorp.com> alan.gauld@bt.com wrote: > > The file, 'd:\\tmp2\\???????', is a text file which I created for > > testing this problem. > > Hmm, I'm surprised you could create that. > The '?' character is a wildcard character in DOS so > that you can, for example, specify: Actually, this was supposed to have been a file with Unicode (Cyrillic) characters in the filename, which are rendered as '?' but are not the actual ascii-question-mark character. Jeff Shannon Technician/Programmer Credit International From abli@freemail.hu Fri Aug 2 17:22:40 2002 From: abli@freemail.hu (Abel Daniel) Date: Fri, 2 Aug 2002 18:22:40 +0200 Subject: Fwd: RE: [Tutor] Meeester bell. In-Reply-To: <20020802150206.50220.qmail@web11305.mail.yahoo.com> References: <20020802150206.50220.qmail@web11305.mail.yahoo.com> Message-ID: <20020802162240.GB1462@hooloovoo> MIG (max_ig@yahoo.com) wrote: > > How can I do a beep in a Tkinter + Windows 98/linux environment? > > Max > From the docs: The winsound module provides access to the basic sound-playing machinery provided by Windows platforms. It includes two functions and several constants. Beep(frequency, duration) Beep the PC's speaker. abli abli@freemail.hu From gp@pooryorick.com Fri Aug 2 17:44:03 2002 From: gp@pooryorick.com (Poor Yorick) Date: Fri, 02 Aug 2002 10:44:03 -0600 Subject: [Tutor] listdir, ispath and unicode (followup question) References: <5104D4DBC598D211B5FE0000F8FE7EB2165C722D@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <3D4AB6D3.1070809@pooryorick.com> I created the files using the Windows 2000 file manager, explorer.exe, not in the dos window. As Danny Yoo pointed out, the issue is probably that Python 2.2 translates unicode to 'mbcs' (whatever that is): http://www.python.org/peps/pep-0277.html I havne't yet tried the experimental implementation, but my Windows 2000 setup, English locale, additional keyboards and IME's, matches the conditions specified in pep-0277. Thank you for your responses. Poor Yorick alan.gauld@bt.com wrote: >> >>> filename = os.path.join(os.getcwd(), os.listdir(os.getcwd())[0]) >> >>> filename >>'d:\\tmp2\\???????' >> >>> os.path.isfile(filename) >>0 >> > >>The file, 'd:\\tmp2\\???????', is a text file which I created for >>testing this problem. >> > >Hmm, I'm surprised you could create that. >The '?' character is a wildcard character in DOS so >that you can, for example, specify: > >foo??.doc > >In explorer and get a list of all the .doc files starting >with foo then 2 characters. eg foo01.doc, foo02.doc etc > >So a file ??????? will match any file that has exactly >7 characters in its name and no extension. > >What happens when you create a file called "???????" I >have no idea! Its probably a bad policy IMHO > >Alan G. > >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > > From WILLIAM.GRIFFIN@asu.edu Fri Aug 2 17:52:28 2002 From: WILLIAM.GRIFFIN@asu.edu (William Griffin) Date: Fri, 02 Aug 2002 09:52:28 -0700 Subject: [Tutor] Python information Message-ID: This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --Boundary_(ID_HPDIycDfCuX9BiByMooKLQ) Content-type: multipart/alternative; boundary="Boundary_(ID_YVe2VmL/oLoD8N3w+7F78g)" --Boundary_(ID_YVe2VmL/oLoD8N3w+7F78g) Content-type: text/plain; charset="iso-8859-1" Like the responders on this thread, I had a difficult time grasping OOP and faced with the task of trying to write a simulation of children playing and forming small groups, I looked at as many existing simulation programs and games as I could find. Fortunately, I found several that helped: http://sourceforge.net/projects/probot/ and http://www.pythonpros.com/gstein/war/ and http://www.liacs.nl/~jjacob/ and finally, monsters.py (I forgot how I got it or who the author is, but it is very good start); it is attached. As Alan mentioned in another post, either you get it or it is a slow process; I've found myself in the slow process group although I've been able to build the simulation -- but its not pretty. Anyway, there is some code in these modules that should provide a basis for building a newbie game. bill -----Original Message----- From: Rob [mailto:rob@uselesspython.com] Sent: Friday, August 02, 2002 6:06 AM To: 'Tutor@Python. Org' Subject: RE: [Tutor] Python information I have been thinking of doing something like this. However, my current skill level would only enable me to be a part of a development team on such a project. I also think that embedding a python/jython interpreter in a training game would give this project an edge unmatched by anything else I've seen out there. Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > shey crompton > Sent: Friday, August 02, 2002 3:31 AM > To: 'tutor@python.org' > Subject: RE: [Tutor] Python information > > > Hi Rob et al, > A python Robocode game sounds like a great idea for a newbie like > me. I wish > I had the knowhow to write a game like that as it would probably be quite > beneficial to complete newbies, and programmers checking out Python. > One initial idea would be to have a tutorial that takes you through each > part of the robot code. For example, changing the hit points on > the enemies > (newbie), adding a bigger weapon with graphics etc to your own robot > (intermediate), and rewriting the AI for the enemies (expert). > I am currently going through Alan Gauld's book and How to Think Like a > Computer Scientist. I am setting myself little goals and trying > to find out > how to achieve them with the knowledge I have. I feel having a game to > adjust the attributes in the code would help all round to show > off Python's > versatility, while helping people to learn how to program. > I am interested to hear what people on this list feel about my idea. As I > said, I don't have the knowledge (Yet!) to make the game, but I would like > to give it a go one day, or help someone with the design, and/or > testing of > such a program. > > I think I'll stop now. :-) > > Shey > > -----Original Message----- > From: Rob [mailto:rob@uselesspython.com] > Sent: 02 August 2002 04:23 > To: 'Tutor@Python. Org' > Subject: RE: [Tutor] Python information > > OOP does seem to be an interesting situation. We think in objects all day > long, and yet when it comes time to program along the same lines, struggle > seems common. > > Perhaps we should put our collective heads together and create a Python > equivalent to Robocode, which is designed to teach OOP in Java by > having you > program battling robot tanks. > > Let's say you want to write a "Dungeons & Dragons"-type game. You know > you'll need it to have certain things (objects). You make a list > of some of > them: > > -monsters > -dungeons > -non-player characters > -player characters > -weapons > -treasure > -equipment > -etc. > > Some of these can be lumped into more general categories. For instance, > non-player characters and player characters can both fall under > the category > (class), which can just be called "character". All characters can possess > certain characteristics in common, such as: > > -amount of damage that may be survived > -height > -weight > -name > -species > -vocation > -inventory > -etc. > > The process goes on and on, really. The idea is to think of what kind of > objects you will want/need in your program, create classes for these > objects, and then create instances of these classes. A class > instance can be > "Banglor the Elf", a specific instance of class character. > > Objects have two general things the programmer needs to fuss over: > attributes and behavior. Attributes can be the character's name, > hair color, > fondness for dirty poetry, etc. and behaviors can be throwing spears, > running, singing, sleeping, and stopping going forward when bumping into > walls. > > Does any of this sort of discussion help at all? > > Rob (who should really be studying for tomorrow's C++ final ;-) > http://uselesspython.com > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor --Boundary_(ID_YVe2VmL/oLoD8N3w+7F78g) Content-type: text/html; charset="iso-8859-1" Content-transfer-encoding: quoted-printable RE: [Tutor] Python information

Like the responders on this thread, I had a difficult = time grasping OOP and faced with the task of trying to write a = simulation of children playing and forming small groups, I looked at as = many existing simulation programs and games as I could find.  = Fortunately, I found several that helped:

http://sourceforge.net/projects/probot/

and

http://www.pythonpros.com/gstein/war/

and

http://www.liacs.nl/~jjacob/

and finally, monsters.py (I forgot how I got it or = who the author is, but it is very good start); it is attached.

As Alan mentioned in another post, either you get it = or it is a slow process; I've found myself in the slow process group = although I've been able to build the simulation -- but its not = pretty.

Anyway, there is some code in these modules that = should provide a basis for building a newbie game.

bill



-----Original Message-----
From: Rob [mailto:rob@uselesspython.com]<= /FONT>
Sent: Friday, August 02, 2002 6:06 AM
To: 'Tutor@Python. Org'
Subject: RE: [Tutor] Python information


I have been thinking of doing something like this. = However, my current skill
level would only enable me to be a part of a = development team on such a
project.

I also think that embedding a python/jython = interpreter in a training game
would give this project an edge unmatched by = anything else I've seen out
there.

Rob
http://uselesspython.com

> -----Original Message-----
> From: tutor-admin@python.org [mailto:tutor-admin@python.org= ]On Behalf Of
> shey crompton
> Sent: Friday, August 02, 2002 3:31 AM
> To: 'tutor@python.org'
> Subject: RE: [Tutor] Python information
>
>
> Hi Rob et al,
> A python Robocode game sounds like a great idea = for a newbie like
> me. I wish
> I had the knowhow to write a game like that as = it would probably be quite
> beneficial to complete newbies, and programmers = checking out Python.
> One initial idea would be to have a tutorial = that takes you through each
> part of the robot code. For example, changing = the hit points on
> the enemies
> (newbie), adding a bigger weapon with graphics = etc to your own robot
> (intermediate), and rewriting the AI for the = enemies (expert).
> I am currently going through Alan Gauld's book = and How to Think Like a
> Computer Scientist. I am setting myself little = goals and trying
> to find out
> how to achieve them with the knowledge I have. = I feel having a game to
> adjust the attributes in the code would help = all round to show
> off Python's
> versatility, while helping people to learn how = to program.
> I am interested to hear what people on this = list feel about my idea. As I
> said, I don't have the knowledge (Yet!) to make = the game, but I would like
> to give it a go one day, or help someone with = the design, and/or
> testing of
> such a program.
>
> I think I'll stop now. :-)
>
> Shey
>
>  -----Original Message-----
> From: =         Rob [mailto:rob@uselesspython.com]<= /FONT>
> Sent: 02 August 2002 04:23
> To:   'Tutor@Python. Org'
> Subject:      RE: = [Tutor] Python information
>
> OOP does seem to be an interesting situation. = We think in objects all day
> long, and yet when it comes time to program = along the same lines, struggle
> seems common.
>
> Perhaps we should put our collective heads = together and create a Python
> equivalent to Robocode, which is designed to = teach OOP in Java by
> having you
> program battling robot tanks.
>
> Let's say you want to write a "Dungeons = & Dragons"-type game. You know
> you'll need it to have certain things = (objects). You make a list
> of some of
> them:
>
> -monsters
> -dungeons
> -non-player characters
> -player characters
> -weapons
> -treasure
> -equipment
> -etc.
>
> Some of these can be lumped into more general = categories. For instance,
> non-player characters and player characters can = both fall under
> the category
> (class), which can just be called = "character". All characters can possess
> certain characteristics in common, such = as:
>
> -amount of damage that may be survived
> -height
> -weight
> -name
> -species
> -vocation
> -inventory
> -etc.
>
> The process goes on and on, really. The idea is = to think of what kind of
> objects you will want/need in your program, = create classes for these
> objects, and then create instances of these = classes. A class
> instance can be
> "Banglor the Elf", a specific = instance of class character.
>
> Objects have two general things the programmer = needs to fuss over:
> attributes and behavior. Attributes can be the = character's name,
> hair color,
> fondness for dirty poetry, etc. and behaviors = can be throwing spears,
> running, singing, sleeping, and stopping going = forward when bumping into
> walls.
>
> Does any of this sort of discussion help at = all?
>
> Rob (who should really be studying for = tomorrow's C++ final ;-)
> http://uselesspython.com
>
>
>
> = _______________________________________________
> Tutor maillist  -  = Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>



_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

  = --Boundary_(ID_YVe2VmL/oLoD8N3w+7F78g)-- --Boundary_(ID_HPDIycDfCuX9BiByMooKLQ) Content-type: application/octet-stream; name=monsters.py Content-transfer-encoding: QUOTED-PRINTABLE Content-disposition: attachment; filename=monsters.py """This prototype shows how different monsters are driven by their ne= eds=0A(hunger, tiredness, aggression, some special needs).=0A=0AThe a= ctions are still dummies (just printing to the screen what the=0Amons= ter is supposed to do), but one can see patterns emerge: sleep,=0Aeat= , fight, eat, smoke cigar, sleep, ...=0A=0AThese patterns are differe= nt for each kind of monster. Some are=0Amore aggressive than others, = some need less sleep, etc. Each monster=0Aalso has different prioriti= es: some prefer food over fighting, others=0Alove their cigars, and s= o on. These priorities are used when there are=0Aseveral needs of the= same level.=0A=0ASome questions have already been answered - e.g. ho= w to prevent that=0Amonsters eat all fortune cookies :-)=0A=0AOther q= uestions remain: Will the players appreciate the interesting=0Abehavi= our of the monsters? How do we balance the game (cheating might=0Abe = a solution - if too many monsters have been eaten, there just=0Aappea= r new ones...)=0A=0AI think it's easier to answer these questions whe= n the framework has=0Abeen integrated into the game. """=0A=0Aimport = time=0Aimport string=0A=0Aclass Monster:=0A """ a monster which ca= n act according to his internal state and=0A external =0A f= actors"""=0A=0A def __init__(self):=0A """init state, rules= and needs"""=0A self.rules =3D []=0A for element in se= lf.behaviour:=0A self.rules =3D self.rules + self._make_ru= les(element[0],=0A element[1])=0A self.needs =3D Ne= eds(self.rules, self.state, self.order)=0A self.act_dict =3D {= 'hungry': self.eat_food, 'tired':=0A self.fall_asleep,=0A = 'aggressive': self.attack_enemy}=0A=0A def _ma= ke_rules(self, type, borders):=0A """ defines rules for each i= nterval in borders"""=0A rules =3D []=0A for idx in ran= ge(5):=0A rules.append(Rule(type, Condition(borders[idx],= =0A borders[idx+1], idx+1)))=0A return rules=0A= =0A def act(self, ext_factors =3D []): =0A """act according= to needs and (not yet) external factors"""=0A self.needs.upda= te(self.state, ext_factors) # max_need =3D =0A self.needs.get_= max()=0D=0A action =3D self.act_dict[max_need[0]]=0A ac= tion()=0A=0A def eat_food(self):=0A """ when hungry, eat so= me food=0A just a dummy right now - later on, the characte= r=0A should actively try to find something to eat."""=0A = print "\teating some food\t(+)\t",self.needs=0A self.sta= te.change(hungry=3D0)=0A self.state.increase("tired", 5)=0A = self.state.increase("aggressive", 5)=0A=0A def fall_asleep(se= lf):=0A """ also just a dummy. sleeping characters=0A = still have to be able to react when something=0A starts= to attack - maybe with a little delay"""=0A print "\tfalling = asleep\t\t(-)\t",self.needs=0A self.state.change(tired=3D0)= =0A self.state.increase("hungry", 10)=0A self.state.inc= rease("aggressive", 1)=0A=0A def attack_enemy(self):=0A """= JAT - just another dummy. =0A remark: fighting makes hung= ry!"""=0A print "\tattacking someone\t(@)\t",self.needs=0A = self.state.change(aggressive=3D0)=0A self.state.increase("= hungry", 10)=0A=0A=0Aclass State:=0A """ the current state of the = character. up to now only=0A three parameters: level of hunger= , tiredness and=0A aggressiveness other parameters should defi= nitely be added,=0A e.g. fear, needs to communicate etc."""= =0A=0A def __init__(self, **state):=0A """ init state to so= me values=0A this should be overridden by each monster, ac= cording=0A to its characteristics"""=0A self.state = =3D state=0A=0A def __repr__(self):=0A res =3D ""=0A = for element in self.state.keys():=0A res =3D res + elemen= t + ": " + str(self.state[element]) +"\n"=0A return res=0A= =0A def change(self, **new_state):=0A """ changes all param= eters in the dictionary new_state=0A to their correspondin= g values"""=0A for key in new_state.keys():=0A self= .state[key] =3D new_state[key]=0A=0A def increase(self, parameter,= val):=0A """increases the parameter by val"""=0A self.= state[parameter] =3D self.state[parameter] + val=0A=0Aclass Condition= :=0A def __init__(self, min, max, res):=0A self.min, self.m= ax, self.res =3D min, max, res=0A=0A def __repr__(self):=0A = res =3D "\tIf " + str(self.min) + " <=3D value and value < "=0A = res =3D res + str(self.max) + " return " + str(self.res) + "\n"= =0A return res=0A=0A def eval(self, val):=0A if self= .min <=3D val and val < self.max:=0A return self.res=0A = else:=0A return 0=0A=0Aclass Rule:=0A """ a rule d= escribing the connection between state and need=0A eg. some ch= aracters have to eat quite often=0A self.about: 'hungr= y', =0A self.cond: is 15<=3Dx<20? =0A = yes =3D=3D> return 4 (_very_ hungry)=0A other charac= ters do not have to eat often=0A self.about: 'hungry',= =0A self.cond: is 15<=3Dx<20? =0A = yes =3D=3D> return 2 (not so bad)"""=0A=0A def __init__(sel= f, about, cond):=0A self.about =3D about=0A self.cond = =3D cond=0A=0A def __repr__(self):=0A res =3D ""=0A = res =3D res + "Rule for " + self.about + ":\n"=0A res =3D res = + self.cond.__repr__()=0A return res=0A=0A def eval(self, s= tate):=0A """ check whether condition is fullfilled in state= =0A if yes, return val, otherwise 0"""=0A return se= lf.cond.eval(state.state[self.about])=0A=0Aclass Needs:=0A """ the= current needs of the character=0A every need can range betwee= n a value from 0 to 5, where=0A 5 is the strongest need (chara= cter collapses when his=0A hunger reaches level 5 - he goes be= rserk with aggressiveness=0A level 5, etc."""=0A=0A def __i= nit__(self, rules, state, order):=0A self.needs =3D {}=0A = self.rules =3D rules=0A self.order =3D order # defines a= n order between the needs=0A self.update(state, [])=0A=0A d= ef __repr__(self):=0A res =3D ""=0A for need in self.or= der:=0A res =3D res + need[0] + "-" + str(self.needs[need]= ) + "; "=0A return "(" + res[:-2]+")"=0A=0A def update(self= , state, ext_factors=3D[]):=0A """ update needs according to s= tate and (not yet) external=0A factors - use rules for upd= ate"""=0A for rule in self.rules:=0A v =3D rule.eva= l(state)=0A if v:=0A self.needs[rule.about]= =3D v=0A self.check_alive()=0A=0A def get_max(self):=0A = """return most urgent need"""=0A max =3D (None, 0)=0A = for need in self.order:=0A val =3D self.needs[need]= =0A if val>max[1]:=0A max =3D (need, val)= =0A return max=0A=0A def check_alive(self):=0A """ c= heck, whether no need exceeds the maximum (4).=0A characte= r can die from hunger, no sleep, =0A heart attack, etc."""= =0A for need in self.needs.keys():=0A if self.needs= [need] > 4:=0A raise "Died! ", need + " exceeds maximu= m"=0A=0Aclass Bobbit(Monster):=0A """a peaceful monster - its main= objectives are its belly=0A and its cigars"""=0A def __ini= t__(self):=0A self.type=3D"Bobbit"=0A self.order =3D ["= hungry", "smoke", "tired", "aggressive"]=0A self.state =3D Sta= te(hungry=3D0, tired=3D0, aggressive=3D10, smoke=3D5)=0A self.= behaviour =3D [('hungry', [0, 5, 10, 15, 20, 50]), =0A ('tir= ed', [0, 8, 16, 24, 32, 50]),=0A ('aggressive', [0, 30, 35, = 40, 45, 50]),=0A ('smoke', [0, 10, 15, 20, 40, 50])]=0A = Monster.__init__(self)=0A self.act_dict =3D {'hungry': self= .eat_food, =0A 'tired': self.fall_asleep,= =0A 'aggressive': self.attack_enemy, =0A = 'smoke': self.smoke}=0A=0A def eat_food(self):= =0A Monster.eat_food(self)=0A self.state.increase("smok= e", 10)=0A=0A def smoke(self):=0A print "\tsmoking some cig= ar\t(!)\t",self.needs=0A self.state.change(smoke=3D0)=0A=0A= =0Aclass Spider(Monster):=0A """a very aggressive type. needs almo= st no sleep, weaves=0A webs sometimes"""=0A def __init__(se= lf):=0A self.type=3D"Giant Spider"=0A self.order =3D ["= aggressive", "hungry", "tired", "web"]=0A self.state =3D State= (hungry=3D10, tired=3D0, aggressive=3D20, web=3D10)=0A self.be= haviour =3D [('hungry', [0, 10, 20, 30, 40, 50]), =0A ('tire= d', [0, 30, 35, 40, 45, 50]),=0A ('web', [0, 15, 22, 29, 36,= 50]),=0A ('aggressive', [0, 5, 12, 18, 25, 50])]=0A = Monster.__init__(self)=0A self.act_dict =3D {'hungry': self.ea= t_food, =0A 'tired': self.fall_asleep,=0A = 'aggressive': self.attack_enemy, =0A = 'web': self.weave_web}=0A=0A def attack_enemy(self):= =0A print "\tattacking someone\t(@)\t",self.needs=0A se= lf.state.increase("aggressive", -8)=0A self.state.increase("hu= ngry", 10)=0A self.state.increase("web", 10)=0A=0A def weav= e_web(self):=0A print "\tweaving some web\t(!)\t",self.needs= =0A self.state.change(web=3D0)=0A self.state.increase("= hungry", 10)=0A=0A=0Aclass Orc(Monster):=0A """straightforward, ve= ry balanced life. could be enhanced by =0A adding the need to = be in a group (no idea how to do =0A this, though...)"""=0A = def __init__(self):=0A self.type=3D"Orc"=0A self.order= =3D ["aggressive", "hungry", "tired"]=0A self.state =3D State= (hungry=3D5, tired=3D0, aggressive=3D15)=0A self.behaviour = =3D [('hungry', [0, 10, 20, 30, 40, 50]), =0A ('tired', [0, = 10, 20, 30, 40, 50]),=0A ('aggressive', [0, 8, 13, 18, 23, 5= 0])]=0A Monster.__init__(self)=0A=0Aclass Hobgoblin(Monster):= =0A """also straightforward, needs less sleep than orc"""=0A de= f __init__(self):=0A self.type=3D"Hobgoblin"=0A self.or= der =3D ["aggressive", "tired", "hungry"]=0A self.state =3D St= ate(hungry=3D30, tired=3D15, aggressive=3D10)=0A self.behaviou= r =3D [('hungry', [0, 10, 20, 30, 40, 50]), =0A ('tired', [0= , 20, 30, 40, 45, 50]),=0A ('aggressive', [0, 15, 20, 25, 30= , 50])]=0A Monster.__init__(self)=0A=0Aclass Nymph(Monster):= =0A """not very agressive, but tries to steal goods"""=0A def _= _init__(self):=0A self.type=3D"Nymph"=0A self.order = =3D ["tired", "greedy", "hungry", "aggressive"]=0A self.state = =3D State(hungry=3D25, tired=3D10, aggressive=3D10,greedy=3D5)=0D= =0A self.behaviour =3D [('hungry', [0, 10, 20, 30, 40,50]), = =0A ('tired', [0, 10, 20, 30, 40, 50]),=0A ('aggres= sive', [0, 20, 25, 33, 40, 50]),=0A ('greedy', [0, 6, 12, 18= , 24, 50])]=0A Monster.__init__(self)=0A self.act_dict = =3D {'hungry': self.eat_food, =0A 'tired': se= lf.fall_asleep,=0A 'aggressive': self.attack_= enemy, =0A 'greedy': self.steal}=0A=0A def= eat_food(self):=0A Monster.eat_food(self)=0A self.stat= e.increase("greedy", 5)=0A=0A def steal(self):=0A print "\t= stealing some money\t(!)\t",self.needs=0A self.state.change(gr= eedy=3D0)=0A=0Adef test():=0A # define order of needs=0A # coul= d be specific for each kind of monster=0A=0A # print introductory = message=0A print "This simulation shows different monsters with di= fferent"=0A print "patterns of behaviour. It follows each monster = on it's "=0A print "way through the dungeon and prints out each ac= tion the "=0A print "monster takes." =0D=0A print "I use three = columns to show an action:"=0D=0A print "\t* The first column show= s the action of the monster"=0D=0A print "\t* The second column sh= ows the symbol for this action."=0D=0A print "\t\tThis makes it ea= sier to recognize patterns."=0A print "\t* The third column shows = how strong the needs of the"=0A print "\t\tmonster thave been _bef= ore_ they chose the action."=0A print "\t\tt stands for tired, h f= or hungry and a for "=0D=0A print "\t\taggressive" =0D=0A print= "Each monster has different priorities. Bobbits are quite "=0D=0A = print "peaceful and need lots of food, while giant spiders"=0D=0A = print "prefer attacking poor victims. Orcs also like to attack,"= =0D=0A print "but they need more food and sleep, and so on."=0D= =0A print raw_input("Press ...")=0A=0A # there we go!= =0A monsters =3D [Bobbit(), Spider(), Orc(), Hobgoblin(), Nymph()]= =0A while 1:=0A idx =3D 1=0A for c in monsters:=0A = print =0A print idx, c.type+":"=0A = print "\t"+c.__doc__=0A idx =3D idx + 1=0A choice = =3D input("Which type of monster would you like to watch?")#-1=0D= =0A num =3D input("Specify the number of turns the monster sho= uld take: ")=0D=0A monster =3D monsters[choice]=0D=0A m= onster.type+":"=0D=0A for i in range(num):=0A monst= er.act()=0A time.sleep(1)=0A choice =3D raw_input("= Would you like to watch another monster \=0A (Y/N>? ")=0D=0A = if string.upper(choice) !=3D "Y":=0A break=0A=0Aif _= _name__ =3D=3D "__main__":=0A test()=0A=0A= --Boundary_(ID_HPDIycDfCuX9BiByMooKLQ)-- From ruger@comnett.net Fri Aug 2 18:43:27 2002 From: ruger@comnett.net (D. Rick Anderson) Date: Fri, 02 Aug 2002 10:43:27 -0700 Subject: [Tutor] tkSimpleDialog Message-ID: <3D4AC4BF.8040001@comnett.net> Hi ppl. I'm new to this list and I'm trying to get the hang of Tkinter. I was determined to figure this one out on my own, but I just can't get it to work. Given the following code: from Tkinter import * import tkSimpleDialog root = Tk() textstring = tkSimpleDialog.askstring('Text', 'Please enter some text', parent=root) root.mainloop() how do I force the keyboard focus to the entry on the dialog box? I've tried all kinds of .focus() variations, but apparently askstring doesn't have a focus / focus_set / focus_force function? TIA Rick From dyoo@hkn.eecs.berkeley.edu Fri Aug 2 21:00:53 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Fri, 2 Aug 2002 13:00:53 -0700 (PDT) Subject: [Tutor] directory size In-Reply-To: <3D4A3B92.4EB1A4EE@ewt.de> Message-ID: On Fri, 2 Aug 2002, Klaus Boehm wrote: > How can i determine the size of a directory? > In Linux there is a command like " du -hc ." . > Is there a similar way in python. So 'du -hc' tries to find the total amount of disk space that a directory and all its subdirectories takes? I'm not sure if this is built-in, but we can talk about how we can write it. That doesn't sound too bad if we define this total_disk_space() function recursively: A directory takes up as much space as that of its regular files, plus that of all its subdirectories. So one way to write a total_disk_space() function could be: ### >>> def disk_usage(directory): ... files, subdirs = get_files(directory), get_subdirs(directory) ... sum = 0 ... for f in files: sum = sum + os.path.getsize(f) ... for s in subdirs: sum = sum + disk_usage(s) ... return sum ... ### (I haven't written get_files() or get_subdirs(), but those shouldn't be too bad. Make sure that both functions return absolute pathnames, just to avoid some silly problems with relative paths.) One major problem with this approach is that we need to be careful about symbolic links: if a symbolic link forms a loop, we may run into problems. When we write get_files() and get_subdirs(), we may want to avoid symbolic links by filtering those symbolic links away with os.path.islink(). Or we can keep track which directories we've dived into already. A variation on this recursive way of finding disk usage can use the os.path.walk() function, which does the tricky recursion stuff for us. If you'd like, we can give an example of how to use it. If you have more questions, please feel free to ask! From troels@kvaksalver.dk Fri Aug 2 21:30:18 2002 From: troels@kvaksalver.dk (Troels Leth Petersen) Date: Fri, 2 Aug 2002 22:30:18 +0200 Subject: [Tutor] directory size References: Message-ID: <012001c23a63$6ae326c0$0a01a8c0@allah> > A variation on this recursive way of finding disk usage can use the > os.path.walk() function, which does the tricky recursion stuff for us. > If you'd like, we can give an example of how to use it. Well - I would like that. If that offer was meant for Klaus only. Regards, Troels From dyoo@hkn.eecs.berkeley.edu Fri Aug 2 22:12:00 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Fri, 2 Aug 2002 14:12:00 -0700 (PDT) Subject: [Tutor] directory size [using os.path.walk] In-Reply-To: <012001c23a63$6ae326c0$0a01a8c0@allah> Message-ID: On Fri, 2 Aug 2002, Troels Leth Petersen wrote: > > A variation on this recursive way of finding disk usage can use the > > os.path.walk() function, which does the tricky recursion stuff for > us. > > If you'd like, we can give an example of how to use it. > > Well - I would like that. If that offer was meant for Klaus only. os.path.walk() is a strange creature compared to the other os.path functions; let's take a look at it more closely. Let's say that we have the following directory structure: ### [dyoo@tesuque dyoo]$ find test_walk test_walk test_walk/subdir1 test_walk/subdir1/dead test_walk/subdir1/people test_walk/subdir2 test_walk/subdir2/.bash_profile test_walk/subdir2/sample_file ### So I have this sample directory called test_walk, which itself has two subdirectories. test_walk/subdir2 contains two files '.bash_profile' and 'sample_file'. 'dead' and 'people' are files within subdir1. os.path.walk() is a slightly strange function because of what it takes in as inputs. If we look at its documentation: ### >>> print os.path.walk.__doc__ walk(top,func,arg) calls func(arg, d, files) for each directory "d" in the tree rooted at "top" (including "top" itself). "files" is a list of all the files and subdirs in directory "d". ### we'll see that it doesn't just take in a directory to dive through, but it also a 'func' function! What this means is that os.path.walk() itself will start calling the function that we give it. What we are doing when we send 'func' to os.path.walk is giving it a 'callback' --- we're trusting that os.path.walk will call 'func' back as it works through the directories. Let's try using it. I'll create a simple function that just prints out the directory and the files arguments that os.path.walk() will feed it, later on: ### >>> def justPrintTheDirectory(arg, d, files): ... print "I'm in directory", d ... print "And I see", files ... >>> os.path.walk('/home/dyoo/test_walk', justPrintTheDirectory, ()) I'm in directory /home/dyoo/test_walk And I see ['subdir1', 'subdir2'] I'm in directory /home/dyoo/test_walk/subdir1 And I see ['dead', 'people'] I'm in directory /home/dyoo/test_walk/subdir2 And I see ['.bash_profile', 'sample_file'] ### Now why in the world does os.path.walk() take in three arguments? In the example above, I just fed the empty tuple in there because I was lazy. Why might we want to use that 'arg' parameter? One reason is because perhaps we might want to accumulate some list or set of values as we run through the directories. For example, we can set 'arg' to a list or other container, and fiddle with it in our function: ### >>> def collect_all_filenames(list_of_filenames, directory, files): ... for f in files: ... list_of_filenames.append(os.path.join(directory, f)) ... >>> files = [] >>> os.path.walk('/home/dyoo/test_walk', collect_all_filenames, files) >>> files ['/home/dyoo/test_walk/subdir1', '/home/dyoo/test_walk/subdir1/dead', '/home/dyoo/test_walk/subdir1/people', '/home/dyoo/test_walk/subdir2', '/home/dyoo/test_walk/subdir2/.bash_profile', '/home/dyoo/test_walk/subdir2/sample_file'] ### So we allow collect_all_filenames() here to incrementally fill in our 'files' list for us. A little tricky, but useful. To tell the truth, I've never liked os.path.walk() --- it doesn't feel Pythonic to me because it is a bit complex to work with. We can talk about how we can wrap this in a class to make it easier to use if you'd like. Hope this helps! From lonetwin Thu Aug 1 10:37:21 2002 From: lonetwin (lonetwin) Date: Thu, 1 Aug 2002 15:07:21 +0530 (IST) Subject: [Tutor] Skipping elements from inside generator loops Message-ID: Hi there, I'm answering this just b'cos I love using list comprehensions .... On Thu, 1 Aug 2002, Scot W. Stevenson wrote: >Hello there, > >So here I am playing around with generators, and just for the heck of it I >see if I can get a for-loop to skip one element from inside the loop. To >my surprise, this works (in Python 2.2): > ...... ...... >procession= ['black cat', > 'white cat', > 'grey cat', > 'ALARM!', > 'the evil dog', > 'fat cat', > 'slow cat'] ...... ...... >[While we're at it: I assume that there is a way to solve the problem with >list comprehensions, but I can't figure it out. Note that looking for the >dog directly is considered cheating: All you get to do is skip one list >entry when somebody sounds the alarm.] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cat_list = [ cat for cat in procession if cat != 'ALARM!' and cat != 'the evil dog' ] for cat in cat_list: print cat ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Note: and for all those ppl who think list comprehensions are hard to read, try imagining a ":" like I've added below, I think that looks more sensible/pythonic. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cat_list = [ cat : for cat in procession if cat != 'ALARM!' and cat != 'the evil dog' ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peace Steve -- This is the tomorrow you worried about yesterday. And now you know why. From dfischer@sedalia.Oilfield.slb.com Thu Aug 1 12:15:06 2002 From: dfischer@sedalia.Oilfield.slb.com (Fischer, Dennis) Date: Thu, 01 Aug 2002 05:15:06 -0600 Subject: [Tutor] Looking for a mentor.. Message-ID: <068201c2394c$b0a9c910$9701b9a3@nam.slb.com> As a total "newbie" I am seeking someone with patience to mentor me through learning Python. I'll will do my best to seek my answers else where, but sometime the questions that I seek are not easy to find. Especially when they are really simple questions. Any one interested please e-mail me dfischer3@slb.com tnks From rob@uselesspython.com Fri Aug 2 22:31:54 2002 From: rob@uselesspython.com (Rob) Date: Fri, 2 Aug 2002 16:31:54 -0500 Subject: [Tutor] Looking for a mentor.. In-Reply-To: <068201c2394c$b0a9c910$9701b9a3@nam.slb.com> Message-ID: Finding a mentor can be great, so best of luck in this pursuit. However, you are certainly welcome to ask questions here on the Tutor list. This is a quite supportive bunch. Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > Fischer, Dennis > Sent: Thursday, August 01, 2002 6:15 AM > To: tutor@python.org > Subject: [Tutor] Looking for a mentor.. > > > As a total "newbie" I am seeking someone with patience to mentor > me through > learning Python. I'll will do my best to seek my answers else where, but > sometime the questions that I seek are not easy to find. Especially when > they are really simple questions. > > Any one interested please e-mail me dfischer3@slb.com > > tnks > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From shalehperry@attbi.com Fri Aug 2 22:32:35 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Fri, 02 Aug 2002 14:32:35 -0700 (PDT) Subject: [Tutor] Looking for a mentor.. In-Reply-To: <068201c2394c$b0a9c910$9701b9a3@nam.slb.com> Message-ID: On 01-Aug-2002 Fischer, Dennis wrote: > As a total "newbie" I am seeking someone with patience to mentor me through > learning Python. I'll will do my best to seek my answers else where, but > sometime the questions that I seek are not easy to find. Especially when > they are really simple questions. > > Any one interested please e-mail me dfischer3@slb.com > many of us have work, school, wives, etc. so committing to one person is hard. However, just ask anything you need here. There are enough smarties around to get the answer to you in a reasonable time frame. From python@experimentzero.org Fri Aug 2 23:02:22 2002 From: python@experimentzero.org (Britt A. Green) Date: Fri, 2 Aug 2002 15:02:22 -0700 Subject: [Tutor] Looking for a mentor.. References: <068201c2394c$b0a9c910$9701b9a3@nam.slb.com> Message-ID: <047501c23a70$48d015e0$5f01000a@opentable.com.ot> There's a Python mentor group that just started. Its hosted by accu.org. Check out this page for more info: http://www.accu.org/mailman/listinfo/python-project Britt -- "My mom says I'm cool." ----- Original Message ----- From: "Fischer, Dennis" To: Sent: Thursday, August 01, 2002 4:15 AM Subject: [Tutor] Looking for a mentor.. > As a total "newbie" I am seeking someone with patience to mentor me through > learning Python. I'll will do my best to seek my answers else where, but > sometime the questions that I seek are not easy to find. Especially when > they are really simple questions. > > Any one interested please e-mail me dfischer3@slb.com > > tnks > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > From pydan@danshafer.com Sat Aug 3 00:49:24 2002 From: pydan@danshafer.com (Dan Shafer) Date: Fri, 02 Aug 2002 16:49:24 -0700 Subject: [Tutor] Re: Python information Message-ID: <5.1.0.14.0.20020802164710.04139008@mail.hurrah.com> Yigal Duppen wrote: >But getting back to my original point: I suspect that once you have been >contaminated by purely procedural programming, it takes a lot of mind bending >to understand OO in its entirety. Yep. I taught OO for many years. I could take non-technical managers and have them grokking objects and their basics in a half-day workshop. New programmers usually took a day or two. Procedurally trained programmers more like two or three sessions of 2-5 days each spread over 2-3 months. COBOL programmers? Never did get it. But that's another story. :-) My experience is that most people who have trouble with objects do so because they try to make them much more complicated than they really are. Dan Shafer, Chief Scribe and Tablet Keeper PythonCard Open Source Project http://pythoncard.sourceforge.net From bjmartin98@pennswoods.net Sat Aug 3 01:04:52 2002 From: bjmartin98@pennswoods.net (Billie) Date: Fri, 2 Aug 2002 20:04:52 -0400 Subject: [Tutor] Question about Python and Windows' Apps Message-ID: <001e01c23a81$64af56c0$78344d3f@bjmartin98> This is a multi-part message in MIME format. ------=_NextPart_000_001B_01C23A5F.DCF5DE00 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, I have a question that I hope someone can answer. I am learning Python = with an end in mind. I have several form letters in Word and a flat file database in Excel = for addresses. What I am looking to do is to have a onestop place for = data entry. It's not just about mail merge because I do have to make a = couple of changes to the form letter itself but basically the letters = stay the same. I would like to keep the data entry information in = another flat file in Excel for a few of the letters to generate reports. I'm not looking for fancy GUI's, just something that works. Is this something Python can do. If you have any input I would appreciate it. Billie ------=_NextPart_000_001B_01C23A5F.DCF5DE00 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hello,
 
I have a question that I hope someone = can=20 answer.  I am learning Python with an end in mind.
 
I have several form letters in Word and = a flat file=20 database in Excel for addresses.  What I am looking to do is to = have a=20 onestop place for data entry.  It's not just=20 about mail merge because I do have to make a couple of changes to the = form=20 letter itself but basically the letters stay the same. I would like to=20  keep the data entry information in another flat file in Excel for = a few of=20 the letters to generate reports.
 
I'm not looking for fancy GUI's, just = something=20 that works.
Is this something Python can = do.
 
If you have any input I would = appreciate=20 it.
Billie
------=_NextPart_000_001B_01C23A5F.DCF5DE00-- From billintucson@yahoo.com Sat Aug 3 04:59:03 2002 From: billintucson@yahoo.com (Bill Gillespie) Date: Fri, 2 Aug 2002 20:59:03 -0700 (PDT) Subject: [Tutor] xemacs on linux - anyone know the settings of .file? Message-ID: <20020803035903.30316.qmail@web11806.mail.yahoo.com> Does anyone know how to change the xemacs variable for calling "python" to something else - like "python2". When I run my scripts in xemacs - it calls "python" which is version 1.5 on my redhat system. I'd like to ask for "python2" to run the scripts through the newer release of Python. Bill __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From virketis@post.harvard.edu Sat Aug 3 06:56:06 2002 From: virketis@post.harvard.edu (Pijus Virketis) Date: Sat, 3 Aug 2002 08:56:06 +0300 Subject: [Tutor] Question about Python and Windows' Apps In-Reply-To: <001e01c23a81$64af56c0$78344d3f@bjmartin98> Message-ID: Billie, >I have several form letters in Word and a flat file database= in >Excel for addresses. What I am looking to do is to have a = onestop >place for data entry. It's not just about mail merge because I= do >have to make a couple of changes to the form letter itself but >basically the letters stay the same. I would like to keep the= data >entry information in another flat file in Excel for a few of = the >letters to generate reports. >Is this something Python can do. Well, I think this should not be too hard to accomplish with= Python. Remember, it can be used for M$ Office automation tasks by= accessing the COM interfaces of, say, Excel and Word. So, in principle the= task would be very similar to writing this script in VBA, except= nicer, because you'll be doing it in Python. ;) Here's a presentation on "Getting at your Office Data": http://starship.python.net/crew/pirx/spam7/ Here's Chapter 12 of the superlative "Python Programming on= Win32" by Mark Hammond: http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html I've found this material enough to get me started on my toy= projects. You might wish to buy the book mentioned above, if you're going= to work a lot with Office. Cheers, Pijus -- "Anyone attempting to generate random numbers by deterministic= means is, of course, living in a state of sin." -- John Von Neumann From runsun@bilbo.bio.purdue.edu Sat Aug 3 18:28:13 2002 From: runsun@bilbo.bio.purdue.edu (runsun) Date: Sat, 3 Aug 2002 12:28:13 -0500 Subject: [Tutor] RE: What file is calling the cgi ??? In-Reply-To: Message-ID: Hi all, Last week I asked a question "What file is calling the cgi?" (Tutor Digest, vol 1 # 1794, 7/28/02, Topic#3) but got no answer. I've found a way to get this info so here it is to share: In the ???.shtml file that is calling the cgi (lets say, /testfolder/caller.shtml), instead of using , using the following instead: This will get the whocalledme.py to run with arguement sys.argv[1] = /testfolder/caller.shtml. You then can parse that string for some further usage. pan ] I have a cgi: ] ] /cgi-bin/py/whocalledme.py ] ] It was called by a shtml file "caller.shtml" as such: ] ] ] ] The full path name of "caller.shtml" is: ] ] /testfolder/caller.shtml ] ] Now, what code should I put in the whocalledme.py such ] that its execution (when called by caller.shtml) displays ] the folder name ('testfolder') and the caller name ] ('caller.shtml') on a browser ??? ] ] Here were somethings I tried but they seem to offer the ] host info (namedly, /cgi-bin/py/whocalledme.py, but not ] /testfolder/caller.shtml) : ] ] print os.getcwd() ] print "
", os.environ.get("HTTP_REFERER", "--noreferer--") ] print "
", os.environ.get("HTTP_HOST", "--nohost--") ] print "
", os.curdir ] print "
", os.path.abspath(os.curdir) ] ] I could have used: ] ] ] ] but I really want to see if a python cgi can get the caller's name. ] ] Thx in advance. ] ] pan ] ] ] ============================================ ] ~~ Be like water, be shapeless ~~ ] Runsun Pan, PhD, 773-834-3965 ] Ecology & Evolution, U of Chicago ] ============================================ From scot@possum.in-berlin.de Sat Aug 3 14:28:01 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Sat, 3 Aug 2002 15:28:01 +0200 Subject: [Tutor] Skipping elements from inside generator loops In-Reply-To: References: Message-ID: <200208031528.01537.scot@possum.in-berlin.de> Hello Steve, > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > cat_list = [ cat for cat in procession if cat != 'ALARM!' and cat != > 'the evil dog' ] for cat in cat_list: > print cat > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ah, but this is cheating - you are looking for 'the evil dog' directly. You are only allowed to check for the alarm, not for the dog itself! Y, Scot -- Scot W. Stevenson -- scot@possum.in-berlin.de -- Zepernick, Germany From glingl@aon.at Sat Aug 3 22:05:54 2002 From: glingl@aon.at (Gregor Lingl) Date: Sat, 03 Aug 2002 23:05:54 +0200 Subject: [Tutor] Skipping elements from inside generator loops References: <000201c23b2b$ab5c9880$1615a8c0@mega> Message-ID: <3D4C45B2.3000200@aon.at> > > >>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>cat_list = [ cat for cat in procession if cat != 'ALARM!' and cat != >>'the evil dog' ] for cat in cat_list: >> print cat >>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> > >Ah, but this is cheating - you are looking for 'the evil dog' directly. >You >are only allowed to check for the alarm, not for the dog itself! > >Y, Scot > > What about this: >>> p = ['black cat', 'white cat', 'grey cat', 'ALARM!', 'the evil dog', 'fat cat', 'slow cat'] Now one observes, that in >>> zip([None]+p,p) [(None, 'black cat'), ('black cat', 'white cat'), ('white cat', 'grey cat'), ('grey cat', 'ALARM!'), ('ALARM!', 'the evil dog'), ('the evil dog', 'fat cat'), ('fat cat', 'slow cat')] the second Element of each pair is good if only 'ALARM!' does not occur in the pair: >>> [pair[1] for pair in zip([None]+p,p) if 'ALARM!' not in pair] ['black cat', 'white cat', 'grey cat', 'fat cat', 'slow cat'] Not very elegant! Amendments? Gregor From dyoo@hkn.eecs.berkeley.edu Sun Aug 4 00:12:54 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sat, 3 Aug 2002 16:12:54 -0700 (PDT) Subject: [Tutor] xemacs on linux - anyone know the settings of .file? In-Reply-To: <20020803035903.30316.qmail@web11806.mail.yahoo.com> Message-ID: On Fri, 2 Aug 2002, Bill Gillespie wrote: > Does anyone know how to change the xemacs variable for calling "python" > to something else - like "python2". > > When I run my scripts in xemacs - it calls "python" which is version 1.5 > on my redhat system. I'd like to ask for "python2" to run the scripts > through the newer release of Python. Hi Bill, Emacs and XEmacs are programmed in a variant of the Lisp language, and if you ever feel curious about how python-mode works, we can always look at the 'python-mode.el' file. Here the chunk of emacs lisp code that's relevant to your question: ;;;;;; within the 'python-mode.el' emacs lisp file: (defcustom py-python-command "python" "*Shell command used to start Python interpreter." :type 'string :group 'python) (defcustom py-jpython-command "jpython" "*Shell command used to start the JPython interpreter." :type 'string :group 'python :tag "JPython Command") ;;;;;; These two variables are used to execute Python's shell. If we want to change the python executable that xemacs calls when we emacs commands like 'C-c C-!', we can set the following in our personal '.emacs' configuration file: ;;; (setq py-python-command "python2") ;;; Hope this helps! From dyoo@hkn.eecs.berkeley.edu Sun Aug 4 00:17:23 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sat, 3 Aug 2002 16:17:23 -0700 (PDT) Subject: [Tutor] RE: What file is calling the cgi ??? In-Reply-To: Message-ID: On Sat, 3 Aug 2002, runsun wrote: > Last week I asked a question "What file is calling the cgi?" (Tutor > Digest, vol 1 # 1794, 7/28/02, Topic#3) but got no answer. > > I've found a way to get this info so here it is to share: > > In the ???.shtml file that is calling the cgi (lets say, > /testfolder/caller.shtml), instead of using > > , > > using the following instead: > > > > This will get the whocalledme.py to run with arguement sys.argv[1] = > /testfolder/caller.shtml. You then can parse that string for some > further usage. Very cool, thanks for the pointer! That's a cute way of solving things, by disguising the including of dynamic content as an image GET. I'm not quite sure how the value of the document.location gets into sys.argv[1], though. Doesn't it go into the QUERY_STRING environmental variable? Talk to you later! From glingl@aon.at Sun Aug 4 01:22:49 2002 From: glingl@aon.at (Gregor Lingl) Date: Sun, 04 Aug 2002 02:22:49 +0200 Subject: [Tutor] Girls, women and Programming (- and Python) References: <3D485C3F.3060304@aon.at> Message-ID: <3D4C73D9.2000704@aon.at> Hi Pythonistas! I'm currently preparing some introductory material to programming for young people (13-17 years approx.), and for this Python is my language of choice. I'll do it in German and I hope to get it published, as there is a very severe lack of material of this kind in the German speaking countries. (On the other side Python still is not very well known at least among teachers in Germany - so it's quite uncertain who will be willing to study such things. Nevertheless trying to make Python more popular is worth the effort.) Of course many important questions concerning this activiy turn around in my head, and among these there is one problem, which I consider to be especially important but don't know how to tackle it. I'll formulate two questions: 1) Why are there so few girl and women interested in programming? (look, for instance, at the list of partiicipants of all those mailing lists) And consequently 2) How do I get them interested? Which kinds of material, approaches, examples etc. are appealing to female students? Do YOU have any experiences concerning this question. Jeff Elkners Python-Video implicitly adresses this problem in a very fine way, choosing a girl as the main propagator of Python. On the other hand looking at a video and reading a tutorial text are different things - so possibly your opinions, experiences and hints could help me to adress this problem in my work. I would really wish to make programming more interesting, enjoying and challenging to female students. Thanks in advance for your replies Gregor Lingl From sue@welearn.com.au Sun Aug 4 03:53:59 2002 From: sue@welearn.com.au (Sue Blake) Date: Sun, 4 Aug 2002 12:53:59 +1000 Subject: [Tutor] Girls, women and Programming (- and Python) In-Reply-To: <3D4C73D9.2000704@aon.at>; from glingl@aon.at on Sun, Aug 04, 2002 at 02:22:49AM +0200 References: <3D485C3F.3060304@aon.at> <3D4C73D9.2000704@aon.at> Message-ID: <20020804125359.I363@welearn.com.au> On Sun, Aug 04, 2002 at 02:22:49AM +0200, Gregor Lingl wrote: > > 1) Why are there so few girl and women interested in programming? > 2) How do I get them interested? Which kinds of material, approaches, > examples etc. are appealing to female students? I sent a long reply to Gregor directly, because the mainly social causes and cures are only peripheral to the true topic of this mailing list. If anyone really wants to see a rant, email me and I'll send you a copy rather than cluttering the list. For anyone who's curious about this issue, I'd like to encourage you to follow up on that interest when teaching python. I ended my diatribe to Gregor with some practical advice: If everyone knew more about adult learning principles, everyone would find it easier to benefit from the knowledge that they have to share, and people of all learning types would get a lot of what they need. For how it is applied, see http://www.daemonnews.org/199908/newbies.html [...] Accommodate differences where they are true and relevant differences, and don't look for differences where they do not exist or are not relevant to the task at hand. Be constantly dilligent to make no assumptions based on gender. If our society needs improvement, that's not the python teacher's job. Your job is to help all people who want to learn, to discover how good they can become. -- Regards, -*Sue*- From llazarre@yahoo.com Sun Aug 4 03:56:59 2002 From: llazarre@yahoo.com (Levy Lazarre) Date: Sat, 3 Aug 2002 19:56:59 -0700 (PDT) Subject: [Tutor] Telnetlib Message-ID: <20020804025659.81921.qmail@web40403.mail.yahoo.com> Hello all, I am new to the list and already enjoying it very much. I have a couple a questions about Telnetlib and hope somebody can help me with them. I am currently writing a Telnet script to automate some data entry. Given a telnet object tn, the way to send some text to the remote server is of course 'tn.write(text)'. But how do I send function keys such as F4, F7 which perform some specific tasks in the application I am working with? Terminal type is VT-200. Also, when you set the telnet debug level, all debug messages go by default to sys.stdout. Is there a way to redirect to a file? I can't find this in the documentation. Perl's Telnet module allows to do this but I am trying to get away from Perl. Thanks in advance Levy Lazarre llazarre@yahoo.com __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From Tutor Sun Aug 4 04:10:22 2002 From: Tutor (Tim Peters) Date: Sat, 03 Aug 2002 23:10:22 -0400 Subject: [Tutor] Skipping elements from inside generator loops In-Reply-To: <200208011115.15161.scot@possum.in-berlin.de> Message-ID: [Scot W. Stevenson] > ... > Now I'm curious: Is this ability to manipulate generator loops from the > inside considered a bug or a feature? It's a feature. Most people don't need .next() methods at all. By exposing them, we're deliberately giving "advanced" users the opportunity to "interfere" with Python's internal iteration protocol. You can use that for good or for evil, but we hope you'll use it only for good. The same is true of many internal hooks, and remember you're not *required* to use them! Many hooks are there for the benefit of programs with extreme needs -- for example, consider writing a Python debugger in Python. That's got to "interfere" with normal Python operation is deep ways. Most programs don't need any of that stuff. Comparatively speaking, .next() abuse is a minor sin . From billintucson@yahoo.com Sun Aug 4 05:16:05 2002 From: billintucson@yahoo.com (Bill Gillespie) Date: Sat, 3 Aug 2002 21:16:05 -0700 (PDT) Subject: [Tutor] xemacs on linux - anyone know the settings of (python-mode) .file? In-Reply-To: Message-ID: <20020804041605.34455.qmail@web11807.mail.yahoo.com> Thanks Danny, Cool. I placed the lines below into my ".emacs" file - and it worked. Xemacs now calls python 2.2.1, instead of the default "python" call which runs python the old version 1.5. ;; (setq py-python-command "python2") ;; Many thanks! Bill __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From lumbricus@gmx.net Sun Aug 4 14:08:50 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Sun, 4 Aug 2002 15:08:50 +0200 (MEST) Subject: [Tutor] Telnetlib References: <20020804025659.81921.qmail@web40403.mail.yahoo.com> Message-ID: <7987.1028466530@www30.gmx.net> > Hello all, Hello! > I am new to the list and already enjoying it very > much. I have a couple a questions about Telnetlib and > hope somebody can help me with them. I am currently > writing a Telnet script to automate some data entry. > Given a telnet object tn, the way to send some text to > the remote server is of course 'tn.write(text)'. But > how do I send function keys such as F4, F7 which > perform some specific tasks in the application I am > working with? Terminal type is VT-200. AFAIK These function keys are translated to sequenzes of characters by your (virtual) terminal. You should be able to send these as raw strings through a telnet connection. 'man termcap' might also help. > Also, when you set the telnet debug level, all debug > messages go by default to sys.stdout. Is there a way I don't know for sure, but I would expect them to be sent to sys.stderr. > to redirect to a file? I can't find this in the > documentation. Perl's Telnet module allows to do this os.popen > but I am trying to get away from Perl. > Thanks in advance > Levy Lazarre > llazarre@yahoo.com HTH, HAND J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From scot@possum.in-berlin.de Sun Aug 4 14:17:05 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Sun, 4 Aug 2002 15:17:05 +0200 Subject: [Tutor] Skipping elements from inside generator loops In-Reply-To: <3D4C45B2.3000200@aon.at> References: <000201c23b2b$ab5c9880$1615a8c0@mega> <3D4C45B2.3000200@aon.at> Message-ID: <200208041517.05048.scot@possum.in-berlin.de> Hello Gregor, > >>> zip([None]+p,p) > [(None, 'black cat'), ('black cat', 'white cat'), ('white cat', 'grey > cat'), > ('grey cat', 'ALARM!'), ('ALARM!', 'the evil dog'), ('the evil dog', > 'fat cat'), > ('fat cat', 'slow cat')] > the second Element of each pair is good if only 'ALARM!' does not occur > in the pair: > >>> [pair[1] for pair in zip([None]+p,p) if 'ALARM!' not in pair] > ['black cat', 'white cat', 'grey cat', 'fat cat', 'slow cat'] > Not very elegant! Amendments? This is /sehr beeindruckend/ - and it even works if 'ALARM!' ist the first entry. I really like the idea of shifting the first part of the zip call with one "None" to produce pairs; this is not something I would have thought of... Thank you for the demonstration, I'll have to go play around with it for a while =8). Y, Scot -- Scot W. Stevenson -- scot@possum.in-berlin.de -- Zepernick, Germany From cemategi@terra.com.pe Mon Aug 5 00:01:56 2002 From: cemategi@terra.com.pe (Martin Teves) Date: Sun, 4 Aug 2002 18:01:56 -0500 Subject: [Tutor] Newbie Question. Message-ID: <002101c23c0a$ee8a0f40$e4ea04c8@mio> What things can I do whit Python???, I really wanna know. From e.kotyk@shaw.ca Mon Aug 5 00:22:53 2002 From: e.kotyk@shaw.ca (Eve Kotyk) Date: Sun, 04 Aug 2002 17:22:53 -0600 Subject: [Tutor] Girls, women and Programming (- and Python) In-Reply-To: <3D4C73D9.2000704@aon.at> References: <3D485C3F.3060304@aon.at> <3D4C73D9.2000704@aon.at> Message-ID: <20020804172253.1ad43699.e.kotyk@shaw.ca> --=.c42,mc9rXjAK?E Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > > I'll do it in German and I hope to get it published, as there is a > very severe lack of material of this kind in the German speaking > countries. (On the other side Python still is not very well known > at least among teachers in Germany - so it's quite uncertain who > will be willing to study such things. Nevertheless trying to make > Python more popular is worth the effort.) Kudos! I think this is great thing. > > 1) Why are there so few girl and women interested in programming? > (look, for instance, at the list of partiicipants of all those mailing > lists) I don't actually know the answer to this..it may still be partly enculturation. Its still not entirely cool for a women to think. Especially for them to think logically. As a generality it might be that girls often prefer to base their thinking on values rather than principle. Which is not a bad way to organized your thought processes it just means that that they prefer to be taught in a subjective manner rather than an objective manner. ie: How does this knowledge apply to them and the human being beside them.> > And consequently > 2) How do I get them interested? Which kinds of material, approaches, > examples etc. are appealing to female students? I'm determined to learn Phython but I find that my lack of general knowledge of programming makes it difficult to figure out what to write. Because I'm a painter, I'll use that as an analogy. Many people who do not know how to use the materials and language of paint will often flounder when asked to paint a picture. The question is "well what should I paint". When they know the language and the material it suddenly doesn't matter what they paint...anything will do just so you can make something beautiful with the language and the materials. When I speak of language here I'm speaking of the principles of pictorial depiction. So I think one of the ways to get girls (anyone really) interested is to design projects for them to do, that are fun and almost inadvertently teach the language. > > Do YOU have any experiences concerning this question. Jeff Elkners > Python-Video implicitly adresses this problem in a very fine way, > choosing a girl as the main propagator of Python. Hmmm I didn't know about this...will have search for it. E -- ekotyk http://members.shaw.ca/e.kotyk/virtualstudio.htm --=.c42,mc9rXjAK?E Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE9TbdRyxm8dPG0oMIRAon4AJ0cjFeL5JdGqLF3VRlusjZ3hg0drQCgxaPF ODGGKpIGnShU2dQhH/j8OCY= =6xFz -----END PGP SIGNATURE----- --=.c42,mc9rXjAK?E-- From darnold02@sprynet.com Sat Aug 3 07:20:36 2002 From: darnold02@sprynet.com (Don Arnold) Date: Sat, 3 Aug 2002 06:20:36 GMT Subject: [Tutor] RE: Newbie question - sample code. Message-ID: join From dyoo@hkn.eecs.berkeley.edu Mon Aug 5 04:09:53 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sun, 4 Aug 2002 20:09:53 -0700 (PDT) Subject: [Tutor] Newbie Question. [what is programming good for?] In-Reply-To: <002101c23c0a$ee8a0f40$e4ea04c8@mio> Message-ID: On Sun, 4 Aug 2002, Martin Teves wrote: > What things can I do whit Python???, I really wanna know. Hi Martin, I'll reinterpret your question as "What kind of things can I do with computer programming?". It's a similar question, and I hope you don't mind if I think of it that way. (I just want to avoid riling up folks who use different computer languages. *grin*) One way we can get a handle on what's possible with programming is to look at examples. If you haven't already, you can take a look at the Useless Python web page: http://uselesspython.com The links there are to programming that people have written, and if you glance at the descriptions, you'll see all sorts of weird stuff, from games to cyphers to puzzle solvers to math toys. Programs are versatile. A computer is best at performing instructions very quickly, and programming lets us take control of a computer power. Programming allows us to automate whatever we can organize as instructions. For example, if we were playing a complicated role playing game, perhaps we might have to role a dice one hundred times to simulate a huge battle. Now, rolling a dice by hand can be fun, but also be a bit tedious if we have to do it a lot. So instead of doing it ourselves, we can get the computer to "roll" for us. Here's how we can get the computer to roll the dice one time: ### >>> print random.randrange(1, 6+1) 4 ### But that's a lot of typing for getting one dice roll. How is this better than doing it by hand? That's where programming comes in: we can tell the computer to do this several times... or several hundred times! Here's a small program that prints one hundred dice roles: ### >>> for i in range(100): ... print random.randrange(1, 6+1), ... 6 1 1 2 3 3 3 1 1 2 3 2 1 1 1 6 6 2 5 6 2 6 1 3 3 2 3 2 6 1 1 2 6 6 1 2 1 3 6 2 1 5 6 4 2 4 5 2 4 2 5 5 6 1 4 4 2 4 6 4 4 3 1 6 2 5 6 4 6 5 1 2 6 5 2 2 5 4 6 1 1 6 1 4 1 1 2 1 1 1 6 4 1 5 3 6 4 3 6 6 ### (The text instructions that are on the same lines as the '>>>' and the '...' are things that I've typed, and the numbers below those lines are being printed by the computer.) The instructions themselves aren't so important: what's neat is to see that, with just two lines of instructions --- "code" --- we have extraordinary power: we've just simulated 100 dice rolls! That being said, programming is good for more than rolling dice. *grin* But I hope this example makes some sense: by programming a computer, we get the power to amplify what we can already do. For example, people who design games can use programming to share these games with others without having to cut cardboard or shave plastic pieces: http://pygame.org/ Others use programming to help them analyze some large books or data. Biologists, for example, can use a tool called "BioPython": http://biopython.org/ to speed their analysis along. And still others like doing lots of math with programming: http://www.pfdubois.com/numpy/ All these things could, in theory, be done without programming... or perhaps not! It might just be too slow and impractial to do by hand. That's where programming can come in: it makes hard things possible. Those three links are Python specific, but we can give you pointers to other resources if you'd like. If you tell us more about what you're interested in, we may be able to show you how programming might fits in. We often use programming to make something else easier to do. Best of wishes to you! From dyoo@hkn.eecs.berkeley.edu Mon Aug 5 04:12:17 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sun, 4 Aug 2002 20:12:17 -0700 (PDT) Subject: [Tutor] RE: Newbie question - sample code. In-Reply-To: Message-ID: On Sat, 3 Aug 2002, Don Arnold wrote: > join Hi Don, Are you trying to subscribe on the Tutor mailing list? If so, you can visit: http://mail.python.org/mailman/listinfo/tutor You'll see a form there that will let you subscribe. If you have any questions, please send a holler to "tutor-admin@python.org", and the administrators can help you get subscribed. By the way, if you ever want to unsubscribe from Tutor, you can do so with that same link. A few people have been wondering how to unsubscribe, so I thought it might be good to point that out. Best of wishes to you! From dyoo@hkn.eecs.berkeley.edu Mon Aug 5 04:34:07 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sun, 4 Aug 2002 20:34:07 -0700 (PDT) Subject: [Tutor] Telnetlib In-Reply-To: <7987.1028466530@www30.gmx.net> Message-ID: > > Also, when you set the telnet debug level, all debug messages go by > > default to sys.stdout. Is there a way to redirect to a file? I can't > > find this in the documentation. Perl's Telnet module allows to do this Hi Llazarre, Yes, there's a way of redirecting standard error. One way is to temporarily set 'sys.stderr' out to another file, like this: ### >>> sys.stderr = open("/home/dyoo/redirected_stderr.txt", "w") >>> 1/0 >>> ### Notice that no error pops up here, even though we did something bad in dividing by zero. When we open up that file, we'll see our missing output: ### >>> sys.stderr.close() >>> f = open("/home/dyoo/redirected_stderr.txt") >>> f.read() 'Traceback (most recent call last):\n File "", line 1, in ?\nZeroDivisionError: integer division or modulo by zero\n' ### It's not a good thing to leave 'sys.stderr' hanging in a script, so we often save the old sys.stderr, temporarily redirect it, and then set it back once we're done. Hope this makes sense! From guillermo.fernandez@epfl.ch Mon Aug 5 08:09:05 2002 From: guillermo.fernandez@epfl.ch (Guillermo Fernandez) Date: Mon, 05 Aug 2002 16:39:05 +0930 Subject: [Tutor] Python information References: Message-ID: <3D4E2491.36540018@epfl.ch> > and finally, monsters.py (I forgot how I got it or who the author is, > but it is very good start); it is attached. Hi! I tried to start monster.py but had some difficulties to make it work. I made a few changes and now it seems to work. I chaged the lines 55 to 57: self.needs.update(self.state, ext_factors) # max_need = self.needs.get_max() into: self.needs.update(self.state, ext_factors) max_need = self.needs.get_max() and the lines to : choice = input("Which type of monster would you like to watch?") num = input("Specify the number of turns the monster should take: ") monster = monsters[choice-1] into: choice = input("Which type of monster would you like to watch?")#-1 num = input("Specify the number of turns the monster should take: ") monster = monsters[choice] By the way, it's quite funny how you can do that kind of simulations in only 351 lines! It still lack of interaction between characters (as for example the spider will attack without knowing if there is someone to atack :-) and a few remarks of the same style, but it seems to be a work in process program and I'm waiting for the results. From guillermo.fernandez@epfl.ch Mon Aug 5 08:15:48 2002 From: guillermo.fernandez@epfl.ch (Guillermo Fernandez) Date: Mon, 05 Aug 2002 16:45:48 +0930 Subject: [Tutor] Python information References: <3D4E2491.36540018@epfl.ch> Message-ID: <3D4E2624.C39BB669@epfl.ch> > and the lines to : > > choice = input("Which type of monster would you like to watch?") > num = input("Specify the number of turns the monster should > take: ") > monster = monsters[choice-1] > > into: > > choice = input("Which type of monster would you like to > watch?")#-1 > num = input("Specify the number of turns the monster should > take: ") > monster = monsters[choice] Sorry... from all evidence it's exactly the oposite... Lines 336 to 338: choice = input("Which type of monster would you like to watch?")#-1 num = input("Specify the number of turns the monster should take: ") monster = monsters[choice] into:  choice = input("Which type of monster would you like to watch?") num = input("Specify the number of turns the monster should take: ") monster = monsters[choice-1] Guille From arazak@kansai.com.my Mon Aug 5 10:17:32 2002 From: arazak@kansai.com.my (Mr. Razak) Date: Mon, 5 Aug 2002 17:17:32 +0800 Subject: [Tutor] dbfreader.py could not run Message-ID: <005901c23c60$ee423ac0$0501a8c0@kansai> This is a multi-part message in MIME format. ------=_NextPart_000_0056_01C23CA3.FBEFD590 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I download dbfreader.py from Vaults Of Parnassus and try to run the = program. Unfortunately it won't work due to struct module cannot be = found. Can anyone help me, where can i find the struct module. Thanks. ------=_NextPart_000_0056_01C23CA3.FBEFD590 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I download dbfreader.py from Vaults Of = Parnassus=20 and try to run the program. Unfortunately it won't work due to struct = module=20 cannot be found.
 
Can anyone help me, where can i find = the struct=20 module.
 
Thanks.
------=_NextPart_000_0056_01C23CA3.FBEFD590-- --- [This E-mail scanned for viruses by Declude antiVirus] From allyn.@tardigrade.net Mon Aug 5 10:54:57 2002 From: allyn.@tardigrade.net (Allyn Weaks) Date: Mon, 5 Aug 2002 02:54:57 -0700 Subject: [Tutor] Girls, women and Programming (- and Python) In-Reply-To: <20020804172253.1ad43699.e.kotyk@shaw.ca> References: <3D485C3F.3060304@aon.at> <3D4C73D9.2000704@aon.at> <20020804172253.1ad43699.e.kotyk@shaw.ca> Message-ID: On 4/8/02, Gregor Lingl wrote: >> 2) How do I get them interested? Which kinds of material, approaches, >> examples etc. are appealing to female students? On 4/8/02, Eve Kotyk wrote: >I'm determined to learn Phython but I find that my lack of general >knowledge of programming makes it difficult to figure out what to write. > Because I'm a painter, I'll use that as an analogy. Many people who do >not know how to use the materials and language of paint will often >flounder when asked to paint a picture Speaking of arts, try musical composition. Western music fits beautifully into list structures. You can do it as a list of attributes for each note (pitch, duration, loudness, ...). But it's much more useful and fun to split an entire tune into separate lists for pitch and duration (as proper musical durations--breve, quarter, eighth, etc), and for more subtlety if desired, loudness of each note, percentage of time that the note sounds, etc. Put the lists together only at the last minute when playing the result. Handling it this way makes it really easy to play composition games such as: What happens if you use the pitches from tune A, and the rhythm from tune B? What happens if you double the duration of every other note, or every third note? What does it sound like if you play the tune back to front (retrograde), or upside down (inversion) or both? What does it sound like converted into a different scale, such as dorian instead of major? (How should one represent a 'scale'?) How do you put in a syncopation or a trill? How can you stress the first beat of a measure? Does a tune sound the same in 4/4 and 6/8? What can you do to make the computer play less mechanically? Have the computer help write a song for a set of lyrics--put the rhythm and stresses of the words into lists, then try out different pitch sequences--borrowed, original, or generated by algorithm--against that rhythm, and adjust to taste. Or try generating counterpoint with some rules / algorithms about allowed intervals within a part and between parts. Add harmony with chords. Find a way to print out the notation, and/or convert your representation to and from midi format. Play with genetic algorithms and let tunes evolve. Try some analysis and find out what's the same / different between different styles--histogram of pitches? intervals? rhythmic idioms? Once you think you know what makes up a given style, can you say that in rules to randomly generate plausible tunes in that style? There's an interesting book that's out of print, but still available used: Cybernetic Music, by Jaxitron; TAB Books, 1985, 0-8306-1856-2. It uses APL to do this sort of representation and build tools for composition. It ought to be pretty easy to adapt the basics to python for beginners, even beginners without a musical background, since so many tunes are quite simple--plain major key, and straightforward rhythms. Another possible source of inspiration, though possibly harder to find, is "The Game of Harmony" by Ross Lee Finney from the 40s. It's an introduction to writing simple four part harmonies for children. It could be helpful for designing classes for chord structures and algorithms for applying them. You can do similar things with visual arts. There should be good ways to do a lot of textile stuff, such as weaving patterns. A lot of mathematical functions make beautiful quilt designs, and one could have the computer generate piece patterns (don't forget those seam margins, and optimizing the use of material can be a challenge.) Both knitting and macrame lead to knot theory and topology. Ivars Peterson, of Science News, has a book out that might be useful for ideas: "Fragments of Infinity: A Kaleidoscope of Math and Art". I think parts of it have shown up as installments in Mathtrek at the Science News site . Then as an encore, how about choreographing the turtle? :-) -- Allyn Weaks allyn@tardigrade.net Seattle, WA Sunset zone 5 Pacific NW Native Wildlife Gardening: http://www.tardigrade.org/natives/ "The benefit of even limited monopolies is too doubtful, to be opposed to that of their general suppression." Thomas Jefferson From alan.gauld@bt.com Mon Aug 5 11:28:20 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 5 Aug 2002 11:28:20 +0100 Subject: [Tutor] listdir, ispath and unicode (followup question) Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7D1@mbtlipnt02.btlabs.bt.co.uk> > > > The file, 'd:\\tmp2\\???????', is a text file which I created for > > > testing this problem. > > Actually, this was supposed to have been a file with Unicode > (Cyrillic) characters in the filename, Yeah, I discovered that when the next digest arrived full of messages about unicode! One disadvantage of getting email in batches... Ho hum.... Alan g. From alan.gauld@bt.com Mon Aug 5 11:48:09 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 5 Aug 2002 11:48:09 +0100 Subject: [Tutor] Re: Python information Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7D2@mbtlipnt02.btlabs.bt.co.uk> > COBOL programmers? Never did get it. But that's another story. :-) :-) But they're all using COBOL PLUS OVBJECTS now I guess! > My experience is that most people who have trouble with > objects do so because they try to make them much more > complicated than they really are. Actually I find a different prolem arises. Experienced programmers tend to try to relate objects to their prior knowledge. Thus they think an object is a C struct with fields which are function pointers. Then they think about messaging as simply a function call. Then they think of inheritance as a code reuse mechanism. And finally they think of class heirarchies as abstract data types. All of the above analogies are accurate to at least some level. But all of them are fundamentally misleading when trying to think in terms of objects as a fundamental unit of code in their own right. Its one reason that I have come to the conclusion that teaching a C programmer OOP using C++ or Java is a mistake - its better to teach something radically different in syntax terms like Smalltalk or Lisp (or more arguably Python). Then the tendency to relate to previous knowledge is reduced. Smalltalk is particularly effective because even the way you write the code is different (in a class browser rather than a file editor) Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld PS The curious can look/learn about smalltalk at the ObjectArts web site( http://www.object-arts.com/ ), home of the excellent Dolphin smalltalk or alternativel try the Squeak project at http://www.squeak.org... From alan.gauld@bt.com Mon Aug 5 11:53:19 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 5 Aug 2002 11:53:19 +0100 Subject: [Tutor] Question about Python and Windows' Apps Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7D3@mbtlipnt02.btlabs.bt.co.uk> > I have several form letters in Word and a flat file > database in Excel for addresses. > I'm not looking for fancy GUI's, just something > that works. Is this something Python can do. Yes, Python can do it. You will need to use the winall package to access the COM object model of both Excel and Word and learning how to manipulate that is likely to be the hardest part. The Python aspects are fully explained in Mark Hammonds book "Programming Python on Win32" (or somesuch title). Although Mark Hammond will probably not agree I'd personally use VBScript or even VBA from within Word to do this kind of thing. Right tool for the job etc... Python is a great general purpose language and easy to learn but VBA/VBScript was designed to script COM objects and Microsoft applications. HTH Alan g. From alan.gauld@bt.com Mon Aug 5 12:25:34 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 5 Aug 2002 12:25:34 +0100 Subject: [Tutor] Telnetlib Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7D5@mbtlipnt02.btlabs.bt.co.uk> > > > default to sys.stdout. Is there a way to redirect to a > file? I can't find this in the documentation. Perl's Telnet module > allows to do this If you are on *nix you can use the normal shell redirection when you invoke the script: Bash/Ksh: $ python myscript.py 2> errors.txt [t]csh is a tad more difficult - ie I can't remember ;-) However if you want to do it in a more consistent/controllable manner Danny's advice aboput changing sys.stderr is probably the way to go. > Yes, there's a way of redirecting standard error. One way is to > temporarily set 'sys.stderr' out to another file, like this: Alan G. From ajs@ix.netcom.com Mon Aug 5 13:54:13 2002 From: ajs@ix.netcom.com (Arthur) Date: Mon, 5 Aug 2002 08:54:13 -0400 Subject: [Tutor] Girls, women and Programming (- and Python) References: <3D485C3F.3060304@aon.at> <3D4C73D9.2000704@aon.at> <20020804172253.1ad43699.e.kotyk@shaw.ca> Message-ID: <016c01c23c7f$361abbb0$9865fea9@arthur> > You can do similar things with visual arts. There should be good ways > to do a lot of textile stuff, such as weaving patterns. A lot of > mathematical functions make beautiful quilt designs, and one could have > the computer generate piece patterns (don't forget those seam margins, > and optimizing the use of material can be a challenge.) Both knitting > and macrame lead to knot theory and topology. Ivars Peterson, of > Science News, has a book out that might be useful for ideas: > "Fragments of Infinity: A Kaleidoscope of Math and Art". I think parts > of it have shown up as installments in Mathtrek at the Science News > site . I can't help throwing in a plug for my PyGeo in this context, at home.netcom.com/~ajs. I hope one can get a sense from the webpage of how it might be used for design as well as for the more formal study of geometric concepts. I have some demos in a newer version that I am holding until I am fuilly satisfied with it, that in fact does kaleidoscopic constructions. Specifically they are constructions from a book called Islamic Patterns by Keith Critchlow. The intention is that PyGeo could be usable by anyone with a minimum of Python knowledge, and easily extensible by those with more intermediate (which is where I consider myself to be) understanding. Always looking for feedback on it BTW. Art From kb@mm.st Mon Aug 5 15:57:01 2002 From: kb@mm.st (Kyle Babich) Date: Mon, 5 Aug 2002 14:57:01 UT Subject: [Tutor] what would happen if Message-ID: <20020805145701.975D4936EA@server2.fastmail.fm> Out of curiosity what would happen if I were let something like: while 1: print "hello" run without stopping it? Would the computer crash if I didn't stop it? Thank you, -- Kyle From shalehperry@attbi.com Mon Aug 5 16:13:11 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Mon, 05 Aug 2002 08:13:11 -0700 (PDT) Subject: [Tutor] what would happen if In-Reply-To: <20020805145701.975D4936EA@server2.fastmail.fm> Message-ID: On 05-Aug-2002 Kyle Babich wrote: > Out of curiosity what would happen if I were let something like: > > while 1: > print "hello" > > run without stopping it? Would the computer crash if I didn't stop it? > nope it would just cycle "forever". It is fairly difficult to crash a machine via a mistake in python. From jeff@ccvcorp.com Mon Aug 5 17:56:42 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Mon, 05 Aug 2002 09:56:42 -0700 Subject: [Tutor] Question about Python and Windows' Apps References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7D3@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <3D4EAE4A.EF3B377D@ccvcorp.com> alan.gauld@bt.com wrote: > > I have several form letters in Word and a flat file > > database in Excel for addresses. > > > I'm not looking for fancy GUI's, just something > > that works. Is this something Python can do. > > Although Mark Hammond will probably not agree I'd > personally use VBScript or even VBA from within > Word to do this kind of thing. Right tool for the > job etc... Having written (admittedly smallish) scripts to autogenerate Excel spreadsheets from flat-file data in both VB and Python, I *much* prefer working in Python despite the fact that this use is one of the design goals of VB. Mark's PythonCOM extensions make the use of COM objects almost as simple and intuitive in Python as they are in VB (and in some cases, more so -- I much prefer getting a tuple of returned results instead of dealing with "out" parameters, though this *can* make reading docs a bit confusing). Obviously this is a matter of personal preference and taste, though. Jeff Shannon Technician/Programmer Credit International From alan.gauld@bt.com Mon Aug 5 18:05:51 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 5 Aug 2002 18:05:51 +0100 Subject: [Tutor] what would happen if Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7DD@mbtlipnt02.btlabs.bt.co.uk> > Out of curiosity what would happen if I were let something like: > while 1: > print "hello" > > run without stopping it? Would the computer crash if I > didn't stop it? Eventually yes, either there would be a power cut or a bit of hardware would fail or the OS would hit some kind of internal bug or Python would. But you'd have to wait an awful long time... Alan g. From dyoo@hkn.eecs.berkeley.edu Mon Aug 5 19:01:50 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 5 Aug 2002 11:01:50 -0700 (PDT) Subject: [Tutor] what would happen if In-Reply-To: Message-ID: On Mon, 5 Aug 2002, Sean 'Shaleh' Perry wrote: > > On 05-Aug-2002 Kyle Babich wrote: > > Out of curiosity what would happen if I were let something like: > > > > while 1: > > print "hello" > > > > run without stopping it? Would the computer crash if I didn't stop it? > > > > nope it would just cycle "forever". It is fairly difficult to crash a > machine via a mistake in python. One reason that code above shouldn't cause too much problems is because, by itself, it doesn't use up increasingly larger amounts of resources. However, if we are running that loop in a program that collects and saves the 'hello' lines in some file, it's possible to exhaust disk resources. If we do something like: ### C:\python\run_forever.py > saved_log_file.txt ### in Windows, for example, the system will try to save all those 'hello' lines in a file. That being said, that infinite loop above is pretty benign: we can cancel it by pressing 'Control-C', which causes Python to stop whatever it was trying to do. To make the idea more concrete, let's try something else. Say we do something like this: ### bathtub = [] while 1: bathtub.append("drip") ### Now, instead of leaving things the way they are, we're accumulating drips in a bathtub. That is, we can tell if we've run this loop more than once, because the bathtub is growing. This loop is one where we can say that it uses more and more resources as it runs. Eventually, if we let things continue, we'll overflow the bathtub! This is sorta handwavy, but I hope the idea makes sense. *grin* From rseguin@shaw.ca Mon Aug 5 18:57:59 2002 From: rseguin@shaw.ca (Richard Seguin) Date: Mon, 05 Aug 2002 13:57:59 -0400 Subject: [Tutor] Problem with modules Message-ID: <200208051358.03765.rseguin@shaw.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I am trying to create a program that is very modular and seem to be having problems with def calls. Example I have a module called gui.py that only creates the GUI interface (using Tkinter)... gui.py ----------------------------- menubar = Menu(main_window) # Create File Menu # -------------------- filemenu = Menu(menubar, tearoff=0) filemenu.add_command(label="Option 1",command="TEST") filemenu.add_command(label="Option 2",command="") filemenu.add_command(label="Option 3",command="") filemenu.add_separator() filemenu.add_command(label="Exit",command="exit") menubar.add_cascade(label="File", menu=filemenu) - ---------SNIP ----------------- main.py ---------------------------- from gui import * def TEST(): print "Option 1" gui() ================================================================ When you call the function gui() you would expect that the function TEST() would be known to gui.py wouldn't you? This may be a newbie question but the answer for this should put everything into perspective. Richard -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9Tryrn9670YZTFEcRAmDOAJ4wKzpz/Zjkk3Pu4t56pN1mRi1DNQCeLYkC LFo69qh3fy/xgwoTTPLht4Q= =86TH -----END PGP SIGNATURE----- From dyoo@hkn.eecs.berkeley.edu Mon Aug 5 19:27:40 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 5 Aug 2002 11:27:40 -0700 (PDT) Subject: [Tutor] dbfreader.py could not run In-Reply-To: <005901c23c60$ee423ac0$0501a8c0@kansai> Message-ID: On Mon, 5 Aug 2002, Mr. Razak wrote: > I download dbfreader.py from Vaults Of Parnassus and try to run the > program. Unfortunately it won't work due to struct module cannot be > found. Hi Mr. Razak, Can you show us the error message that occurs when you try running it? Doing a cut-and-paste of the error and its "traceback" in your reply will be really helpful, because it gives us the hints we need to try duplicating the error. We want to make sure we're looking at the same error that you are. *grin* Also, can you give us an URL link to the 'pbfreader.py' from Parnassus? > Can anyone help me, where can i find the struct module. The 'struct' module is part of the Standard Library: http://www.python.org/doc/lib/module-struct.html This is why the error you're running into is puzzling to me. We'll probably need to see a bit more before pronouncing judgement. *grin* Best of wishes to you! From ATrautman@perryjudds.com Mon Aug 5 19:33:01 2002 From: ATrautman@perryjudds.com (Alan Trautman) Date: Mon, 5 Aug 2002 13:33:01 -0500 Subject: [Tutor] dbfreader.py could not run Message-ID: <0BA95581EDA7D611841B00A0C9AD25DD2B57FF@mail.pjinet.com> Please also send the OS as it sometimes matters. Alan From virketis@post.harvard.edu Mon Aug 5 19:51:13 2002 From: virketis@post.harvard.edu (Pijus Virketis) Date: Mon, 5 Aug 2002 21:51:13 +0300 Subject: [Tutor] Question about Python and Windows' Apps In-Reply-To: <3D4EAE4A.EF3B377D@ccvcorp.com> Message-ID: [alan] >>Although Mark Hammond will probably not agree I'd personally= use >>VBScript or even VBA from within Word to do this kind of= thing. >>Right tool for the job etc... [jeff] >Having written (admittedly smallish) scripts to autogenerate= Excel >spreadsheets from flat-file data in both VB and Python, I= *much* >prefer working in Python Just to throw in my two cents here. :) Having worked a bit both with VB/VBA and Python, I would say that= if the extent of the project is wholly to do with Office objects and= tasks, then VB is a reasonable alternative: it's probably just a= matter of taste and existing skills. However, if the task involves bringing in non-Office data - a scientific instrument, command line optimisation software,= whatever - Python just makes things much easier. As Jeff mentioned, things= like tuples, lists and Python libraries are great "glue" tools. Oh, and if you want to do OOP, VB is really not the best= language, to put it mildly. But that's a different subject, I guess. ;) Cheers, Pijus -- "Anyone attempting to generate random numbers by deterministic= means is, of course, living in a state of sin." -- John Von Neumann From kalle@lysator.liu.se Mon Aug 5 21:09:01 2002 From: kalle@lysator.liu.se (Kalle Svensson) Date: Mon, 5 Aug 2002 22:09:01 +0200 Subject: [Tutor] Problem with modules In-Reply-To: <200208051358.03765.rseguin@shaw.ca> References: <200208051358.03765.rseguin@shaw.ca> Message-ID: <20020805200901.GA6178@i92.ryd.student.liu.se> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [Richard Seguin] > from gui import * > > def TEST(): > print "Option 1" > > gui() ... > When you call the function gui() you would expect that the function > TEST() would be known to gui.py wouldn't you? This may be a newbie > question but the answer for this should put everything into > perspective. No. Each module lives in it's own namespace. Modifications to one does not affect the others. Think of it as dictionaries: __main__ = {} # Start with an empty namespace. # This isn't true for real # modules, but enough for now. __main__.update(get_module('gui')) # from ... import * adds all names # in one module to another. __main__['TEST'] = # def binds a function to a name. __main__['gui']() # Call the function bound to 'gui'. where the get_module function returns a dictionary with the name-value mappings for another module. The dictionary for the 'gui' module is not modified here. You could do something like this: import gui def TEST(): print "Option 1" gui.TEST = TEST gui.gui() but that's not considered good style. Generally, you shouldn't modify other modules' namespaces in this way, it leads to code that is difficult to understand. A better way might be to put the TEST function in another module and import it in gui.py, or to pass it as an argument to the gui function. Peace, Kalle - -- Kalle Svensson, http://www.juckapan.org/~kalle/ Student, root and saint in the Church of Emacs. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.6 iD8DBQE9TttGdNeA1787sd0RAjx0AJ9YxAyRCitj+cvbcvdBNTIvEBY/PwCgpPm8 8g03S+HfNi5QlRYTsi0H36I= =0jkj -----END PGP SIGNATURE----- From lumbricus@gmx.net Mon Aug 5 21:32:49 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Mon, 5 Aug 2002 22:32:49 +0200 (MEST) Subject: [Tutor] what would happen if References: Message-ID: <6584.1028579569@www60.gmx.net> > > > On Mon, 5 Aug 2002, Sean 'Shaleh' Perry wrote: > > > > > On 05-Aug-2002 Kyle Babich wrote: > > > Out of curiosity what would happen if I were let something like: > > > > > > while 1: > > > print "hello" > > > [ snip ] > To make the idea more concrete, let's try something else. Say we do > something like this: > > ### > bathtub = [] > while 1: > bathtub.append("drip") > ### > > Now, instead of leaving things the way they are, we're accumulating drips > in a bathtub. That is, we can tell if we've run this loop more than once, > because the bathtub is growing. This loop is one where we can say that it > uses more and more resources as it runs. Eventually, if we let things > continue, we'll overflow the bathtub! Yes, when *alloc(3) fails, because your virtual memory (the bathtub) is exhausted, python bails out with MemoryError as it should be: $ python eter.py Traceback (innermost last): File "eter.py", line 5, in ? b.append("hello") MemoryError $ > This is sorta handwavy, but I hope the idea makes sense. *grin* > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From kb@mm.st Mon Aug 5 23:01:44 2002 From: kb@mm.st (Kyle Babich) Date: Mon, 5 Aug 2002 22:01:44 UT Subject: [Tutor] Python + MySQL Message-ID: <20020805220144.DE8F3936EB@server2.fastmail.fm> Where can I find a tutorial on Python and MySQL? I searched that docs which returned no result and I did some searches on google and never found anything either. Thank you, -- Kyle From wesc@deirdre.org Mon Aug 5 23:27:03 2002 From: wesc@deirdre.org (Wesley Chun) Date: Mon, 5 Aug 2002 15:27:03 -0700 (PDT) Subject: [Tutor] ANN: Using SNMP with Python (BayPIGgies mtg Wed 8/14) Message-ID: What: Silicon Valley/San Francisco Bay Area Python Users Group (BayPIGgies) When: Wednesday evening, August 14, 2002, 7:30 pm - 9 pm Where: Stanford University, Palo Alto, CA Agenda: Using SNMP with Python: the pyNMS project Speaker: Keith Dart In this talk, we will discuss the pyNMS package -- what's in it, where to find it, and how to use it. The pyNMS package is a collection of Python (and some C) modules for use in network management applications. It is also useful for testing and other types of applications. This package contains a real grab-bag of modules, the most notable are SNMP Management, MIB browsing, XML and XHTML file manipulation, and other miscellaneous modules you may find useful. For more information and dirrections, go to the website: http://www.baypiggies.net hope to see you next week! -wesley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Core Python Programming", Prentice Hall PTR, 2001 http://starship.python.net/crew/wesc/cpp/ Silicon Valley-San Francisco Bay Area Python Users Group (BayPIGgies) http://www.baypiggies.net wesley.j.chun :: wesc at deirdre.org cyberweb.consulting : henderson, nv : cyberweb at rocketmail.com http://roadkill.com/~wesc/cyberweb/ From guillermo.fernandez@epfl.ch Tue Aug 6 00:46:28 2002 From: guillermo.fernandez@epfl.ch (Guillermo Fernandez) Date: Tue, 06 Aug 2002 09:16:28 +0930 Subject: [Tutor] Telnetlib References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7D5@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <3D4F0E54.F6AC5E43@epfl.ch> > If you are on *nix you can use the normal shell > redirection when you invoke the script: > > Bash/Ksh: > > $ python myscript.py 2> errors.txt > > [t]csh is a tad more difficult - ie I can't remember ;-) Actually, it's impossible :-) At least with the > method. In tcsh the only redirection accepted is > to redirect standard output and >& to redirect standard _and_ error output. In http://are.berkeley.edu/mason/computing/help/tutorials/unix/Redirection.html they said: "Some shells allow you to independently redirect standard output and standard error to different files. Unfortunately, our standard interactive shell at ARE, the `tcsh', does not allow this. You can redirect standard output alone, or both standard output and error to the same file, but not to different files." Cheers, Guille From highdesertman@yahoo.com Tue Aug 6 01:25:39 2002 From: highdesertman@yahoo.com (Mathew P.) Date: Mon, 5 Aug 2002 17:25:39 -0700 (PDT) Subject: [Tutor] collecting keyboard input Message-ID: <20020806002539.91439.qmail@web13406.mail.yahoo.com> I understand that this is the place to be a total newbie in confidence :-) Well, here goes. I am writing a python program on linux and most input is parsed from the command line at run time. However, there are a few places in the program where I need to ask the user a question or two mid run. I would like to know what facilities python has for collecting keyboard input and error checking it on the fly (limiting the string length, not allowing numeric imput in string input fields vice/versa and so on.) I was kinda thinking of basic's input and instring functions, but I am quite sure that python has facilities that are *worlds* above anything basic has to offer, since it rocks in every other area! thanks for the help, Mathew ===== In the United States, Gun ownership is *not* a privilege, it is a constitutional right that is under attack continuously. "If gun ownership is outlawed, only outlaws will have Guns" __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From rob@zoism.org Tue Aug 6 01:58:44 2002 From: rob@zoism.org (Rob Brown-Bayliss) Date: 06 Aug 2002 12:58:44 +1200 Subject: [Tutor] Girls, women and Programming (- and Python) In-Reply-To: <3D4C73D9.2000704@aon.at> References: <3D485C3F.3060304@aon.at> <3D4C73D9.2000704@aon.at> Message-ID: <1028595524.28495.11.camel@everglade.zoism.org> On Sun, 2002-08-04 at 12:22, Gregor Lingl wrote: > 1) Why are there so few girl and women interested in programming? > (look, for instance, at the list of partiicipants of all those mailing > lists) It's a silly question, but one that a few years ago I also would have found important... Then I had kids, I have a little girl (4.5 years) and a boy, (3 years). Now, without prompting, or pushing form either of us Zenobie, the girl loves babies, palying dressup and pink things, fairys and stuff. Luke, the boy, loves trains, trucks, diggers and racing cars, breaking things and being rough... Maybe you could rephrase your question, why are there so few men interested in fashion industry? How many men do you know who even contemplate making their own clothes? -- * * Rob Brown-Bayliss * From slime@vsnl.net Sat Aug 3 11:43:12 2002 From: slime@vsnl.net (Prahlad Vaidyanathan) Date: Sat, 3 Aug 2002 16:13:12 +0530 Subject: [Tutor] Re: platform info In-Reply-To: <200208021557.12899.einarth@decode.is> References: <200208021557.12899.einarth@decode.is> Message-ID: <20020803104312.GA2830@localhost.localdomain> --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Fri, 02 Aug 2002 Einar Th. Einarsson spewed into the ether: > Hey gang. >=20 > In my ongoing quest to write truly portable and dynamic code, I need my= =20 > application to be able to gather the following system information at runt= ime: >=20 > CPU info: [-- snippity --] > Information as to how to retrieve any of the above without directly using= =20 > system specific function or system calls would be greatly appreciated.=20 Well, for whatever it is worth, you could check out the 'os' module. eg : """ >>> import os >>> os.getenv("MACHTYPE") 'i586-mandrake-linux-gnu' >>> os.uname() ('Linux', 'localhost.localdomain', '2.4.3-20mdk', '#1 Sun Apr 15 23:03:10 CEST 2001', 'i686') >>> """ HTH, pv. --=20 Prahlad Vaidyanathan It's not enough to be Hungarian; you must have talent too. -- Alexander Korda --AhhlLboLdkugWU4S Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9S7PAIKhjOSElu4YRAoO6AJ93XcK/culnJY5gVfzo12WVNLyVYQCfYSoX ogYYk945bEjqVzn9Y6JcbCY= =42yL -----END PGP SIGNATURE----- --AhhlLboLdkugWU4S-- From lumbricus@gmx.net Tue Aug 6 05:45:26 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Tue, 6 Aug 2002 06:45:26 +0200 (MEST) Subject: [Tutor] Re: Why x+=y instead of x=x+y? References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7A0@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <8758.1028609126@www25.gmx.net> Hello! > > > in it I expect to be able to slow the loop down by changing > > > x++ to x+=1 > > > > I cant get any of my compilers (Digital UNIX Compiler Driver 3.11 > > and gcc) to compile (with -O0 to turn off all optimization) > > i=i+1, i+=i and i++ differently. I just asked the guys at comp.lang.c See Message-ID: > Interesting, I must go do some experimentation when I get > into work tomorrow. It could be a change in the latest > ANSI standard but I hope not, an awful lot of code relies > on those differences! Bad luck :-( > I'm particularly alarmed at i = i + 1 having the same > behaviour since if i is a 'register' variable then that > potentially changes the whole CPU semantics! > > > But they _are_ equivalent IIRC. > > But I don't have a copy of the > > Standard at hand to look it up *wink*. > > The last time I used raw C (as opposed to C++) was > pre ANSI compilers(~1993/4), so the standard may > have changed the rules. I'll check tomorrow... The standard never says _how_ to implement something. This is AKA the "as if rule"(sp?) AFAIK. > > Now I am really courious what compilers You use. > > The Sun Workbench, An HP EPROM programmer and the VAX VMS > standard C compiler. Also occasionally the PSOS and OS/9 > compilers. We also used gcc(v2.something) for one job > cross compiling to a Texas Instruments chip (can't recall > which!) so I'm interested to see gcc in your list. > > Alan G HTH, HAND and Greetings, J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From anandrs@hexaware.com Tue Aug 6 10:19:30 2002 From: anandrs@hexaware.com (Anand Ramakrishna) Date: Tue, 6 Aug 2002 14:49:30 +0530 Subject: [Tutor] Running Python from UNIX Message-ID: <372DD7320F873B43929D49BFF86F950B645A17@cdc1.chennai.corp.hexaware.com> Hi, I am a total newbie to Python. I am just learning it in Solaris environment. I wrote a small function to compute fibonacci series. If I type and run it in the regular line interpreter mode, it runs giving me the correct result. If I write this as a script and execute the script, it runs without errors but does not print the result. If I code the same function as a regular program, then it works as a script too. Could you please tell me, why I am having this problem. Thanks. Anand. From virketis@post.harvard.edu Tue Aug 6 09:46:41 2002 From: virketis@post.harvard.edu (Pijus Virketis) Date: Tue, 6 Aug 2002 11:46:41 +0300 Subject: [Tutor] Python + MySQL In-Reply-To: <20020805220144.DE8F3936EB@server2.fastmail.fm> Message-ID: Kyle, >Where can I find a tutorial on Python and MySQL? You're probably using the Python MySQL module (http://sourceforge.net/projects/mysql-python) to interface with= the database. This module implements a standard DB API-2.0 interface,= insofar as the underlying properties of MySQL permit it. You can= learn about using any module implementing the API here: http://www.amk.ca/python/writing/DB-API.html Cheers, Pijus -- "Anyone attempting to generate random numbers by deterministic= means is, of course, living in a state of sin." -- John Von Neumann From alan.gauld@bt.com Tue Aug 6 11:27:12 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 6 Aug 2002 11:27:12 +0100 Subject: [Tutor] Question about Python and Windows' Apps Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7E1@mbtlipnt02.btlabs.bt.co.uk> > [alan] > >>VBScript or even VBA from within Word to do this kind of thing. > > [jeff] > >Having written (admittedly smallish) scripts to autogenerate Excel > >spreadsheets from flat-file data in both VB and Python, I *much* > >prefer working in Python > the extent of the project is wholly to do with Office objects and > tasks, then VB is a reasonable alternative: it's probably just a Yes, that's what I meant. Once you get into more mixed environments then Python wins every time. But for moving things between Office apps using builtin office commands then VBA or VBScript wins IMHO. > Oh, and if you want to do OOP, VB is really not the > best language, to put it mildly. Up until VB.NET I'd have agreed but VB.NET isn't too bad. A bit verbose mayube but it now has all the necessary features IMHO. Alan G. From anandrs@hexaware.com Tue Aug 6 12:00:15 2002 From: anandrs@hexaware.com (Anand Ramakrishna) Date: Tue, 6 Aug 2002 16:30:15 +0530 Subject: [Tutor] Running Python from UNIX Message-ID: <372DD7320F873B43929D49BFF86F950B6146C4@cdc1.chennai.corp.hexaware.com> Hi Valdas, Thanks a lot. It was an indentation problem as you = correctly guessed. Thanks a lot. I have some confusing questions. 1. From my UNIX command prompt (I am using bash shell), if I type = python, I go to python shell, then when I type=20 print 'Hello World' --> This prints Hello World. When I type print 'Hello World' in a file (say newfile.p), then give execute = permissions for the file and if I type in my UNIX command prompt python newfile.p --> This prints Hello World. When I type python print 'Hello World' in a file and then execute the file. It gives = out an error saying python not found. When I type #! python print 'Hello World' in a file and then execute the file, it = gives out an error saying python not found. When I type from my UNIX command prompt python print 'Hello World' --> This gives an error message saying print = command not found. I am not able to understand this observation. Hope an expert like you = can help me through. Thanks and regards, Anand~ [p.s] - I just visited your website www.if.lt. What is that language. -----Original Message----- From: Valdas Jonikas [mailto:valdas.jonikas@if.lt] Sent: Tuesday, August 06, 2002 4:38 AM To: Anand Ramakrishna Subject: RE: [Tutor] Running Python from UNIX > Hi, > The code is as follows >=20 > def fibonacci (n): > "This function generates fibonacci series" > fib =3D [] > a, b =3D 0, 1 > while b < n: > print b > a, b =3D b, a+b >=20 > fibonacci(100) >=20 > If I execute this code from the command line, the fibonacci=20 > series gets generated but when I put the same as a script=20 > file it does not print the result. But if I dont code it as a=20 > function and just code it as a program like >=20 > n =3D 100 > a, b =3D 0, 1 > while b < n: > print b > a, b =3D b, a+b >=20 > This program as a script prints out the result but the same=20 > program as a function did not print the result. Why is this happening. Hmm..., strange :-\ Do you put an indent before function call? I mean that line fibonacci(100) should be without indents in the beginning, otherwise Python understands this line as a part of function fibonacci. Regards, Valdas From kb@mm.st Tue Aug 6 12:07:45 2002 From: kb@mm.st (Kyle Babich) Date: Tue, 6 Aug 2002 11:07:45 UT Subject: [Tutor] Python + MySQL Message-ID: <20020806110745.23DE593714@server2.fastmail.fm> So the default install of Python 2.2.1 includes no support for mysql? On Tue, 6 Aug 2002 11:46:41 +0300, "Pijus Virketis" said: > Kyle, >=20 > >Where can I find a tutorial on Python and MySQL? >=20 > You're probably using the Python MySQL module > (http://sourceforge.net/projects/mysql-python) to interface with the > database. This module implements a standard DB API-2.0 interface, > insofar as the underlying properties of MySQL permit it. You can > learn about using any module implementing the API here: >=20 > http://www.amk.ca/python/writing/DB-API.html >=20 > Cheers, >=20 > Pijus >=20 >=20 > -- > "Anyone attempting to generate random numbers by deterministic means > is, of course, living in a state of sin." -- John Von Neumann >=20 >=20 >=20 -- Kyle From virketis@post.harvard.edu Tue Aug 6 11:42:44 2002 From: virketis@post.harvard.edu (Pijus Virketis) Date: Tue, 6 Aug 2002 13:42:44 +0300 Subject: [Tutor] Running Python from UNIX In-Reply-To: <372DD7320F873B43929D49BFF86F950B6146C4@cdc1.chennai.corp.hexaware.com> Message-ID: Anand, >[p.s] - I just visited your website www.if.lt. What is that >language. It looks like Lithuanian to me. ;) Cheers, Pijus From virketis@post.harvard.edu Tue Aug 6 11:53:36 2002 From: virketis@post.harvard.edu (Pijus Virketis) Date: Tue, 6 Aug 2002 13:53:36 +0300 Subject: [Tutor] Python + MySQL In-Reply-To: <20020806110745.23DE593714@server2.fastmail.fm> Message-ID: Kyle, >So the default install of Python 2.2.1 includes no support for >mysql? Depends on what you mean by "default". :) PythonWin comes with= the ODBC module standard. So, if you happen to have MyODBC driver (http://www.mysql.com/downloads/api-myodbc-2.50.html) installed= with your MySQL dabatase, you should be able to just go ahead and use= it. I've never worked with MySQL that way, so perhaps someone more knowledgeable will help you here. ;) If you want to just use any Python and MySQL, then you have to= get the module from http://sourceforge.net/projects/mysql-python.= There is really not much to installing it, though, so don't worry. Cheers, Pijus -- "Anyone attempting to generate random numbers by deterministic= means is, of course, living in a state of sin." -- John Von Neumann From marta_andrea@libero.it Tue Aug 6 13:53:54 2002 From: marta_andrea@libero.it (Andrea Valle) Date: Tue, 6 Aug 2002 14:53:54 +0200 Subject: [Tutor] Tkinter-wxPython In-Reply-To: <02e901c238d5$4315b200$0a01a8c0@allah> Message-ID: Dear List, what are the main differences between Tkinter and wxPython? thanks as usual -a- From gwatt3@backbonesecurity.com Tue Aug 6 13:42:27 2002 From: gwatt3@backbonesecurity.com (Watt III, Glenn) Date: Tue, 6 Aug 2002 08:42:27 -0400 Subject: [Tutor] Re: Python + MySQL Message-ID: <94FD5825A793194CBF039E6673E9AFE034D60F@bbserver1.backbonesecurity.com> >>Where can I find a tutorial on Python and MySQL? >>I searched that docs which returned no result and I did some searches >>on google and never found anything either. Ok kyle im pretty new to mysql myself however i have found source forge to have some usefull info as well as this site http://mail.python.org/pipermail/db-sig/2002-March/002336.html at first it will look impossible however it really isnt that bad. You need to have the MySQLdb downloaded as well as having MySQL. The best advice I can give you is to read the above web site and learn the MySQL language its very basic. Using the MySQLdb module is essentially assigning the MySQL commands as a string to some variable and executing that varible. I hope this is of some help! Glenn --__--__-- From dman@dman.ddts.net Tue Aug 6 15:08:22 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Tue, 6 Aug 2002 10:08:22 -0400 Subject: [Tutor] Re: Running Python from UNIX In-Reply-To: <372DD7320F873B43929D49BFF86F950B6146C4@cdc1.chennai.corp.hexaware.com> References: <372DD7320F873B43929D49BFF86F950B6146C4@cdc1.chennai.corp.hexaware.com> Message-ID: <20020806140821.GA31035@dman.ddts.net> --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 06, 2002 at 04:30:15PM +0530, Anand Ramakrishna wrote: | Hi Valdas, | Thanks a lot. It was an indentation problem as you correctly | guessed. Thanks a lot. I have some confusing questions. |=20 | 1. From my UNIX command prompt (I am using bash shell), if I type | python, I go to python shell, then when I type=20 | print 'Hello World' --> This prints Hello World. |=20 | When I type | print 'Hello World' in a file (say newfile.p), then give execute | permissions for the file and if I type in my UNIX command prompt | python newfile.p --> This prints Hello World. |=20 | When I type | python print 'Hello World' in a file and then execute the file. It | gives out an error saying python not found. How are you executing the file? If the file contains exactly ------ python print 'Hello World' ------ And you run it like $ ./foo.py Then you should get this error message : python: can't open file 'print' What happens in this case is bash tries to interpret the script itself since there is no #! line. If 'python' is in $PATH then bash can run python, but python treats those arguments as the names of the files containing the python script. | When I type | #! python print 'Hello World' in a file and then execute the file, | it gives out an error saying python not found. The #! line needs an absolute path, and you must put a line break in between the #! line and the rest of the file. ------ #!/usr/bin/env python print 'Hello World' ------ (There are various tradeoffs in using /usr/bin/env versus /usr/bin/python2.2, but I won't get into that in this thread. If you are interested, take a look in the archives; it was discussed within the last month or two.) | When I type from my UNIX command prompt | python print 'Hello World' --> This gives an error message saying | print command not found. I get this error : $ python print 'Hello World' python: can't open file 'print' for the same reason as above -- python treats those arguments as filenames. If you want to run a one-line script from the command line like that use the -c option : $ python -c "print 'Hellow World'" Hellow World | I am not able to understand this observation. Hope an expert like | you can help me through. HTH, -D --=20 Failure is not an option. It is bundled with the software. =20 http://dman.ddts.net/~dman/ --ikeVEW9yuYc//A+q Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1P2FUACgkQO8l8XBKTpRRJPwCfURD766bpnSbdHVgK8WlP8bz3 2YUAoKWmtoqe6eNJ5r9kWQQfJROn25YL =sgrb -----END PGP SIGNATURE----- --ikeVEW9yuYc//A+q-- From slime@vsnl.net Tue Aug 6 04:24:44 2002 From: slime@vsnl.net (Prahlad Vaidyanathan) Date: Tue, 6 Aug 2002 08:54:44 +0530 Subject: [Tutor] Re: directory size In-Reply-To: <3D4A3B92.4EB1A4EE@ewt.de> References: <3D4A3B92.4EB1A4EE@ewt.de> Message-ID: <20020806032444.GA3391@localhost.localdomain> Hi, On Fri, 02 Aug 2002 Klaus Boehm spewed into the ether: > How can i determine the size of a directory? > In Linux there is a command like " du -hc ." . > Is there a similar way in python. After looking at Danny's code, I thought it would be a neat script to hack up, so I decided to implement this. My first attempt is here : http://www.symonds.net/~prahladv/files/pydu.py It is _very_ basic, but it does the job. HTH, pv. ps. I didn't use os.path.walk() because I find it a tad bit scary :) -- Prahlad Vaidyanathan Reply hazy, ask again later. From alan.gauld@bt.com Tue Aug 6 17:37:41 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 6 Aug 2002 17:37:41 +0100 Subject: [Tutor] Running Python from UNIX Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7E6@mbtlipnt02.btlabs.bt.co.uk> > environment. I wrote a small function to compute fibonacci series. > If I write this as a script and execute the script, > it runs without errors but does not print the result. My guerss is that in the script file you have defined the function but not executed it. ######### foo.py ######## # define function foo def foo(): print 'foo' # now execute it foo() ######## End of foo.py ######## Without the foo() line when you run the script the function foo will be defined but not executed. To allow you to import the script or execute it we usually add the following bit of magic syntax at the end of the file: if __name__ == "__main__": foo() then you can import foo and define but not execute the function or run it as a script in its own right in which case foo() will be executed too. > code the same function as a regular program, > then it works as a script too. Thats because its now not a function so each line gets executed when the file runs. HTH, Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Tue Aug 6 17:46:19 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 6 Aug 2002 17:46:19 +0100 Subject: [Tutor] Tkinter-wxPython Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7E7@mbtlipnt02.btlabs.bt.co.uk> > what are the main differences between Tkinter and wxPython? Tkinter is built on the Tcl/Tk GUI toolkit and wxPython is built on the wxWindows toolkits. They are completely different beasts. Its probably easier to say what they have in common! They both implement the most basisc GUI widgets(labels, buttons, entry boxes, radio buttons, text boxes, menus etc) Otherwise: They both are event driven. wxPython requires you to use an OOP approach Tkinter doesn't. wxPython uses a dispatch table, Tkinter doesn't. wxPython has more widgets (although Tkinter can be augmented via PMW) wxPython has more native look and feel. Tkinter arguably translates into Tcl and Perl more easily. Tkinter has (had?) slightly better support on the Mac. and so it goes on... What specifically are you interested in? Alan G. From rob@uselesspython.com Tue Aug 6 18:12:46 2002 From: rob@uselesspython.com (Rob) Date: Tue, 6 Aug 2002 12:12:46 -0500 Subject: [Tutor] Tkinter-wxPython In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7E7@mbtlipnt02.btlabs.bt.co.uk> Message-ID: Although the original poster did not ask about this, I think there is some benefit to comparing a more broad range of similar offerings to get the full effect. For instance, Jython developers have access to AWT & Swing for GUI development. And even XHTML offers access to textboxes, radiobuttons, checkboxes, etc. Decisions about which path to take in the life of a developer or of any given project will be based on what end results are intended, what resources are available, etc. For the purposes of learning GUI development in general, all of them are handy. Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > alan.gauld@bt.com > Sent: Tuesday, August 06, 2002 11:46 AM > To: marta_andrea@libero.it; tutor@python.org > Subject: RE: [Tutor] Tkinter-wxPython > > > > what are the main differences between Tkinter and wxPython? > > Tkinter is built on the Tcl/Tk GUI toolkit and wxPython > is built on the wxWindows toolkits. They are completely > different beasts. Its probably easier to say what they > have in common! > > They both implement the most basisc GUI widgets(labels, > buttons, entry boxes, radio buttons, text boxes, menus etc) > > Otherwise: > They both are event driven. wxPython requires you to use > an OOP approach Tkinter doesn't. wxPython uses a dispatch > table, Tkinter doesn't. wxPython has more widgets (although > Tkinter can be augmented via PMW) wxPython has more native > look and feel. Tkinter arguably translates into Tcl and > Perl more easily. Tkinter has (had?) slightly better support > on the Mac. and so it goes on... > > What specifically are you interested in? > > Alan G. > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From Alan Colburn" This is a multi-part message in MIME format. ------=_NextPart_000_0028_01C23D3D.CEE7C3B0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable I'm trying to figure something out and I KNOW this must be something = pretty common. ... Basically, what do y'all tend to do when you are entering/saving = information in a dictionary and, the way you've set up your script's = parameters, you could conceivably create key:value combinations with = identical keys (but different values)? I could think of many examples = but, for the sake of concreteness, suppose a medical office is recording = patient visits (patient's name, visit date, other information), using = the patient's name as the key. The rest of the information is the key's = value, perhaps stored in a list. If each visit represents a separate = key:value combination, and a person makes multiple visits to the office, = then ...? As always, thanks ahead of time! -- Al C. ------=_NextPart_000_0028_01C23D3D.CEE7C3B0 Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
I'm trying to figure something out and = I KNOW this=20 must be something pretty common. ...
 
Basically, what do y'all tend to do = when you are=20 entering/saving information in a dictionary and, the way you've set up = your=20 script's parameters, you could conceivably create key:value combinations = with=20 identical keys (but different values)? I could think of many = examples but,=20 for the sake of concreteness, suppose a medical office is recording = patient=20 visits (patient's name, visit date, other information), using the = patient's name=20 as the key. The rest of the information is the key's value, perhaps = stored in a=20 list. If each visit represents a separate key:value combination, and a = person=20 makes multiple visits to the office, then ...?
 
As always, thanks ahead of time! -- Al=20 C.
------=_NextPart_000_0028_01C23D3D.CEE7C3B0-- From jeff@ccvcorp.com Tue Aug 6 20:03:52 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Tue, 06 Aug 2002 12:03:52 -0700 Subject: [Tutor] Dictionary Keys References: <002b01c23d78$7b7796c0$cae68b86@fo5132> Message-ID: <3D501D98.F7A6E060@ccvcorp.com> Alan Colburn wrote: > Basically, what do y'all tend to do when you are entering/saving > information in a dictionary and, the way you've set up your script's > parameters, you could conceivably create key:value combinations with > identical keys (but different values)? I could think of many > examples but, for the sake of concreteness, suppose a medical office > is recording patient visits (patient's name, visit date, other > information), using the patient's name as the key. The rest of the > information is the key's value, perhaps stored in a list. If each > visit represents a separate key:value combination, and a person > makes multiple visits to the office, then ...? Well, to a large degree it depends on the specific application, but a common idiom is to use a list of values if there is more than one value for a given key. Something like KeyA : ValueA KeyB : [ValueB1, ValueB2, ValueB3] KeyC : ValueC In your example above, each value is a list of visit-specific information. (I'd use class instances rather than lists for this, or at least tuples, but that's another issue.) So KeyB would point to a list of visit-lists. Jeff Shannon Technician/Programmer Credit International From ak@silmarill.org Tue Aug 6 20:40:09 2002 From: ak@silmarill.org (Andrei Kulakov) Date: Tue, 6 Aug 2002 15:40:09 -0400 Subject: [Tutor] collecting keyboard input In-Reply-To: <20020806002539.91439.qmail@web13406.mail.yahoo.com> References: <20020806002539.91439.qmail@web13406.mail.yahoo.com> Message-ID: <20020806194009.GA292@ak.silmarill.org> On Mon, Aug 05, 2002 at 05:25:39PM -0700, Mathew P. wrote: > I understand that this is the place to be a total newbie in confidence > :-) > > Well, here goes. > > I am writing a python program on linux and most input is parsed from > the command line at run time. > > However, there are a few places in the program where I need to ask the > user a question or two mid run. > > I would like to know what facilities python has for collecting keyboard > input and error checking it on the fly (limiting the string length, not > allowing numeric imput in string input fields vice/versa and so on.) I > was kinda thinking of basic's input and instring functions, but I am > quite sure that python has facilities that are *worlds* above anything > basic has to offer, since it rocks in every other area! > > thanks for the help, > > Mathew You ought to use raw_input() and then manually check if it's not too long, if it's got numbers or chars in it, etc. > > ===== > In the United States, Gun ownership is *not* a privilege, it is a constitutional right that is under attack continuously. > > "If gun ownership is outlawed, only outlaws will have Guns" > > __________________________________________________ > Do You Yahoo!? > Yahoo! Health - Feel better, live better > http://health.yahoo.com > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Cymbaline: intelligent learning mp3 player: python, linux, console. get it at: http://silmarill.org/cymbaline.htm From kb@mm.st Tue Aug 6 21:07:48 2002 From: kb@mm.st (Kyle Babich) Date: Tue, 6 Aug 2002 20:07:48 UT Subject: [Tutor] TimeTracker Message-ID: <20020806200748.8D553936F1@server2.fastmail.fm> For those of you who remember TimeTracker, I've begun rewriting my first and only program for v0.1.0. I'm getting this error: Traceback (most recent call last): File "C:\WINDOWS\Desktop\TimeTracker\TimeTracker_0_1_0.py", line 65, in ? sleep( tosleep ) File "C:\WINDOWS\Desktop\TimeTracker\TimeTracker_0_1_0.py", line 22, in sleep int (sleeptime) ValueError: int() literal too large: 111111111111111111111111111111111111111111111111111111111111 The problem seems to be where I am declaring the input an integer and then putting the integer into the function, but once again I'm not sure how to change this and make it work. Here is the complete program: ##################################################### #! C:\Python22\python import time, sys def sleep(a): currtime =3D time.strftime( "%I:%M:%S%p %Z" ) print "Current time: %(currtime)s" % vars() begin =3D raw_input( "Begin tracking? [Y/N]: " ) if begin.lower() in "y yes".split(): logcurrtime =3D open( "log.dat", "aa" ) logcurrtime.write( " [Current Time: %(currtime)s]" % vars() ) logcurrtime.close() int (a) sleeptime =3D a * 60 int (sleeptime) =20 logsleeptime =3D open( "log.dat", "aa" ) logsleeptime.write( " [Sleep Time: %(sleeptime)s Mins.]" % vars() ) logsleeptime.close() =20 time.sleep( sleeptime ) print "Set Time Complete" comptime =3D time.strftime( "%I:%M:%S%p %Z" ) logcomptime =3D open( "log.dat", "aa" ) logcomptime.write( " [Time Completed: %(comptime)s]" % vars() ) logcomptime.close() =20 print "Completed at %(comptime)s." % vars() print "This window will close in 60 seconds." time.sleep(60) sys.exit() =20 if begin.lower in "n no".split(): print "FAILED" print "This window will close in 60 seconds." =20 time.sleep( 60 ) sys.exit() name =3D raw_input( "Please type your name: " ) logname =3D open( "log.dat", "aa" ) logname.write( "[Name: %(name)s]" % vars() ) logname.close() if name.lower() in "kyle jason chelsea john cheryl".split(): while 1: print tosleep =3D raw_input( "Enter time to sleep in minutes: " ) =20 confirm =3D raw_input( "Confirm %(tosleep)s minutes [Y/N]: " % vars() ) =20 if confirm.lower() in "y yes".split(): int( tosleep ) sleep( tosleep ) else: print "FAILED" print "This window will close in 60 seconds." =20 time.sleep( 60 ) sys.exit() ########################################################## Thank you, -- Kyle From glingl@aon.at Tue Aug 6 21:16:23 2002 From: glingl@aon.at (Gregor Lingl) Date: Tue, 06 Aug 2002 22:16:23 +0200 Subject: [Tutor] Dictionary Keys References: <002b01c23d78$7b7796c0$cae68b86@fo5132> Message-ID: <3D502E97.8060902@aon.at> Alan Colburn schrieb: > I'm trying to figure something out and I KNOW this must be something > pretty common. ... > > Basically, what do y'all tend to do when you are entering/saving > information in a dictionary and, the way you've set up your script's > parameters, you could conceivably create key:value combinations with > identical keys (but different values)? I could think of many examples > but, for the sake of concreteness, suppose a medical office is > recording patient visits (patient's name, visit date, other > information), using the patient's name as the key. The rest of the > information is the key's value, perhaps stored in a list. If each > visit represents a separate key:value combination, and a person makes > multiple visits to the office, then ...? > > As always, thanks ahead of time! -- Al C. Unconventionally I give you a reference to http://www.oreilly.com/catalog/pythoncook/chapter/ There you find a link to the sample Chapter 1 of the Python Cookbook.(PDF) If all of the book is as well done as this first Chapter it is a must-buy I think! Section 1.5 is: Associating Multiple Values with Each Key in a Dictionary I certainly couldn't give you an explanation, which surpasses this one Regards, Gregor From glingl@aon.at Tue Aug 6 21:51:08 2002 From: glingl@aon.at (Gregor Lingl) Date: Tue, 06 Aug 2002 22:51:08 +0200 Subject: [Tutor] TimeTracker References: <20020806200748.8D553936F1@server2.fastmail.fm> Message-ID: <3D5036BC.6020602@aon.at> Kyle Babich schrieb: >For those of you who remember TimeTracker, I've begun rewriting my >first and only program for v0.1.0. > >I'm getting this error: >Traceback (most recent call last): > File "C:\WINDOWS\Desktop\TimeTracker\TimeTracker_0_1_0.py", line 65, > in ? > sleep( tosleep ) > File "C:\WINDOWS\Desktop\TimeTracker\TimeTracker_0_1_0.py", line 22, > in sleep > int (sleeptime) >ValueError: int() literal too large: >111111111111111111111111111111111111111111111111111111111111 > > Remark 1: Functioncalls like int(sleeptime) as well as int(a) compute some value, but then do not assign them ro same variable or use them further in some expression. Instead those values ar thrown away. This means the don't make sense and have to be replaced by something like tosleep = int(tosleep) Remark 1: The special error in your program occurs because - apparantly a has the value "1" - in line 19 int("1") is called, constructs 1 and leaves it somewhwew in memory - in line 20, sleeptime becomes 60'*"1" which equals "111111111111111111111111111111111111111111111111111111111111" as the errormessage reports. now the equally senseless call int("111111111111111111111111111111111111111111111111111111111111") fails because this literal connot be converted to an integer (as it is larger than 2**31-1) had you written a = int(a) sleeptime = a * 60 the intended conversion sleeptime = int(sleeptime) was not necessary at all, as sleeptime is already an int Tip: think about the difference of statements and expressions And about the fact, that a script is a sequence of statements. (... and about the use of function-calls as statements for their side-effects to be performed ... - I think, not so simple, this ...) Gregor >The problem seems to be where I am declaring the input an integer and >then putting the integer into the function, but once again I'm not sure >how to change this and make it work. > >Here is the complete program: > >##################################################### > >#! C:\Python22\python > >import time, sys > >def sleep(a): > currtime = time.strftime( "%I:%M:%S%p %Z" ) > print "Current time: %(currtime)s" % vars() > > begin = raw_input( "Begin tracking? [Y/N]: " ) > > if begin.lower() in "y yes".split(): > logcurrtime = open( "log.dat", "aa" ) > logcurrtime.write( " [Current Time: %(currtime)s]" % vars() ) > logcurrtime.close() > > int (a) > sleeptime = a * 60 > int (sleeptime) > > logsleeptime = open( "log.dat", "aa" ) > logsleeptime.write( " [Sleep Time: %(sleeptime)s Mins.]" % > vars() ) > logsleeptime.close() > > time.sleep( sleeptime ) > print "Set Time Complete" > > comptime = time.strftime( "%I:%M:%S%p %Z" ) > > logcomptime = open( "log.dat", "aa" ) > logcomptime.write( " [Time Completed: %(comptime)s]" % vars() > ) > logcomptime.close() > > print "Completed at %(comptime)s." % vars() > print "This window will close in 60 seconds." > > time.sleep(60) > sys.exit() > > if begin.lower in "n no".split(): > print "FAILED" > print "This window will close in 60 seconds." > > time.sleep( 60 ) > sys.exit() > >name = raw_input( "Please type your name: " ) > >logname = open( "log.dat", "aa" ) >logname.write( "[Name: %(name)s]" % vars() ) >logname.close() > >if name.lower() in "kyle jason chelsea john cheryl".split(): > while 1: > print > tosleep = raw_input( "Enter time to sleep in minutes: " ) > > confirm = raw_input( "Confirm %(tosleep)s minutes [Y/N]: " % > vars() ) > > if confirm.lower() in "y yes".split(): > int( tosleep ) > sleep( tosleep ) > >else: > print "FAILED" > print "This window will close in 60 seconds." > > time.sleep( 60 ) > sys.exit() > >########################################################## > >Thank you, >-- >Kyle > >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > > > > From kemu@linuxmail.org Tue Aug 6 22:02:54 2002 From: kemu@linuxmail.org (Jonas Geiregat) Date: Wed, 07 Aug 2002 05:02:54 +0800 Subject: [Tutor] tkinter browser ? Message-ID: <20020806210255.7786.qmail@linuxmail.org> how can I make a simple browser using maybe other browser setting like IE ? with TKinter ? any tips starting points tutorial articles would be welcome -- Get your free email from www.linuxmail.org Powered by Outblaze From dyoo@hkn.eecs.berkeley.edu Tue Aug 6 22:24:13 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Tue, 6 Aug 2002 14:24:13 -0700 (PDT) Subject: [Tutor] Dictionary Keys In-Reply-To: <3D501D98.F7A6E060@ccvcorp.com> Message-ID: On Tue, 6 Aug 2002, Jeff Shannon wrote: > Alan Colburn wrote: > > > Basically, what do y'all tend to do when you are entering/saving > > information in a dictionary and, the way you've set up your script's > > parameters, you could conceivably create key:value combinations with > > identical keys (but different values)? As another example, we can use a language dictionary. A word may have several definitions based on context. For example, the simple-looking word "set" is both a noun and a verb, and, even as a noun, it has multiple definitions based on context. "I am trying to complete my set of Pokemon trading cards." "The set of prime numbers, excluding two, consists of odd numbers." "Set that turkey aside, near the pumpkin." > > for the sake of concreteness, suppose a medical office is recording > > patient visits (patient's name, visit date, other information), using > > the patient's name as the key. The rest of the information is the > > key's value, perhaps stored in a list. If each visit represents a > > separate key:value combination, and a person makes multiple visits to > > the office, then ...? > > Well, to a large degree it depends on the specific application, but a > common idiom is to use a list of values if there is more than one > value for a given key. Something like > > KeyA : ValueA > KeyB : [ValueB1, ValueB2, ValueB3] > KeyC : ValueC To make the code cleaner, we often force the situation that the values are always lists, even lists of length one: ### KeyA: [ValueA] KeyB: [ValueB1, ValueB2, ValueB3] KeyC: [ValueC] ### Although this seems a little wasteful, it turns out that it lets us avoid writing a special case that handles the storage of just one value. We can say that our dictionary maps patient names to their "visit history", and assume that the visit history is always a list of their visits. Talk to you later! From dyoo@hkn.eecs.berkeley.edu Tue Aug 6 22:41:44 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Tue, 6 Aug 2002 14:41:44 -0700 (PDT) Subject: [Tutor] TimeTracker [revising Python code] In-Reply-To: <20020806200748.8D553936F1@server2.fastmail.fm> Message-ID: Hi Kyle, One other comment about your code: > #! C:\Python22\python > > import time, sys > > def sleep(a): > currtime = time.strftime( "%I:%M:%S%p %Z" ) > print "Current time: %(currtime)s" % vars() > > begin = raw_input( "Begin tracking? [Y/N]: " ) > > if begin.lower() in "y yes".split(): > logcurrtime = open( "log.dat", "aa" ) > logcurrtime.write( " [Current Time: %(currtime)s]" % vars() ) > logcurrtime.close() > > int (a) > sleeptime = a * 60 > int (sleeptime) > > logsleeptime = open( "log.dat", "aa" ) > logsleeptime.write( " [Sleep Time: %(sleeptime)s Mins.]" % > vars() ) > logsleeptime.close() > > time.sleep( sleeptime ) > print "Set Time Complete" > > comptime = time.strftime( "%I:%M:%S%p %Z" ) > > logcomptime = open( "log.dat", "aa" ) > logcomptime.write( " [Time Completed: %(comptime)s]" % vars() > ) > logcomptime.close() > > print "Completed at %(comptime)s." % vars() > print "This window will close in 60 seconds." > > time.sleep(60) > sys.exit() > > if begin.lower in "n no".split(): > print "FAILED" > print "This window will close in 60 seconds." > > time.sleep( 60 ) > sys.exit() It might be good to split off sleep() into two separate functions, one to handle the 'yes' case, and another to handle the 'no' case. Let's see what this might look like: ### def sleep(a): currtime = time.strftime( "%I:%M:%S%p %Z" ) print "Current time: %(currtime)s" % vars() begin = raw_input( "Begin tracking? [Y/N]: " ) if begin.lower() in "y yes".split(): sleepYes(a) if begin.lower in "n no".split(): sleepNo(a) def sleepYes(a): logcurrtime = open( "log.dat", "aa" ) logcurrtime.write( " [Current Time: %(currtime)s]" % vars() ) logcurrtime.close() int (a) sleeptime = a * 60 int (sleeptime) logsleeptime = open( "log.dat", "aa" ) logsleeptime.write( " [Sleep Time: %(sleeptime)s Mins.]" % vars() ) logsleeptime.close() time.sleep( sleeptime ) print "Set Time Complete" comptime = time.strftime( "%I:%M:%S%p %Z" ) logcomptime = open( "log.dat", "aa" ) logcomptime.write( " [Time Completed: %(comptime)s]" % vars()) logcomptime.close() print "Completed at %(comptime)s." % vars() print "This window will close in 60 seconds." time.sleep(60) sys.exit() def sleepNo(a): print "FAILED" print "This window will close in 60 seconds." time.sleep( 60 ) sys.exit() ### One advantage of breaking down a function into smaller pieces is that it becomes easier to look for places where parallelism breaks down. For example, now that sleep() is smaller, we can more easily pick out a small bug in the second case, where we check if 'begin' is 'no': ### within sleep()'s definition: if begin.lower() in "y yes".split(): sleepYes(a) if begin.lower in "n no".split(): ## <-- buggy sleepNo(a) ### This particular technique of breaking things down into smaller pieces is also particularly useful in Python because it helps reduce block indentation. Python programmers think more about how to simplify and split off smaller functions and methods because we simply have no choice: the code otherwise becomes far too indented to work with. *grin* Hope this helps! From hall@nhn.ou.edu Tue Aug 6 22:48:36 2002 From: hall@nhn.ou.edu (Isaac Hall) Date: Tue, 6 Aug 2002 16:48:36 -0500 Subject: [Tutor] tkinter browser ? In-Reply-To: <20020806210255.7786.qmail@linuxmail.org>; from kemu@linuxmail.org on Tue, Aug 06, 2002 at 16:02:54 -0500 References: <20020806210255.7786.qmail@linuxmail.org> Message-ID: <20020806164836.K28571@ouhep1.nhn.ou.edu> hi, now I don't know if it uses Tkinter or not, but I know there is a browser written in python already out there called Grail. (at least I think thats what it is called, its been a long time since I heard anything about it.) you maybe could start by simply looking at what they have done. Ike On 2002.08.06 16:02 Jonas Geiregat wrote: > how can I make a simple browser > using maybe other browser setting like IE ? > with TKinter ? > any tips starting points tutorial articles would be welcome > > > -- > Get your free email from www.linuxmail.org > > > Powered by Outblaze > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From stevebruce7@hotmail.com Tue Aug 6 23:57:20 2002 From: stevebruce7@hotmail.com (steven bruce) Date: Tue, 06 Aug 2002 23:57:20 +0100 Subject: [Tutor] Inexperienced fool Message-ID: Hi I know nothing about programming except a bit of HTML. I am trying to do a couple of hours each night trying to learn Python. I am doing the modules in the beginners section and cant for the life of me get a password guessing programme to keep track of how many times the wrong password has been entered. help would be greatly appreciated. very embarrassed Steve _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx From dyoo@hkn.eecs.berkeley.edu Wed Aug 7 01:33:53 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Tue, 6 Aug 2002 17:33:53 -0700 (PDT) Subject: [Tutor] Re: Python resources (fwd) Message-ID: ---------- Forwarded message ---------- Date: Mon, 5 Aug 2002 11:11:49 -0700 (PDT) From: Danny Yoo To: Ron Nixon Subject: Re: Python resources On Mon, 5 Aug 2002, Ron Nixon wrote: > > Danny: > Do you know of any good resources for using Python for text processing. > In my job I encounter all sorts of data that needs to be processed > before I can use it and would like to have some practical examples of > how Python can be used to do this. Hi Ron, Do you mind if I foward this off to the Tutor list instead? I think that your question would interest people there who do lots of text processing. In the meantime, you may be interested in: http://gnosis.cx/TPiP/ I haven't read this yet, but it caught my eye. From rob@uselesspython.com Wed Aug 7 01:58:06 2002 From: rob@uselesspython.com (Rob) Date: Tue, 6 Aug 2002 19:58:06 -0500 Subject: [Tutor] Inexperienced fool In-Reply-To: Message-ID: First-off, there's no need to self-deprecate in this forum. And spending a couple of hours nightly on Python is nothing to be sniffed at. We'll be glad to help out. Do you care to show what you have on it so far? Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > steven bruce > Sent: Tuesday, August 06, 2002 5:57 PM > To: tutor@python.org > Subject: [Tutor] Inexperienced fool > > > Hi > > I know nothing about programming except a bit of HTML. I am > trying to do a > couple of hours each night trying to learn Python. I am doing > the modules > in the beginners section and cant for the life of me get a > password guessing > programme to keep track of how many times the wrong password has been > entered. > help would be greatly appreciated. > very embarrassed > > Steve > > > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From magnus@thinkware.se Wed Aug 7 03:36:51 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 07 Aug 2002 04:36:51 +0200 Subject: [Tutor] Tkinter-wxPython In-Reply-To: References: <02e901c238d5$4315b200$0a01a8c0@allah> Message-ID: <5.1.0.14.0.20020806163501.02802570@www.thinkware.se> At 14:53 2002-08-06 +0200, Andrea Valle wrote: >Dear List, >what are the main differences between Tkinter and wxPython? Tkinter is a standard Python module. wxPython is not, so you rely on a third party library. wxPython is more full featured, with grid controls etc. With Tkinter, you are likely to need extensions, such as Python Mega Widgets (pmw), if you do anything substancial. So you will probably come to rely on third party libraries anyway. If you just need a simple GUI, Tkinter has a clear advantage of making it easier to deploy your application. No need to install anything extra, just std Python and your code. Tkinter is based on a GUI toolkit called Tk, which is made for an interpreted language called Tcl. It's not very fast. wxPython is based on a C++ GUI toolkit called wxWindows. It's typically somewhat faster. I imagine the difference is more noticable for the advanced controls, since these will be written in Python for Tkinter (pmw etc) but in C++ for wxPython. Also, there are books with Tkinter coverage, first of all, "Python and Tkinter Programming". There are also a number of books on Tcl/Tk that might be of use for the Tkinter programmer. There is little wxPython documentation. It comes with the wxWindows C++ based documentation with a few notes about differences in the Python version. Also, the wxWindows docs aren't kept entirely updated, and wxWindows / wxPython is growing and changing quite a bit. There are good demos that give examples of most features though. There are plenty of users for both toolkits. I don't know if there is any such thing as a "Tkinter community" since Tkinter is a standard module. There are obviously both books, internet resources and people on the net that might be of help. For wxPython, there is a site www.wxpython.org, and a mailing list where the lead developer Robin Dunn and many other wxPython programmers provide a lot of help to programmers. wxPython and wxWindows is being much more actively developed than Tcl/Tk and Tkinter. Whether that is good of bad is for you to judge. Tcl/Tk is fairly mature (if, as I wrote, somewhat lacking of advanced controls). wxPython is concidered important by the wxWindows developers, while I don't think the Tcl/Tk developers (are there still any?) care a bit about making Python users happy. I think Tkinter works on a few more platforms than wxPython. But wxPython works well on Windows, Linux and a number of Unix dialects at least. I'm uncertain about the current status of the Mac port. Python Programming on Win32 by Mark Hammond & Andy Robinson has a chapter on GUI programming which covers both. It's online: http://www.oreilly.com/catalog/pythonwin32/chapter/ch20.html There you can see code examples with both. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From magnus@thinkware.se Wed Aug 7 04:42:33 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 07 Aug 2002 05:42:33 +0200 Subject: [Tutor] Dictionary Keys In-Reply-To: <002b01c23d78$7b7796c0$cae68b86@fo5132> Message-ID: <5.1.0.14.0.20020807044202.027f9470@www.thinkware.se> At 11:38 2002-08-06 -0700, Alan Colburn wrote: >Basically, what do y'all tend to do when you are entering/saving=20 >information in a dictionary and, the way you've set up your script's=20 >parameters, you could conceivably create key:value combinations with=20 >identical keys (but different values)? I could think of many examples but,= =20 >for the sake of concreteness, suppose a medical office is recording=20 >patient visits (patient's name, visit date, other information), using the= =20 >patient's name as the key. The rest of the information is the key's value,= =20 >perhaps stored in a list. If each visit represents a separate key:value=20 >combination, and a person makes multiple visits to the office, then ...? But you would never use a real world value such as a name for keys in your application or database. Would you??? http://www.ambysoft.com/mappingObjects.html and http://www.thinkware.se/cgi-bin/thinki.cgi/CaseStudyUnbrokenSeries are a few places that gives examples to why it's a bad thing to use keys with business meaning in computer systems. They explicitly discuss relational databases, but it's relevant in your python code as well. In short, even in you find keys that are unique, basically ANY value with business meaning that could be used as a key might change sooner or later. Social security numbers, phone numbers, names, article numbers, zip codes... Having to change a key value is normally much more work than to change just an attribute. Also, you might run into situations where you realize that your key won't work. Phone numbers get longer than you predicted or some people don't have a phone. You internationalize your app and social security numbers don't exist in some countries etc. If a value is used as a key somewhere in the system, all other parts of your program that refer to that entity will store that key. This means that redesigning a key field is much more work than redesigning a plain attribute which is only located in one place. (As you might guess, I've gone through this a few times.) Returning to your example, one could imagine something like this: persons =3D {} ... # Creating a person person_id =3D get_a_new_unique_id_somehow() persons[person_id] =3D {'name' : "Will Smith", 'visits' : {} } ... # Adding info on a visit visit_id =3D get_a_new_unique_id_somehow() persons[person_id]['visits'][visit_id] =3D ( '2002-08-08 12:45', 'Dr Burns', 'Regular Checkup', 'Blah blah') No, I don't think you will use hard coded values like this in your actual program. ;-) Obviously, your users won't be able to just type in the key values in your dict here, since they are values that doesn't mean anything. (Naturally, these abstract ids should not be visible to the user of the system. They should only see the data with a business meaning.) But it's not very meaningful to discuss how this should be done unless we consider how you store your data. The solution will probably differ if you use a relational database or a flat text file for instance. Either way, your program will have to be able to handle the case where your user doesn't know the exact value for a key, but will want to do an approximate search, or browse your data. So you won't save a lot of code in a real program on using real world keys. If you insist (suit yourself) on keying on business data you'd get something like: persons =3D {} ... # Creating a person persons["Will Smith"] =3D {'visits' : {}} ... # Add info on a visit persons["Will Smith"]['visits']['2002-08-08 12:45'] =3D ('Dr Burns',= 'Regular=20 Checkup', 'Blah blah') --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From anandrs@hexaware.com Wed Aug 7 04:51:21 2002 From: anandrs@hexaware.com (Anand Ramakrishna) Date: Wed, 7 Aug 2002 09:21:21 +0530 Subject: [Tutor] Running Python from UNIX Message-ID: <372DD7320F873B43929D49BFF86F950B645A1E@cdc1.chennai.corp.hexaware.com> This is a multi-part message in MIME format. ------_=_NextPart_001_01C23DC5.B17E5B18 Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01C23DC5.B17E5B18" ------_=_NextPart_002_01C23DC5.B17E5B18 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, I wanted to run a single line script from the command line. I = typed from the UNIX command prompt python -c print 'Hello World' . = This did not give any error message. It got executed but did not print = out the result. Could anyone tell me what is happening. I did not = install python in /usr/bin like others. It is installed in my home = directory. In my .bashrc file I have aliased python to the python = executable that gets created after the istallation. Could this be a = problem ? =20 Thanks and regards, Anand~ ------_=_NextPart_002_01C23DC5.B17E5B18 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello,
       &nbs= p; =20 I wanted to run a single line script from the command line. I typed from = the=20 UNIX command prompt  python -c print 'Hello World'  . This did = not=20 give any error message. It got executed but did not print out the = result. Could=20 anyone tell me what is happening. I did not install python in /usr/bin = like=20 others. It is installed in my home directory. In my .bashrc file I have = aliased=20 python to the python executable that gets created after the istallation. = Could=20 this be a problem ?
 
Thanks and=20 regards,
Anand~
------_=_NextPart_002_01C23DC5.B17E5B18-- ------_=_NextPart_001_01C23DC5.B17E5B18 Content-Type: image/jpeg; name="SeaMarbl.jpg" Content-Transfer-Encoding: base64 Content-ID: <640191216@07082002-1ba6> Content-Description: SeaMarbl.jpg Content-Location: SeaMarbl.jpg /9j/4AAQSkZJRgABAgEASABIAAD/7QReUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQABOEJJTQPzAAAAAAAIAAAAAAAAAAA4QklNBAoAAAAAAAEAADhCSU0nEAAAAAAACgAB AAAAAAAAAAI4QklNA/UAAAAAAEgAL2ZmAAEAbGZmAAYAAAAAAAEAL2ZmAAEAoZmaAAYAAAAAAAEA MgAAAAEAWgAAAAYAAAAAAAEANQAAAAEALQAAAAYAAAAAAAE4QklNA/gAAAAAAHAAAP////////// //////////////////8D6AAAAAD/////////////////////////////A+gAAAAA//////////// /////////////////wPoAAAAAP////////////////////////////8D6AAAOE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yvqL/xLGSsG8sf7wN/rn9QwyclOcgrsVdirsVdirsVd irsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdi rsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdir sVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdir/9Hpdwv7xv8AWzLD iINvhb/iWTCoaRfiX4viX7LeOS4WRipXSq3+S2PEwMkA0jR/tf62S4UcKl63+yXHhXhUZo1+0vwt /NkiyJUo1/fQt/xYv/EsgWslgnlj/eBv9c/qGWScxOcgrsVdirsVdirsVdirsVdirsVdirsVdirs VdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsV dirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVd irsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdir//0umTepyb4eS8vs5lhxEJIvLJhUJNyXl/ L/LkuJkZKDScftY8LAxQ0yq3xL9rJcSOJDSKvL4vhb/J6Y8S8Si38rfZ/myRYkrI/wC8h/4yL/xL IFgSwLyx/vA3+uf1DLJOenOQV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2 KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2K uxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Ku xV2KuxV2KuxV2KuxV2KuxV//0+m3XLk3xfzZlRcKSDZfh/yv2csCxQ0y/Eq/zYQoQU3w/F/w2TDY EMzMv+t/NhCqTfFkgqGkaRfsthDEKdu3KaNf+LF/4llcmEmDeWP94G/1z+oZOTlpzkFdirsVdirs VdirsVdirsVdirsVdirsVdirs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uxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Ku xV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kux V2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kv/9fp83Hk3+y45khw0G+677ZYFQ9RSjAU 8cQqDbl6n7n7WTCoaT+8X08IShpOPqfu/wDZZMKgrjj/ALLJhkVtv/fQ8vteov8AxLISaywjyx/v A3+uf1DDJyk5yCuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kux V2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV 2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2 KuxV2KuxV2Kv/9k= ------_=_NextPart_001_01C23DC5.B17E5B18-- From magnus@thinkware.se Wed Aug 7 04:56:53 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 07 Aug 2002 05:56:53 +0200 Subject: [Tutor] tkinter browser ? In-Reply-To: <20020806164836.K28571@ouhep1.nhn.ou.edu> References: <20020806210255.7786.qmail@linuxmail.org> <20020806210255.7786.qmail@linuxmail.org> Message-ID: <5.1.0.14.0.20020807054550.028b3878@www.thinkware.se> At 16:48 2002-08-06 -0500, Isaac Hall wrote: >hi, >now I don't know if it uses Tkinter or not, but I know there is a browser >written in python already out there called Grail. (at least I think thats >what it is called, its been a long time since I heard anything about it.) Grail is certainly a Tkinter app, but it's very outdated, I doubt that it runs with anything newer than Python 1.4. I don't think it's anything to dig into unless you are an experienced python programmer with plenty of time... I don't know of any suitable controls to make a simple (I presume web-) browser with Tkinter. For wxPython there is the wxHtmlWindow that can render simple HTML. I guess there are Gtk and KDE widgets as well, that can be reached from Python through some kind of tool kits. Not Tkinter though. I'm not sure what the purpose of making yet another browser is, but it might be more appropriate to try to communicate with an existing browser such as IE through COM etc. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From guillermo.fernandez@epfl.ch Wed Aug 7 05:20:13 2002 From: guillermo.fernandez@epfl.ch (Guillermo Fernandez) Date: Wed, 07 Aug 2002 13:50:13 +0930 Subject: [Tutor] Running Python from UNIX References: <372DD7320F873B43929D49BFF86F950B645A1E@cdc1.chennai.corp.hexaware.com> Message-ID: <3D509FFD.885F903C@epfl.ch> > Hello, Hi! > I wanted to run a single line script from the command line. > I typed from the UNIX command prompt python -c print 'Hello World' . > This did not give any error message. It got executed but did not print > out the result. Could anyone tell me what is happening. I did not > install python in /usr/bin like others. It is installed in my home > directory. In my .bashrc file I have aliased python to the python > executable that gets created after the istallation. Could this be a > problem ? No The problem is the fact that the command line will read the next token after the -c she sees. In the case >>> python -c print "hello" the token is 'print', so he will execute print. You should do like: >>> python -c "print 'hello'" hello and it will work, because the shell will take "print 'hello'" as the token to interpret. Guille From idiot1@netzero.net Wed Aug 7 05:49:23 2002 From: idiot1@netzero.net (Kirk Bailey) Date: Wed, 07 Aug 2002 00:49:23 -0400 Subject: [Tutor] fnord Message-ID: <3D50A6D3.D81162BF@netzero.net> OK, it just came across my CRT that people scrape emails off of publicly accessible archives, for later spamming. Hmmm, interesting. I may write a subroutine that MUNGS the submitter's email address when writing it to the archive, in a way that HUMAN intelligence could easily detect and correct, but which should fry a poor bot's MIND. Discussion? -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com From idiot1@netzero.net Wed Aug 7 06:00:57 2002 From: idiot1@netzero.net (Kirk Bailey) Date: Wed, 07 Aug 2002 01:00:57 -0400 Subject: [Tutor] self finding Message-ID: <3D50A989.4961C4F5@netzero.net> ok, someone a LONG time ago wrote how to get the script to FIND the interpreter. Do not now have that message thanks to a HDD failure. although it might take a script longer to start, this is a major feature if you want to make it EASIER THAN PIE to install and use. Anyone a real un*x maven who would care to address how to do this- and it was all on ONE LINE, a number of interesting characters were in it, some escape stuff, beat me now, working from memory. any clues? -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com From idiot1@netzero.net Wed Aug 7 06:08:05 2002 From: idiot1@netzero.net (Kirk Bailey) Date: Wed, 07 Aug 2002 01:08:05 -0400 Subject: [Tutor] Inexperienced fool References: Message-ID: <3D50AB35.6EF580CB@netzero.net> Na, ya came to the right place, best support community this side of Ceres Polytechnic University. Took me from a perfect idiot to idiot first class in a mere 6 weeks. 1. Wander around http://www.python.org/ a bunch. Read the newbie stuff, get confused, read more, pop a breaker, walk away a little, come back, read some more. Ask questions here. 2. Install IDLE in your PC. Play with it. Ask questions here. 3. Writer a few simple scripts. Try them on the pc. If you have a server, and it mounts python, try them out there. Get more confused, ask questions here. Welcome, you are in very good company. The only STUPID question is the one you refuse to ask because you are afraid. I would not have written tinylist had I let fear master me- and I was VERY afraid- of looking like a fool, of being laughed at. My respect for the peerage of this list is DEEP. steven bruce wrote: > > Hi > > I know nothing about programming except a bit of HTML. I am trying to do a > couple of hours each night trying to learn Python. I am doing the modules > in the beginners section and cant for the life of me get a password guessing > programme to keep track of how many times the wrong password has been > entered. > help would be greatly appreciated. > very embarrassed > > Steve > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com From shalehperry@attbi.com Wed Aug 7 06:41:30 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Tue, 06 Aug 2002 22:41:30 -0700 (PDT) Subject: [Tutor] fnord In-Reply-To: <3D50A6D3.D81162BF@netzero.net> Message-ID: On 07-Aug-2002 Kirk Bailey wrote: > OK, it just came across my CRT that people scrape emails off of > publicly accessible archives, for later spamming. Hmmm, interesting. I > may write a subroutine that MUNGS the submitter's email address when > writing it to the archive, in a way that HUMAN intelligence could easily > detect and correct, but which should fry a poor bot's MIND. > > Discussion? > you just discovered this fact (-: My opinion is that the field of AI will be led by the spammers just like the web was truly pushed by the porn industry. Anything we can come up with tyhe spammers will counteract. No, like pop-up ads we just need to convince people that mass mailings are ignored. From shalehperry@attbi.com Wed Aug 7 06:42:21 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Tue, 06 Aug 2002 22:42:21 -0700 (PDT) Subject: [Tutor] self finding In-Reply-To: <3D50A989.4961C4F5@netzero.net> Message-ID: On 07-Aug-2002 Kirk Bailey wrote: > ok, someone a LONG time ago wrote how to get the script to FIND the > interpreter. Do not now have that message thanks to a HDD failure. > although it might take a script longer to start, this is a major feature > if you want to make it EASIER THAN PIE to install and use. Anyone a real > un*x maven who would care to address how to do this- and it was all on > ONE LINE, a number of interesting characters were in it, some escape > stuff, beat me now, working from memory. any clues? > -- > #!/usr/bin/env python is the magic incantation. From ruger@comnett.net Wed Aug 7 07:43:49 2002 From: ruger@comnett.net (D. Rick Anderson) Date: Tue, 06 Aug 2002 23:43:49 -0700 Subject: [Tutor] self finding References: Message-ID: <3D50C1A5.5090306@comnett.net> ... and to complete that lesson, #! is often known as a shebang (it's fun to say too). In a *nix environment you can specify an interpreter on the 'shebang' line to run the program with: shell script: #!/bin/sh perl program: #!/usr/bin/perl python program: #!/usr/bin/python etc. Then all you have to do is 'chmod +x filename.py' and the script can be called from the command line. Yeah baby .. that's the stuff ..... :-) Rick Sean 'Shaleh' Perry wrote: >On 07-Aug-2002 Kirk Bailey wrote: > > >>ok, someone a LONG time ago wrote how to get the script to FIND the >>interpreter. Do not now have that message thanks to a HDD failure. >>although it might take a script longer to start, this is a major feature >>if you want to make it EASIER THAN PIE to install and use. Anyone a real >>un*x maven who would care to address how to do this- and it was all on >>ONE LINE, a number of interesting characters were in it, some escape >>stuff, beat me now, working from memory. any clues? >>-- >> >> >> > >#!/usr/bin/env python > >is the magic incantation. > >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > > > From dyoo@hkn.eecs.berkeley.edu Wed Aug 7 08:20:27 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 7 Aug 2002 00:20:27 -0700 (PDT) Subject: [Tutor] fnord [the red queen and email disguising] In-Reply-To: Message-ID: > > OK, it just came across my CRT that people scrape emails off of > > publicly accessible archives, for later spamming. Hmmm, interesting. I > > may write a subroutine that MUNGS the submitter's email address when > > writing it to the archive, in a way that HUMAN intelligence could > > easily detect and correct, but which should fry a poor bot's MIND. Hi Kirk, ### try: gatherEmailAddresses() except FryingMindError: pass ### Unfortunately (or fortunately), programs don't have minds to fry. To tell the truth, I feel sympathetic to the poor deterministic computer program. I feel that it's not fair that a spam-gathering program should bear responsibility for the actions of a parasitic user. The idea to munge up an email address using a function is a good idea, and it may work for a while. But it's very likely that a function that undoes the munging can be written, given enough time. For example, if we wrote something that translated '@' to " at " and '.' to "dot" in an email address: ### Hypothetical example: >>> email_encode("matt_ridley@theredqueen.org") matt_ridley at theredqueen dot org ### then that's still something a regular expression engine can pick up with ease. So it has to be a bit more sophisticated than simple text substitution. It's unfortunate, but being a programmer doesn't imply being virtuous, and we have to assume that some spammers have brains, even if they lack moral qualms. We can't make the munging too hard: otherwise, would a human be able to decode it? If you can strike a good balance between making it hard to extract for programs, but easy for humans --- and to do it programatically! --- a lot of people may name their next of kin after you. But back to 'The Red Queen' for me. Talk to you later! From magnus@thinkware.se Wed Aug 7 10:18:14 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 07 Aug 2002 11:18:14 +0200 Subject: [Tutor] Running Python from UNIX In-Reply-To: <372DD7320F873B43929D49BFF86F950B645A1E@cdc1.chennai.corp.h exaware.com> Message-ID: <5.1.0.14.0.20020807105933.02918008@www.thinkware.se> At 09:21 2002-08-07 +0530, Anand Ramakrishna wrote: >Hello, > I wanted to run a single line script from the command line. I=20 > typed from the UNIX command prompt python -c print 'Hello World' . This= =20 > did not give any error message. It got executed but did not print out the= =20 > result. Could anyone tell me what is happening. I did not install python= =20 > in /usr/bin like others. It is installed in my home directory. In my=20 > .bashrc file I have aliased python to the python executable that gets=20 > created after the istallation. Could this be a problem ? What you are running is actually equivalent to $ python -c print You will print a newline. Compare with $ python -c pass Notice the difference? The '-c' flag means that _the_next_parameter_ will be regarded as a python command, which is sent to the python interpreter. Not the entire rest of the line. What you want is to make the entire "print 'Hello World'" the next parameter. For that you need to type : $ python -c "print 'Hello World'" or $ python -c 'print "Hello World"' The second version doesn't work with Windows 2000 command prompt (cmd.exe). I haven't checked other MS OSes. Both works in bash at least. This isn't really a python issue but a general unix shell thing. The unix shell is powerful, but there is a learning curve... (Python is more powerful, and has less learning curve. :-) --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From rob@uselesspython.com Wed Aug 7 13:26:22 2002 From: rob@uselesspython.com (Rob) Date: Wed, 7 Aug 2002 07:26:22 -0500 Subject: [Tutor] fnord In-Reply-To: Message-ID: > My opinion is that the field of AI will be led by the spammers > just like the > web was truly pushed by the porn industry. Anything we can come > up with tyhe > spammers will counteract. > > No, like pop-up ads we just need to convince people that mass mailings are > ignored. Of course some spammers will develop counter-measures to various things we do to make their lives harder. And we'll have to keep coming up with more ways to make their lives harder. The effort will make us better programmers. And if you ever meet a spammer on the street..... But definitely ignore the mass mailings. And support anti-spam policies that are not utterly irrational. Rob http://uselesspython.com From marcolinux@linuxbr.com.br Wed Aug 7 14:46:42 2002 From: marcolinux@linuxbr.com.br (Marc) Date: Wed, 7 Aug 2002 10:46:42 -0300 Subject: [Tutor] fnord [the red queen and email disguising] In-Reply-To: References: Message-ID: <20020807134642.GA1177@marcolab.proconet> Danny Yoo (dyoo@hkn.eecs.berkeley.edu) wrote: > We can't make the munging too hard: otherwise, would a human be able to > decode it? If you can strike a good balance between making it hard to > extract for programs, but easy for humans --- and to do it > programatically! --- a lot of people may name their next of kin after you. Another option: make an image from the address. The image can be rotated, blured, with variable fonts and colors. Follow this link to have an idea: http://imgcode.uol.com.br/YCA0R07PEtg5ME7VSCO8N1dQVQhIPAdX.jpg It's an authentication key to enter in a chat room. Each time you reload, you get a different image (same text for this code) Easy read for humans, hard to computers.This was done to avoid automated logins used for spammers. Worked very well, BTW. Dont know about feasibility, tough. Maybe too cpu intensive to make an image for each address. One must be really mad at spammers to follow this path. :) See ya. .:: MarcoLinux ::. -- There are 10 kinds of people in the world: Those who understand binary, and those who don't. - Slashdot From alan.gauld@bt.com Wed Aug 7 14:50:31 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 7 Aug 2002 14:50:31 +0100 Subject: [Tutor] Dictionary Keys Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7F0@mbtlipnt02.btlabs.bt.co.uk> > Basically, what do y'all tend to do when you are > entering/saving information in a dictionary and, > the way you've set up your script's parameters, > you could conceivably create key:value combinations > with identical keys (but different values)? Dictionary keys are unique so you can't do it! What you can do is have the value store a list of items(or even another dictionary). Thus if we have patient ID as the first key and the value is a dictionary of visits keyed by date/time we can generate something like this: dict = {'Gauld': {20020806:(15,'sore head','$50'), 20020601:(22,'pain in the neck', '$500')}, 'Colburn': { 20010102: 47, 'stabbing pain', $5) } } Thus we could get a list of visit dates for gauld by: dict['gauld'].keys() or a particular visits details with: dict['gauld'][20020806] or a particular item: print "Complaint: ", dict['gauld'].[20020806][1] Does that help? BTW anything morre complex that this and I'd definitely suggest moving to a real database. I'd even consider it for this level if there will be many(>1000) patients/visits. Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From dman@dman.ddts.net Wed Aug 7 15:13:05 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Wed, 7 Aug 2002 10:13:05 -0400 Subject: [Tutor] Re: fnord In-Reply-To: <3D50A6D3.D81162BF@netzero.net> References: <3D50A6D3.D81162BF@netzero.net> Message-ID: <20020807141305.GA11177@dman.ddts.net> --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 07, 2002 at 12:49:23AM -0400, Kirk Bailey wrote: | OK, it just came across my CRT that people scrape emails off of | publicly accessible archives, for later spamming. Hmmm, interesting. I | may write a subroutine that MUNGS the submitter's email address when | writing it to the archive, in a way that HUMAN intelligence could easily | detect and correct, but which should fry a poor bot's MIND. |=20 | Discussion? 1) It is really really (did I say really?) annoying to people who try to actually use your archives later. 2) If you can programmatically encode the text, then another program can programmatically decode it. IOW it won't have any positive effect once the spammers decide that it is worth their effort to (programmatically) decode your style of munging. Use sa-exim instead to reject the trash at the door. Also set up some teergrube systems. http://marc.merlins.org/linux/exim/sa.html http://www.iks-jena.de/mitarb/lutz/usenet/teergrube.en.html -D --=20 If your company is not involved in something called "ISO 9000" you probably have no idea what it is. If your company _is_ involved in ISO 9000 then you definitely have no idea what it is. (Scott Adams - The Dilbert principle) =20 http://dman.ddts.net/~dman/ --x+6KMIRAuhnl3hBn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1RKvEACgkQO8l8XBKTpRRRoACgzEJPqjgOLvjzJKwcys+lLIu7 hvwAnRTc8phitNL7FEU4AhW2EoWMEdpw =SZ4W -----END PGP SIGNATURE----- --x+6KMIRAuhnl3hBn-- From rob@uselesspython.com Wed Aug 7 15:15:28 2002 From: rob@uselesspython.com (Rob) Date: Wed, 7 Aug 2002 09:15:28 -0500 Subject: [Tutor] Re: fnord In-Reply-To: <20020807141305.GA11177@dman.ddts.net> Message-ID: > 1) It is really really (did I say really?) annoying to people who try > to actually use your archives later. > > 2) If you can programmatically encode the text, then another program > can programmatically decode it. IOW it won't have any positive > effect once the spammers decide that it is worth their effort to > (programmatically) decode your style of munging. I've yet to see a form of munging that made it annoying or difficult for me to make out people's email addresses with the naked eye. But I'm not everyone (except in some interesting hypothetical models of metaphysics, of course). What if not all addresses were munged the same way? A munging application could have several different mung styles built in, and randomly choose which one to apply for each email address to be munged. That would be a little trickier to code around, I'd wager. Rob From alan.gauld@bt.com Wed Aug 7 15:14:12 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 7 Aug 2002 15:14:12 +0100 Subject: [Tutor] Running Python from UNIX Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7F2@mbtlipnt02.btlabs.bt.co.uk> First, please use plain text when posting to public mailing lists. Even in Outlook your purple against blue was very hard to read! If you make it hard to read theres a greater chance it won't get read. And that means a reduced chance of you getting an answer! > I wanted to run a single line script from the command line. > I typed from the UNIX command prompt > $ python -c print 'Hello World' You need to enclose the entire command in quotes: $ python -c "print 'hello world'" HTH, Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Wed Aug 7 15:18:46 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 7 Aug 2002 15:18:46 +0100 Subject: [Tutor] tkinter browser ? Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7F3@mbtlipnt02.btlabs.bt.co.uk> > I'm not sure what the purpose of making yet another browser It used to be that new programmers wanted to write their own text editor. Now it seems to be a web browser. I don't know why. But it seems to be a common request from beginners on many programming fora just now.... This may be a good thing, we probably have enough good text editors around to satisfy every conceivable style of user. Now we might get a slew of good web browsers each slightly different. Even if only 10% are any good at least thats more than we have just now! Just a thought, Alan g. From gus.tabares@verizon.net Wed Aug 7 15:38:12 2002 From: gus.tabares@verizon.net (Gus Tabares) Date: Wed, 7 Aug 2002 10:38:12 -0400 Subject: [Tutor] Question about time module Message-ID: Hello, I was checking the documentation about the time module when I stumbled across time.time(). help(time) explains as follows: time() -> floating point number Return the current time in seconds since the Epoch. Fractions of a second may be present if the system clock provides them. Now, being the nonunderstanding high school student that I am, I went and checked the definition of "Epoch". It was as follows: 1. A particular period of history, especially one considered remarkable or noteworthy. Could anyone tell me when this is? Could it possibly be when Guido first introduced Python?;) It's a silly question, I am just curious:) Thank You, Gus From iumarumo@eidosnet.co.uk Wed Aug 7 15:27:27 2002 From: iumarumo@eidosnet.co.uk (ibraheem umaru-mohammed) Date: Wed, 7 Aug 2002 15:27:27 +0100 Subject: [Tutor] Question about time module In-Reply-To: References: Message-ID: <20020807142727.GI4402@micromuse.com> [Gus Tabares wrote...] -| -| 1. A particular period of history, especially one considered remarkable or -| noteworthy. -| In this case, the Epoch is 00:00:00 January 1, 1970, Coordinated Universal Time (UTC). Kindest regards, --ibs. -- ibraheem umaru-mohammed www.micromuse.com --0-- From lsloan@umich.edu Wed Aug 7 16:13:29 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Wed, 07 Aug 2002 11:13:29 -0400 Subject: [Tutor] fnord In-Reply-To: <3D50A6D3.D81162BF@netzero.net> References: <3D50A6D3.D81162BF@netzero.net> Message-ID: <10138017.1028718809@[10.0.1.9]> --On Wednesday, August 7, 2002 12:49 AM -0400 Kirk Bailey wrote: > OK, it just came across my CRT that people scrape emails off of > publicly accessible archives, for later spamming. Hmmm, interesting. I > may write a subroutine that MUNGS the submitter's email address when > writing it to the archive, in a way that HUMAN intelligence could easily > detect and correct, but which should fry a poor bot's MIND. Some other readers have given you some very good ideas already. I especially liked the suggestion of converting the text to an image. In the example of a password hidden that way, it's probably easy to make a handful of different images ahead of time for future use, but it would take a lot of disk space to keep many email addresses sitting around as images. And it would probably be more processing intensive than you'd like to generate the image on the fly every time. Yahoo! handles this on groups.yahoo.com by changing addresses like "name@address.com" to "name@a..." and makes them hyperlinks to a form that lets you compose a short message to the person without ever revealing their email address. Of course, you have to sign in with a name and password to get to that form. You could vary that idea a bit, maybe allowing any unregistered user to send a message via the form, but require them to confirm via email that the "from" address they entered is correct. If a user is registered with your website, maybe you can trust them emough to actually display the email addresses. -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From jeff@ccvcorp.com Wed Aug 7 17:35:57 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Wed, 07 Aug 2002 09:35:57 -0700 Subject: [Tutor] Question about time module References: <20020807142727.GI4402@micromuse.com> Message-ID: <3D514C6D.1AA01B2D@ccvcorp.com> ibraheem umaru-mohammed wrote: > [Gus Tabares wrote...] > -| > -| 1. A particular period of history, especially one considered remarkable or > -| noteworthy. > -| > > In this case, the Epoch is 00:00:00 January 1, 1970, Coordinated > Universal Time (UTC). For the record, the Epoch (in this sense) has little to do with Python, which merely re-uses the standard Unix definition. Unix stores all time values as seconds since the Epoch -- so that the date & time listed above is stored as 0. This method of tracking time became ingrained in the standard C library (as C originated with Unix), and was thus introduced into Windows. Other OSes have used other values as their own Epoch, but the Unix definition of it has become pretty much the standard. The story is that the Epoch was when the first Unix system went online (rounding back to the beginning of that year, presumably). Jeff Shannon Technician/Programmer Credit International From dman@dman.ddts.net Wed Aug 7 18:08:55 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Wed, 7 Aug 2002 13:08:55 -0400 Subject: [Tutor] Re: fnord In-Reply-To: References: <20020807141305.GA11177@dman.ddts.net> Message-ID: <20020807170855.GA13285@dman.ddts.net> --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 07, 2002 at 09:15:28AM -0500, Rob wrote: |=20 | > 1) It is really really (did I say really?) annoying to people who try | > to actually use your archives later. | > | > 2) If you can programmatically encode the text, then another program | > can programmatically decode it. IOW it won't have any positive | > effect once the spammers decide that it is worth their effort to | > (programmatically) decode your style of munging. |=20 | I've yet to see a form of munging that made it annoying or difficult for = me | to make out people's email addresses with the naked eye. But I'm not | everyone (except in some interesting hypothetical models of metaphysics, = of | course). Use your web browser and browse the archives. When you find an interesting post that you want to discuss with the author, highlight and copy the address from the page onto your system's clipboard. Now fire up your mail client and paste it in the "to" field. Oops, that didn't work, you now must de-munge the text manually. (hence "annoying") Once I made just such a copy-n-paste error no less that 3 times in a row (on the same address, after my message bounced). Not only that, but the address didn't come off a web page and had been munged by hand in the first place. | What if not all addresses were munged the same way? A munging application | could have several different mung styles built in, and randomly choose wh= ich | one to apply for each email address to be munged. That would be a little | trickier to code around, I'd wager. Nah, just use a regex to identify which of the finite (and small, more than likely) number of munging styles were used. Or just run the text through each de-munger and see which one(s) yield an address afterwards. Then spam all the addresses you got back and remove the bad ones from your list afterwards. If you can programmatically create it (and the output is comprehensible) then someone else can programmatically comprehend it. -D --=20 The heart is deceitful above all things and beyond cure. Who can understand it? =20 I the Lord search the heart and examine the mind, to reward a man according to his conduct, according to what his deeds deserve. =20 Jeremiah 17:9-10 =20 http://dman.ddts.net/~dman/ --8t9RHnE3ZwKMSgU+ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1RVCcACgkQO8l8XBKTpRRa4gCfVmH3h5cl+ML0M24YoGrZVBqa hFcAni9Afu8EeFbw/jEU4GFtczP7u86A =18Ry -----END PGP SIGNATURE----- --8t9RHnE3ZwKMSgU+-- From dyoo@hkn.eecs.berkeley.edu Wed Aug 7 18:14:18 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 7 Aug 2002 10:14:18 -0700 (PDT) Subject: [Tutor] Question about time module In-Reply-To: Message-ID: On Wed, 7 Aug 2002, Gus Tabares wrote: > Hello, > > I was checking the documentation about the time module when I stumbled > across time.time(). help(time) explains as follows: > > time() -> floating point number > > Return the current time in seconds since the Epoch. > Fractions of a second may be present if the system clock provides > them. > > Now, being the nonunderstanding high school student that I am, I > went and checked the definition of "Epoch". It was as follows: > > 1. A particular period of history, especially one considered remarkable or > noteworthy. > > Could anyone tell me when this is? Could it possibly be when Guido > first introduced Python?;) It's a silly question, I am just curious:) Here you go: http://www.tuxedo.org/~esr/jargon/html/entry/epoch.html It's not a Python specific term, but one that applies to every computer clock. Hope this helps! From rob@uselesspython.com Wed Aug 7 18:55:46 2002 From: rob@uselesspython.com (Rob) Date: Wed, 7 Aug 2002 12:55:46 -0500 Subject: [Tutor] Re: fnord In-Reply-To: <20020807170855.GA13285@dman.ddts.net> Message-ID: > Use your web browser and browse the archives. When you find an > interesting post that you want to discuss with the author, highlight > and copy the address from the page onto your system's clipboard. Now > fire up your mail client and paste it in the "to" field. Oops, that > didn't work, you now must de-munge the text manually. (hence > "annoying") > > Once I made just such a copy-n-paste error no less that 3 times in a > row (on the same address, after my message bounced). Not only that, > but the address didn't come off a web page and had been munged by hand > in the first place. > I don't blame you for finding the experience annoying, but in most cases I would consider this an acceptable compromise to make in order to attain the desired end result. > | What if not all addresses were munged the same way? A munging > application > | could have several different mung styles built in, and randomly > choose which > | one to apply for each email address to be munged. That would be a little > | trickier to code around, I'd wager. > > Nah, just use a regex to identify which of the finite (and small, more > than likely) number of munging styles were used. Or just run the text > through each de-munger and see which one(s) yield an address > afterwards. Then spam all the addresses you got back and remove the > bad ones from your list afterwards. If you can programmatically > create it (and the output is comprehensible) then someone else can > programmatically comprehend it. > Certainly. Hence my phrasing "a little trickier to code around". I suppose we could also make the archives only available via an authentication process. Rob From hall@nhn.ou.edu Tue Aug 6 22:48:36 2002 From: hall@nhn.ou.edu (Isaac Hall) Date: Tue, 6 Aug 2002 16:48:36 -0500 Subject: [Tutor] tkinter browser ? In-Reply-To: <20020806210255.7786.qmail@linuxmail.org>; from kemu@linuxmail.org on Tue, Aug 06, 2002 at 16:02:54 -0500 References: <20020806210255.7786.qmail@linuxmail.org> Message-ID: <20020806164836.K28571@ouhep1.nhn.ou.edu> hi, now I don't know if it uses Tkinter or not, but I know there is a browser written in python already out there called Grail. (at least I think thats what it is called, its been a long time since I heard anything about it.) you maybe could start by simply looking at what they have done. Ike On 2002.08.06 16:02 Jonas Geiregat wrote: > how can I make a simple browser > using maybe other browser setting like IE ? > with TKinter ? > any tips starting points tutorial articles would be welcome > > > -- > Get your free email from www.linuxmail.org > > > Powered by Outblaze > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From hall@nhn.ou.edu Wed Aug 7 20:09:52 2002 From: hall@nhn.ou.edu (Isaac Hall) Date: Wed, 7 Aug 2002 14:09:52 -0500 Subject: [Tutor] Inexperienced fool In-Reply-To: ; from stevebruce7@hotmail.com on Tue, Aug 06, 2002 at 17:57:20 -0500 References: Message-ID: <20020807140952.A29115@ouhep1.nhn.ou.edu> Hi Steven, Rob and Kirk are right, this is the best support forum I have ever seen... it helped get me through learning python after spending 5 years without writing any code, and Im still learning alot here. anyway, as Rob said, you may want to post a snippet of code so that people here can peruse and point out errors....otherwise any specific coding advice may require you to have to rewrite your entire program, which isnt always fun. plus, when you do, and someone sees a mistake, they will usually try to explain in fair detail why you made a mistake... very helpful. Anyway, welcome to python. I might also suggest the Python books in the O'Reily series. 'Learning Python' and 'Programming Python'. The latter is mainly for slightly more advanced programmers but the former is a very good introduction to Python (and cheaper). These helped me alot. Ike On 2002.08.06 17:57 steven bruce wrote: > Hi > > I know nothing about programming except a bit of HTML. I am trying > to do a couple of hours each night trying to learn Python. I am > doing the modules in the beginners section and cant for the life of > me get a password guessing programme to keep track of how many times > the wrong password has been entered. > help would be greatly appreciated. > very embarrassed > > Steve > > > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor From paul@meaney.cjb.net Wed Aug 7 20:39:34 2002 From: paul@meaney.cjb.net (paul meaney) Date: Wed, 7 Aug 2002 20:39:34 +0100 Subject: [Tutor] tkinter browser ? References: <20020806210255.7786.qmail@linuxmail.org> <20020806164836.K28571@ouhep1.nhn.ou.edu> Message-ID: <001a01c23e4a$2a35dbf0$90cb86d9@paulkqormmrjdc> location of python browser http://grail.sourceforge.net/ ----- Original Message ----- From: "Isaac Hall" To: "Jonas Geiregat" Cc: Sent: Tuesday, August 06, 2002 10:48 PM Subject: Re: [Tutor] tkinter browser ? > hi, > now I don't know if it uses Tkinter or not, but I know there is a > browser > written in python already out there called Grail. (at least I think > thats > what it is called, its been a long time since I heard anything about > it.) > > you maybe could start by simply looking at what they have done. > > Ike > > On 2002.08.06 16:02 Jonas Geiregat wrote: > > how can I make a simple browser > > using maybe other browser setting like IE ? > > with TKinter ? > > any tips starting points tutorial articles would be welcome > > > > > > -- > > Get your free email from www.linuxmail.org > > > > > > Powered by Outblaze > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > http://mail.python.org/mailman/listinfo/tutor > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002 From ak@silmarill.org Wed Aug 7 21:45:06 2002 From: ak@silmarill.org (Andrei Kulakov) Date: Wed, 7 Aug 2002 16:45:06 -0400 Subject: [Tutor] Inexperienced fool In-Reply-To: References: Message-ID: <20020807204506.GA861@ak.silmarill.org> On Tue, Aug 06, 2002 at 11:57:20PM +0100, steven bruce wrote: > Hi > > I know nothing about programming except a bit of HTML. I am trying to do a > couple of hours each night trying to learn Python. I am doing the modules > in the beginners section and cant for the life of me get a password > guessing programme to keep track of how many times the wrong password has > been entered. > help would be greatly appreciated. > very embarrassed > > Steve > Here's an example: Enter password: sec You've entered wrong password 1 times. Enter password: doh You've entered wrong password 2 times. Enter password: argh You've entered wrong password 3 times. Enter password: secret34 Right you are! Here's code: pw = "secret34" count = 0 while 1: answer = raw_input("Enter password: ") if answer == pw: print "Right you are!" break else: count = count + 1 print "You've entered wrong password %d times." % count Here's explanation: while 1: loops until you break out of it. It's usually used like this: while 1: [do stuff, sometimes set flag] if flag is set: break flag is simply a variable that is first set to 0 and then set to 1 if some condition is met. Or as in our case here we can compare a password to user's answer. 2nd line gets user's answer into variable called "answer". 3rd line compares that answer to variable 'pw' which holds password. If they're the same, we print "right you are" and break out of the loop; since the whole program is in the loop, it exits right after that. else runs if password is not equal to what user entered; here we add one to variable called count (which starts at 0); and then we print out the value of count. Please save this code in a file and play around with it, changing it to stop after 3 tries, etc. If you have further questions, start with this code, and ask why your changes don't work or don't do what you expect, so that we don't have to start all over again. I've already gave you some code before, IIRC, and I don't know what black hole it disappeared into ;-). > > > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Cymbaline: intelligent learning mp3 player: python, linux, console. get it at: http://silmarill.org/cymbaline.htm From ak@silmarill.org Wed Aug 7 21:48:50 2002 From: ak@silmarill.org (Andrei Kulakov) Date: Wed, 7 Aug 2002 16:48:50 -0400 Subject: [Tutor] Inexperienced fool In-Reply-To: References: Message-ID: <20020807204850.GB861@ak.silmarill.org> On Tue, Aug 06, 2002 at 11:57:20PM +0100, steven bruce wrote: > Hi > > I know nothing about programming except a bit of HTML. I am trying to do a > couple of hours each night trying to learn Python. I am doing the modules > in the beginners section and cant for the life of me get a password > guessing programme to keep track of how many times the wrong password has > been entered. > help would be greatly appreciated. > very embarrassed > > Steve In addition, I want to mention that you don't have to be smart to be good at programming, you merely have to be persistent. If something don't work, go to another place and try something else. There's zillions of tutorials online; even more code examples and programs; even Einstein got stuck sometimes.. the secret to gaining experience and knowledge is trying something new when you get stuck on old things.. This isn't SAT, you're free to roam the landscape for excitement and intellectual profit ;-). > > > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Cymbaline: intelligent learning mp3 player: python, linux, console. get it at: http://silmarill.org/cymbaline.htm From highdesertman@yahoo.com Wed Aug 7 21:59:21 2002 From: highdesertman@yahoo.com (Mathew P.) Date: Wed, 7 Aug 2002 13:59:21 -0700 (PDT) Subject: [Tutor] self finding In-Reply-To: Message-ID: <20020807205921.59870.qmail@web13402.mail.yahoo.com> --- Sean 'Shaleh' Perry wrote: > > On 07-Aug-2002 Kirk Bailey wrote: > > ok, someone a LONG time ago wrote how to get the script to FIND the > > interpreter. Do not now have that message thanks to a HDD failure. > > although it might take a script longer to start, this is a major > feature > > if you want to make it EASIER THAN PIE to install and use. Anyone a > real > > un*x maven who would care to address how to do this- and it was all > on > > ONE LINE, a number of interesting characters were in it, some > escape > > stuff, beat me now, working from memory. any clues? > > -- > > > > #!/usr/bin/env python This will do it, if you have the env script installed on your system. This script locates the python interpreter according to your system search-path settings (ie. the path statement). This method can make code more portable, since you don't have to know where the python interpreter is installed on every system your code will run on. The downside is that env may not exist on every machine you are running on. But then, we do live in an imperfect world. Cheers, Mathew __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From ckd16@hotmail.com Tue Aug 6 00:24:50 2002 From: ckd16@hotmail.com (Kevin Dingle) Date: Mon, 05 Aug 2002 16:24:50 -0700 Subject: [Tutor] need help Message-ID: What exactly am I supposed to do with this?How do I use it?thanks for the help Sincerely Your Friend, Kevin Dingle/KCD16 _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com From djrassoc01@mindspring.com Tue Aug 6 02:20:20 2002 From: djrassoc01@mindspring.com (djr) Date: Mon, 05 Aug 2002 20:20:20 -0500 Subject: [Edu-sig] Re: [Tutor] Girls, women and Programming (- and Python) References: <3D485C3F.3060304@aon.at> <3D4C73D9.2000704@aon.at> <1028595524.28495.11.camel@everglade.zoism.org> Message-ID: <3D4F2453.FA947A05@mindspring.com> Rob Brown-Bayliss wrote: > > 1) Why are there so few girl and women interested in programming? > > (look, for instance, at the list of partiicipants of all those mailing > > lists) > > It's a silly question, but one that a few years ago I also would have > found important... In my opinion, it's not a silly question when you know girls who took Perl from you in 6th grade and Python from you in 8th grade and continue to impress you with their concentration in making updates to their object-oriented adventure game while the boys in the room carry on -- no doubt learning things but in quite different way. What is the approach that enhances the interests of the girls in going after their goals in the computing area? How does one make sure the environment does not impede their progress? Their other interests, that I knew about, were Highland Dance and Theater not atypical for their age. > Maybe you could rephrase your question, why are there so few men > interested in fashion industry? How many men do you know who even > contemplate making their own clothes? Can't answer that but I can tell you that I have heard about sewing machines that are run by Windows PC's and am waiting for the Sewing teacher (where my son learned to make a pair of boxer shorts in 7th grade) to stop me and ask about Python and Sewing Machines... All the 7th grade students (boys and girls) take L.I.F.E which we used to call Home Ec. and do a number of cooking and sewing projects. --D. -- Dr. David J. Ritchie, Sr. djrassoc01@mindspring.com http://home.mindspring.com/~djrassoc01/ From urnerk@qwest.net Tue Aug 6 16:39:03 2002 From: urnerk@qwest.net (Kirby Urner) Date: Tue, 06 Aug 2002 08:39:03 -0700 Subject: [Edu-sig] Re: [Tutor] Girls, women and Programming (- and Python) In-Reply-To: <1028595524.28495.11.camel@everglade.zoism.org> References: <3D4C73D9.2000704@aon.at> <3D485C3F.3060304@aon.at> <3D4C73D9.2000704@aon.at> Message-ID: <5.1.1.6.0.20020806083740.0245ed90@pop.ptld.qwest.net> > >Now, without prompting, or pushing form either of us Zenobie, the girl >loves babies, palying dressup and pink things, fairys and stuff. > >Luke, the boy, loves trains, trucks, diggers and racing cars, breaking >things and being rough... > >Maybe you could rephrase your question, why are there so few men >interested in fashion industry? How many men do you know who even >contemplate making their own clothes? A different question: why is computer programming supposedly less like loving babies and designing dresses, and more like breaking things? Based on the above description, I can see why it might be a priority to get the boys *out* of programming :-D. Kirby From harwood@nyclimits.org Tue Aug 6 20:24:07 2002 From: harwood@nyclimits.org (Paul Harwood) Date: Tue, 6 Aug 2002 12:24:07 -0700 Subject: [Tutor] Have a very simple question Message-ID: Why does 'doesn\'t' translate to "doesn't" ? This is in the Python tutorial but it doesn't say why this happens. -Paul From rob@uselesspython.com Wed Aug 7 22:52:42 2002 From: rob@uselesspython.com (Rob) Date: Wed, 7 Aug 2002 16:52:42 -0500 Subject: [Tutor] need help In-Reply-To: Message-ID: > What exactly am I supposed to do with this?How do I use it?thanks for the > help Is it safe to assume that you have obtained a Python distribution and want to know how to get started programming with it? Most likely what you have before you came with a tutorial to get you started, and this would be a good place to begin. Also, feel free to check out this link for a few more ideas: http://www.uselesspython.com/gettingstarted.html Also, it might help to know what you think you might *like* to do. We're more than happy to help. Rob From rob@uselesspython.com Wed Aug 7 22:55:05 2002 From: rob@uselesspython.com (Rob) Date: Wed, 7 Aug 2002 16:55:05 -0500 Subject: [Tutor] Have a very simple question In-Reply-To: Message-ID: The \ before the ' tells Python that you want the ' to be taken literally and not as the ' that would end the string. Does that help? Rob > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > Paul Harwood > Sent: Tuesday, August 06, 2002 2:24 PM > To: tutor@python.org > Subject: [Tutor] Have a very simple question > > > > > Why does 'doesn\'t' translate to "doesn't" ? This is in the Python > tutorial but it doesn't say why this happens. > > -Paul > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From dyoo@hkn.eecs.berkeley.edu Wed Aug 7 22:54:41 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 7 Aug 2002 14:54:41 -0700 (PDT) Subject: [Tutor] Have a very simple question In-Reply-To: Message-ID: On Tue, 6 Aug 2002, Paul Harwood wrote: > Why does 'doesn\'t' translate to "doesn't" ? This is in the Python > tutorial but it doesn't say why this happens. One way you can check why the backslash is in there is to take it out. *grin* ### >>> 'doesn't' File "", line 1 'doesn't' ^ SyntaxError: invalid syntax ### Can you think of a reason why this is being flagged as a syntax error? A similar idea occurs when people quote other people in the newspaper. For example, take this fragment: The spokesperson continued: "Michael Jackson was forced to sell more than two dozen of his beloved pet giraffes to exotic-meat suppliers Monday. 'I will greatly miss Patches and Princess and the other giraffes,'" vs: The spokesperson continued: "Michael Jackson was forced to sell more than two dozen of his beloved pet giraffes to exotic-meat suppliers Monday. "I will greatly miss Patches and Princess and the other giraffes,"" The second version would (hopefully) never be used because the quotes are being used ambiguously. I hope this helps! From mnavarre@anteon.com Wed Aug 7 22:56:30 2002 From: mnavarre@anteon.com (Matthew Navarre) Date: Wed, 7 Aug 2002 14:56:30 -0700 Subject: [Tutor] Have a very simple question In-Reply-To: References: Message-ID: <200208071456.30425.mnavarre@anteon.com> On Tuesday 06 August 2002 12:24 pm, Paul Harwood wrote: > Why does 'doesn\'t' translate to "doesn't" ? This is in the Python > tutorial but it doesn't say why this happens. The backslash 'escapes' the apostrophe from ending the string. Since we u= se=20 the same ascii character for both single quote and apostrophe python woul= d=20 think the apostrophe was the terminating quote for the string. So the=20 backslash tells python to take the next character literally. Another solution would be to use double quotes to delimit the string i.e. >>>print "dosen't" gives the same result as >>>print 'dosen\'t' OK, MCN --=20 mnavarre@anteon.com Matthew Navarre It was a hard sell, since he's a database person, and as far as I've seen= , once those database worms eat into your brain, it's hard to ever get anything practical done again. To a database person, every nail looks like a thumb. Or something like that. - jwz From rob@uselesspython.com Wed Aug 7 23:10:26 2002 From: rob@uselesspython.com (Rob) Date: Wed, 7 Aug 2002 17:10:26 -0500 Subject: [Tutor] Have a very simple question In-Reply-To: Message-ID: That's right. And here are a few more things to ponder: >>> print 'Is this a valid string, or isn't it?' SyntaxError: invalid syntax >>> print 'Quoth the raven, "I did not read poetry to that woman."' Quoth the raven, "I did not read poetry to that woman." >>> print 'Quoth the raven, "I didn't read poetry to that woman."' SyntaxError: invalid syntax >>> print """Quoth the raven, "I said I didn't do it."""" SyntaxError: invalid token >>> print '''Quoth the raven, "No, really... I didn't." ''' Quoth the raven, "No, really... I didn't." When in doubt, trying out an idea in the Python shell is often the fastest way to figure things out. Rob > -----Original Message----- > From: Paul Harwood [mailto:harwood@nyclimits.org] > Sent: Wednesday, August 07, 2002 4:56 PM > To: Rob > Subject: RE: [Tutor] Have a very simple question > > > I think so. So I guess if you are using single quotes, it must follow > that the string needs to be contained in double quotes? > > -Paul > > > -----Original Message----- > From: Rob [mailto:rob@uselesspython.com] > Posted At: Wednesday, August 07, 2002 2:55 PM > Posted To: Python > Conversation: [Tutor] Have a very simple question > Subject: RE: [Tutor] Have a very simple question > > > The \ before the ' tells Python that you want the ' to be taken > literally and not as the ' that would end the string. > > Does that help? > > Rob > > > -----Original Message----- > > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf > > Of Paul Harwood > > Sent: Tuesday, August 06, 2002 2:24 PM > > To: tutor@python.org > > Subject: [Tutor] Have a very simple question > > > > > > > > > > Why does 'doesn\'t' translate to "doesn't" ? This is in the Python > > tutorial but it doesn't say why this happens. > > > > -Paul > > > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > http://mail.python.org/mailman/listinfo/tutor > > > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From kb@mm.st Wed Aug 7 23:10:11 2002 From: kb@mm.st (Kyle Babich) Date: Wed, 7 Aug 2002 22:10:11 UT Subject: [Tutor] need help Message-ID: <20020807221011.DC3A49390F@server2.fastmail.fm> On Mon, 05 Aug 2002 16:24:50 -0700, "Kevin Dingle" said: > What exactly am I supposed to do with this?How do I use it?thanks for > the=20 > help >=20 I'm still a beginner at python too and the tutorial that has helped me the most so far has to be: http://blacksun.box.sk/tutorials/python.htm -- Kyle From rob@zoism.org Thu Aug 8 00:19:16 2002 From: rob@zoism.org (Rob Brown-Bayliss) Date: 08 Aug 2002 11:19:16 +1200 Subject: [Tutor] tkinter browser ? In-Reply-To: <5.1.0.14.0.20020807054550.028b3878@www.thinkware.se> References: <20020806210255.7786.qmail@linuxmail.org> <20020806210255.7786.qmail@linuxmail.org> <5.1.0.14.0.20020807054550.028b3878@www.thinkware.se> Message-ID: <1028762356.1719.23.camel@everglade.zoism.org> > I don't know of any suitable controls to make a simple > (I presume web-) browser with Tkinter. For wxPython there > is the wxHtmlWindow that can render simple HTML. I guess > there are Gtk and KDE widgets as well, that can be reached > from Python through some kind of tool kits. Not Tkinter > though. I think maybe you should forget IE and look to Mozilla. Thewre is/was a GTK widget that embeds the Mozilla rendering engine (just the html engine, nothing else), it is being used for at least one web browser (Galeon). There was/is a python wraper for it, that I used briefly with teh python gtk wrappers and it worked quite well: As I understand it the widget has not been ported to teh GTK 2.0 release, so has to be used with gtk 1.x. On windows there was a browser also useing this widget, but thats all I know there... -- * * Rob Brown-Bayliss * From stevebruce7@hotmail.com Thu Aug 8 00:27:33 2002 From: stevebruce7@hotmail.com (steven bruce) Date: Thu, 08 Aug 2002 00:27:33 +0100 Subject: [Tutor] (no subject) Message-ID: Hi everyone again, I have sorted it now thanks to all your help and just to give you all a good laugh I thought id show you how not to do it. password = "hjgjhj" password != "steve": count = 0 max = 4 count < max password = raw_input ("What is your Username? ") if password == "steve": count = 4 elif password <> "steve": count = count + 1 print "Hi",password I really appreciate all the e-mails. I didnt quite expect that sort of reaction but goes to prove what an excellent site for beginners. Many Thanks Steve _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com From scot@possum.in-berlin.de Thu Aug 8 08:43:00 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Thu, 8 Aug 2002 09:43:00 +0200 Subject: [Tutor] Off topic: fnord [the red queen and email disguising] In-Reply-To: <20020807134642.GA1177@marcolab.proconet> References: <20020807134642.GA1177@marcolab.proconet> Message-ID: <200208080943.00920.scot@possum.in-berlin.de> Hello there, > Another option: make an image from the address. I'm not sure any of this is going to help - spam is not a technological problem, it is a legal problem. Basically, spam is somebody using your resources (disk space, connection time - not trivial in countries with metered phone costs) for their own greedy uses. As such, it is more a form of theft and should be treated that way. The solution is not a technological arms race between the spammers and the good guys, but legislation. Go bug your local representative. Or just sit back and wait. The U.S. - the world-wide number one source of spam - will pass laws against spam once more of Asia is online and all of those voters have to wade through 1,000 used car ads from New Delhi and penis enlargement stores in Yokohama every day. One reason why Europeans are tougher on spam is that most stuff they get is in a foreign language - English - and totally useless. Dear marketing droids: If I live in Lyon, France, I am _not_ going to travel to Dumbsville, Nevada just to buy a used lawnmower. Or, if you insist on technology: Start with a new mail protocol which uses some sort of checksum to detect manipulated headers, and refuses tampered messages. Or a protocol that requires identification at each hop between sender and receiver, so A has to know B and B has to know C, but A doesn't have to know C. Or something like that. Though you're still going to have problems with "anonymous" setups like Hotmail who don't seem to care who is a member as long as they look at their own ads. Anyway, I don't think fooling around with the current header lines is going to work. Anything you can do, a machine can be taught to do, unless you want to start doing something like: To: First word: Singular form of the people who live in the part of Great Britian north of England, lowercase; Second word: The character that lives on the same key as the Q on a German keyboard and can be accessed with the ALT-GER key; Third word: A small animal that which lives in trees and has a think fur, a long nose and a hairless tail, and is found in Australia, New Zealand and America; Fourth word: The opposite of "out", followed by the character for subtraction, followed by the capital of Germany before the Second World War and after reunification; Fifth word: A synonym for 'lifeless' with the advertising extracted. Now that might work, for a while at least. Y, Scot Who is old enough to remember the Good Old Days before spam and HTML -- Scot W. Stevenson -- scot@possum.in-berlin.de -- Zepernick, Germany From virketis@post.harvard.edu Thu Aug 8 07:44:39 2002 From: virketis@post.harvard.edu (Pijus Virketis) Date: Thu, 8 Aug 2002 09:44:39 +0300 Subject: [Tutor] (no subject) In-Reply-To: Message-ID: Steve, >I have sorted it now thanks to all your help and just to give= you >all a good laugh I thought id show you how not to do it. [bits of steve's code] password !=3D "steve": count < max [/ bits of steve's code] Actually, you were not too far off, and the only major problem= can be seen in the two lines above. In both cases, you perform a boolean= operation, and then throw away the results without using them in= a conditional, or some other way. >>> 1 < 2 1 I have just asked the Python interpreter to tell me whether 1 is= less than 2, and it replied "True", or "1". When you write "count <= max", exactly the same thing happens, Python compares the values which= are assigned to variables "count" and "max" at the moment, and= returns either "1" or "0". Ditto for "password !=3D 'steve'". The way it's written in your code, Python sees something like= this: # some code 1 # result of evaluating the conditional # some more code You want to use this result in some productive way, not just= discard it. In your case, that means in a conditional. For instance: >>> while password !=3D "steve": pass Let's say "password" was assigned the value "pijus". Python would= take two steps in evaluating the line above: 1) is "pijus" NOT EQUAL "steve" ? --> return "True" 2) WHILE True --> carry out the commands, i.e. pass I hope this makes the use of boolean operations and conditionals= a little bit clearer. Don't hesitate to ask for a better= explanation. And I don't think anyone's laughing at you; I know that I have= done precisely the same thing when I started out with programming. ;) Cheers, Pijus -- "Anyone attempting to generate random numbers by deterministic= means is, of course, living in a state of sin." -- John Von Neumann From anandrs@hexaware.com Thu Aug 8 10:20:08 2002 From: anandrs@hexaware.com (Anand Ramakrishna) Date: Thu, 8 Aug 2002 14:50:08 +0530 Subject: [Tutor] String comparison Message-ID: <372DD7320F873B43929D49BFF86F950B645A33@cdc1.chennai.corp.hexaware.com> Hi, How do I perform a string comparison in Python. I was trying to = arrange names alphabetically and it worked if all the names were in the = same cases. When I used a mixture of cases, the upper case came first = and then the lower cases. This is because of the ASCII values of upper = case letters which is smaller than those of lower case ones. Is there = any command which will compare irrespective of the cases. Or better how = can I ignore cases. I am newbie, so my doubts may be really stupid. Please bear with me. Thanks and regards, Anand~ From alan.gauld@bt.com Thu Aug 8 10:47:46 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 8 Aug 2002 10:47:46 +0100 Subject: [Tutor] need help Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7F9@mbtlipnt02.btlabs.bt.co.uk> > What exactly am I supposed to do with this? What do you mean by "this"? Then mailing list? or the python language? Or the python program that you install (or may be already installed) on your computer? The mailing list ois for asking questions about the language and the program. (Also for answering questions other people ask....) The language is for computer programming and you can get an explanation of that in the first couple of topics in my tutorial(see below) The program is what you use to write/execute the programs that you (or other peopple) write using the language! Basic instructions are included in my tutor, more detailed instructions are in Danny Yoo's IDLE tutorial. A good place to start is the Beginners page on the python web site at: http://www.python.org/ Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From yduppen@xs4all.nl Thu Aug 8 11:04:00 2002 From: yduppen@xs4all.nl (Yigal Duppen) Date: Thu, 8 Aug 2002 12:04:00 +0200 Subject: [Tutor] String comparison In-Reply-To: <372DD7320F873B43929D49BFF86F950B645A33@cdc1.chennai.corp.hexaware.com> References: <372DD7320F873B43929D49BFF86F950B645A33@cdc1.chennai.corp.hexaware.com> Message-ID: <200208081204.00973.yduppen@xs4all.nl> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Anand, First of all, as stated by many other participants in this list, tutor is a list for newbies, so questions here are never stupid :) Python has no command for comparing strings irrespective of case; the usual approach is to lowercase (or uppercase) the strings before comparing them: >>> a = "a" >>> b = "B" >>> a < b 0 >>> a.lower() < b.lower() 1 >>> a.upper() < b.upper() 1 >>> a 'a' >>> b 'B' As you can see, both upper and lower return copies; they leave the original strings intact. Strings are immutable objects in Python. And just in case you might be worried about performance of this approach, as opposed to some compareIgnoreCase() function: don't be worried. Python's string operations are highly optimized and every Pythoneer reading the above code understands :) Hope this helps! YDD - -- http://www.xs4all.nl/~yduppen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9UkIQLsKMuCf5EdwRAvxfAKDDxs22gDX/eYHJexTXvJzvP5RYlgCgsl/U 8XczrynG9KjaUIpjClDdddw= =d1pI -----END PGP SIGNATURE----- From dyoo@hkn.eecs.berkeley.edu Thu Aug 8 11:43:50 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Thu, 8 Aug 2002 03:43:50 -0700 (PDT) Subject: [Tutor] String comparison In-Reply-To: <200208081204.00973.yduppen@xs4all.nl> Message-ID: On Thu, 8 Aug 2002, Yigal Duppen wrote: > Python has no command for comparing strings irrespective of case; the > usual approach is to lowercase (or uppercase) the strings before > comparing them: > > >>> a = "a" > >>> b = "B" > >>> a < b > 0 > >>> a.lower() < b.lower() > 1 > >>> a.upper() < b.upper() > 1 > >>> a > 'a' > >>> b > 'B' > > As you can see, both upper and lower return copies; they leave the > original strings intact. Strings are immutable objects in Python. By the way, in the Java language, there is a "equalsIgnoreCase()" function, but it's probably not as clever as you might expect. At least, in the GNU GCJ Java implementation, here's what it looks like: /******/ boolean java::lang::String::equalsIgnoreCase (jstring anotherString) { if (anotherString == NULL || count != anotherString->count) return false; jchar *tptr = JvGetStringChars (this); jchar *optr = JvGetStringChars (anotherString); jint i = count; while (--i >= 0) { jchar tch = *tptr++; jchar och = *optr++; if (tch != och && (java::lang::Character::toLowerCase (tch) != java::lang::Character::toLowerCase (och)) && (java::lang::Character::toUpperCase (tch) != java::lang::Character::toUpperCase (och))) return false; } return true; } /******/ (We can take a look at: http://subversions.gnu.org/cgi-bin/viewcvs/gcc/gcc/libjava/java/lang/natString.cc?rev=1.25.6.2&content-type=text/vnd.viewcvs-markup for the complete source code.) So, in GCJ's implementation of Java's String.equalsIgnoreCase(), it does a toLowerCase(), letter by letter, rather than what we'd do in Python by uppercasing the whole thing. Hmmm... actually, I'm curious why they have to compare both the lowercased and uppercased versions of each character though... Sorry, I get sidetracked a lot. *grin* Back to Python: we can always write a function to make things look nicer: ### def cmpIgnoresCase(s1, s2): """Returns a negative value if s1 is smaller than s2, zero if the two strings are equal, and a positive value if s1 is greater than s2, case insensitively""" return cmp(s1.upper(), s2.upper()) ### Best of wishes! From darnold02@sprynet.com Thu Aug 8 12:02:24 2002 From: darnold02@sprynet.com (Don Arnold) Date: Thu, 8 Aug 2002 06:02:24 -0500 Subject: [Tutor] String comparison References: Message-ID: <06b201c23ecb$1e6b31e0$f011ba3f@defaultcomp> ----- Original Message ----- From: "Danny Yoo" To: "Yigal Duppen" Cc: "Tutor" Sent: Thursday, August 08, 2002 5:43 AM Subject: Re: [Tutor] String comparison > > > On Thu, 8 Aug 2002, Yigal Duppen wrote: > > > Python has no command for comparing strings irrespective of case; the > > usual approach is to lowercase (or uppercase) the strings before > > comparing them: > > > > >>> a = "a" > > >>> b = "B" > > >>> a < b > > 0 > > >>> a.lower() < b.lower() > > 1 > > >>> a.upper() < b.upper() > > 1 > > >>> a > > 'a' > > >>> b > > 'B' > > > > As you can see, both upper and lower return copies; they leave the > > original strings intact. Strings are immutable objects in Python. > > > Sorry, I get sidetracked a lot. *grin* Back to Python: we can always > write a function to make things look nicer: > > ### > def cmpIgnoresCase(s1, s2): > """Returns a negative value if s1 is smaller than s2, zero if the two > strings are equal, and a positive value if s1 is greater than s2, case > insensitively""" > return cmp(s1.upper(), s2.upper()) > ### > I'm not sure if anyone has mentioned it yet, but to actually have your sort() method use this comparison function, you'll need to supply it as an argument to sort(): >>> list1 = ['E','d','C','b','A'] >>> list1.sort(CaseInsensitiveCmp) >>> print list1 ['A', 'b', 'C', 'd', 'E'] Hope that helps, Don From alan.gauld@bt.com Thu Aug 8 12:27:56 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 8 Aug 2002 12:27:56 +0100 Subject: [Tutor] Have a very simple question Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7FA@mbtlipnt02.btlabs.bt.co.uk> > Why does 'doesn\'t' translate to "doesn't" ? This is in the Python > tutorial but it doesn't say why this happens. Coz \ means that the next character will be treated literally. The next character is ' so Python does not see it as the end of the string but as a character within the string. But its more usual to achieve the same effect using different quotes: >>>str1 = 'doesn\'t' >>>str2 = "doesn't" >>>str1 == str2 # should be true 1 >>> HTH, Alan g From kb@mm.st Thu Aug 8 12:36:29 2002 From: kb@mm.st (Kyle Babich) Date: Thu, 8 Aug 2002 11:36:29 UT Subject: [Tutor] My first counter... is broken. Message-ID: <20020808113629.D5F7E939FA@server2.fastmail.fm> I thought I would try to make my first counter. Once I wrote it and worked a bug out my counter started working... well, sort of. It counted 1, 2, and then it jumped to something in the hundreds, then thousands, and then the page just went white. This is what showed in my error log: Traceback (most recent call last): File "/home/sites/kmb/www/public_html/njindenial/counter.py", line 8, in ? number =3D int(number) ValueError: int() literal too large: 01213121412131215 So I guess the number got too big to be an int()? But it should have been counting by 1's not jumping around into hundreds and thousands. Here is my code: #################### #! /usr/bin/python print "Content-type: text/html" print counter =3D open("counter.dat", "r+") number =3D counter.read() number =3D int(number) number =3D number + 1 counter.write("%(number)s" % vars()) counter.close() print "Visior #%(number)s" % vars() #################### What do I need to do? Thank you, -- Kyle From alan.gauld@bt.com Thu Aug 8 12:40:59 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 8 Aug 2002 12:40:59 +0100 Subject: [Tutor] String comparison Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7FB@mbtlipnt02.btlabs.bt.co.uk> > How do I perform a string comparison in Python. if str1 == str2:... if str1 < str2:.... etc Also using cmp() cmp(str1,str2) returns -1,0,1 for less than, equal, greater than... > This is because of the ASCII values of upper case letters > which is smaller than those of lower case ones. Is there any > command which will compare irrespective of the cases. No, but you can convcert case with the upper() and lower() methods of string objects: str1 = "Hero" str2 = "here" cmp(str1,str2) str1 will be less that str2 coz of the uppercase H. Now try cmp(str1.upper(),str2.upper()) str2 should be lower because it ends in 'e'... HTH, Alan G. From yduppen@xs4all.nl Thu Aug 8 13:12:36 2002 From: yduppen@xs4all.nl (Yigal Duppen) Date: Thu, 8 Aug 2002 14:12:36 +0200 Subject: [Tutor] My first counter... is broken. In-Reply-To: <20020808113629.D5F7E939FA@server2.fastmail.fm> References: <20020808113629.D5F7E939FA@server2.fastmail.fm> Message-ID: <200208081412.36903.yduppen@xs4all.nl> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > ValueError: int() literal too large: 01213121412131215 > > So I guess the number got too big to be an int()? But it should have > been counting by 1's not jumping around into hundreds and thousands. > Here is my code: > > counter = open("counter.dat", "r+") > number = counter.read() > number = int(number) > number = number + 1 > counter.write("%(number)s" % vars()) > counter.close() What happens here is that each new number is _appended_ to the 'counter.dat' file. So, in successive runs, the following will happen: 1. read 0, write 1 2. read 01, write 2 3. read 012, write 13 4. read 01213, write 1214 5. read 012131214, write 01213121412131215 6. read and boom; note how the number corresponds exactly to your error So there are two options: 1. after reading, go back to the beginning using counter.seek(0) 2. separate reading from writing as follows: # reading counter = open("counter.dat", "r") number = int(counter.read()) + 1 counter.close() # writing counter = open("counter.dat", "w") counter.write(str(number)) counter.close() - -- http://www.xs4all.nl/~yduppen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9UmA0LsKMuCf5EdwRApamAJ0cjfpoBFr7woIzGNtV8FfrnTRRdgCg4C5Q qLt8mNAUGAjPyvqXIQ3cnhc= =zJrl -----END PGP SIGNATURE----- From neutron878@oco.net Wed Aug 7 23:12:06 2002 From: neutron878@oco.net (Ricardo Ortega) Date: Wed, 7 Aug 2002 18:12:06 -0400 (Eastern Daylight Time) Subject: [Tutor] ASP Message-ID: <3D519B36.000008.01484@palamino> --------------Boundary-00=_60VHRN00000000000000 Content-Type: Multipart/Alternative; boundary="------------Boundary-00=_60VHMY50000000000000" --------------Boundary-00=_60VHMY50000000000000 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi I am attempting to learn how to use python with asp. I have set up IIS= on a Windows 2000 server and have succesfully run a sample python asp pa= ge to confirm that I set everything up correctly. What I need now are som= e tutorials, refrence guides or something similar any help would be great= ly appreciated. Thank you, --------------Boundary-00=_60VHMY50000000000000 Content-Type: Text/HTML; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =0D =0A
Hi I am attempting to learn how to use python with asp. I have= set up=20 IIS on a Windows 2000 server and have succesfully run a sample pyth= on asp=20 page to confirm that I set everything up correctly. What I need now= are=20 some tutorials, refrence guides or something similar any help would= be=20 greatly appreciated. Thank you,
____________________________________________________
  IncrediMail - Email has finally evolved -=20
Click=20 Here --------------Boundary-00=_60VHMY50000000000000-- --------------Boundary-00=_60VHRN00000000000000 Content-Type: image/gif Content-Transfer-Encoding: base64 Content-ID: R0lGODlhFAAPALMIAP9gAM9gAM8vAM9gL/+QL5AvAGAvAP9gL////wAAAAAAAAAAAAAAAAAAAAAA AAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJFAAIACwAAAAAFAAPAAAEVRDJSaudJuudrxlEKI6B URlCUYyjKpgYAKSgOBSCDEuGDKgrAtC3Q/R+hkPJEDgYCjpKr5A8WK9OaPFZwHoPqm3366VKyeRt E30tVVRscMHDqV/u+AgAIfkEBWQACAAsAAAAABQADwAABBIQyUmrvTjrzbv/YCiOZGmeaAQAIfkE CRQACAAsAgABABAADQAABEoQIUOrpXIOwrsPxiQUheeRAgUA49YNhbCqK1kS9grQhXGAhsDBUJgZ AL2Dcqkk7ogFpvRAokSn0p4PO6UIuUsQggSmFjKXdAgRAQAh+QQFCgAIACwAAAAAFAAPAAAEEhDJ Sau9OOvNu/9gKI5kaZ5oBAAh+QQJFAAIACwCAAEAEAANAAAEShAhQ6ulcg7Cuw/GJBSF55ECBQDj 1g2FsKorWRL2CtCFcYCGwMFQmBkAvYNyqSTuiAWm9ECiRKfSng87pQi5SxCCBKYWMpd0CBEBACH5 BAVkAAgALAAAAAAUAA8AAAQSEMlJq7046827/2AojmRpnmgEADs= --------------Boundary-00=_60VHRN00000000000000 Content-Type: Image/jpeg Content-ID: <8C82A4BC-DF35-4B54-AB5D-F92790159203> Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAHgAA/+4AIUFkb2JlAGTAAAAAAQMA EAMCAwYAAAHbAAAC1gAABZX/2wCEABALCwsMCxAMDBAXDw0PFxsUEBAUGx8XFxcXFx8eFxoaGhoX Hh4jJSclIx4vLzMzLy9AQEBAQEBAQEBAQEBAQEABEQ8PERMRFRISFRQRFBEUGhQWFhQaJhoaHBoa JjAjHh4eHiMwKy4nJycuKzU1MDA1NUBAP0BAQEBAQEBAQEBAQP/CABEIAGUAcwMBIgACEQEDEQH/ xACAAAEBAQEAAAAAAAAAAAAAAAAAAQIGAQEBAAAAAAAAAAAAAAAAAAAAARABAAICAwEAAgMAAAAA AAAAAQARIQIxQRIiQDIQMFARAAICAgIBBAIDAQEAAAAAAAERACExQVFhcYGRobECEsHhMtHxEgEA AAAAAAAAAAAAAAAAAABQ/9oADAMBAAIRAxEAAADtRZYE1ASghQFgUZoCkKSwLmhcllAEqkSkqFAl hUomoAS3IoJqFlDNpFEAQFE1AIVYAWIVKAJRNZpYCwVmmshKACA0CBAUCBYGwf/aAAgBAgABBQD8 B/yP/9oACAEDAAEFAPz6/or8H//aAAgBAQABBQC2+ZeHjbD+saX6hwXeDW1Rg4xLLTa+m7ZiIEsI 1MTiHP1dYpvFADiFM1/X6nq9byuwdPPz5oFofWlEMQ9ULKrWq2ppG9Y2J6INQma9lVTRdlUKgHzX XSEECw1SYu5WsGoJPkisZYpx31GvXZQ/JM3VwShzVTsp1EZbBI8LcaUSih86+s2Zl4Wp6+lAZnVs Dkjdku5m+lJTdXDG2SHM9M2wKX1YxsaZTTwmoVrYnqsMrM652yjs01K0mtbGAz6Y5dpfqNz06qpq 5QNjiIjiZtbhtceNuf0jyeqGgu6rXMvI4omPWbPMYzEfMI+axHnFvOP4/9oACAECAgY/AGP/2gAI AQMCBj8AY//aAAgBAQEGPwB72Yucb1BfIhFEaeZ+xRXFQELN+HEUQdjU0Xn4g9gRCQcpw1yajGYs P/kFvUzvjUBWrIMFHI2OJQNEAjiEEFdTmfG/MTHq5RFOnpTV3kzCBx7x4YOD1AV5uYJvnqMA0hep jfwpYCwC4Bx3q55zeZRBCw9TkoIuHw78RdczSNH2mgqcLpRC+RASAkA3B13mcYd5mR84c/yOx4lW tRAZ6mGDhiP9WgXVyhWA+xDgMOWGMsTg/wBTz8SjjXrP8hHIlX1MZ6mDzgc/cIV/iyN1GBR0MQMK jnEzvvMz8mUkErKlfqU63iV+IKNH7mNZBLFQEpEDeDOV32IVn8WR4caoywqI2p695mbZzNUQIcKf k0bo+0NpCqn7CiQiNGXkdQen1DpjGeZ7WNw3pK+I93maCPc16+Zkf6XxMCsFwAkaiIB57vc/IAhZ /HqZBBbB0ZokAEOGxsYqBgPp8agQBu4VSMJdqx6SwDsGBrTmAR93uZGX6KePowEADAIjoX8gw459 CICaW/MLGvodQfkDW71zBxRHtB3j3jC4PMIYoAgKNfPMCQNN7jCzvlzXPopzhQvNZY3CRya9ZrEF fRE0iCB5mscZuVYfKmAi94uE3Q8qfytQ7xD0svmFcmaxNPI8iMjh3pmF2HbzqeUi+YkiD/MrOl5L mbwPuWVfmXpv3hDH8qAjPpiZHXkRnSd6ZhB53mejzKV6US0K9TCCLyCeIhtETX5MsHBGJkD/ANiF kMCE2qGoCdZ8Q8AMGpYFqEhdhRIYH3CF3d1M/Mexma+4CwdQ2Ddcx0exAlmj04QUQd8QWLB/iB5G xmEg5TENVZqPYzFV8eHAy9T/AEc8a4n3Ov6g/VwvE6lpQ4VNysXzhS8esOO8w/rlF/rypjV3B5H1 Knr8T//Z --------------Boundary-00=_60VHRN00000000000000-- From shey@argonaut.com Thu Aug 8 14:15:32 2002 From: shey@argonaut.com (shey crompton) Date: Thu, 8 Aug 2002 14:15:32 +0100 Subject: [Tutor] User input question Message-ID: <415C917D807AD411B72C00805FF7330B03836341@MAILSRV> I have been trying to modify a script that prints out the times tables to one that asks the user to input which times table they would like printed out (between 1 and 13). I have tried so many different ways of doing this without any success. I am sure it's a simple answer, but I am starting to get frustrated. The script below is my latest attempt, and the error message I get is below it. Hints, and tips greatly appreciated. Shey def timestab(n): if i < 13: print "%d x %d = %d" % (i,n,i*n) else: print "Only positive numbers between 1 and 12 please!" i = input('Try a number ') print timestab(i) The error message is: File "C:\Documents and Settings\shey\Desktop\timesTab_8.py", line 15 print timestab(i) ^ SyntaxError: invalid syntax From rob@uselesspython.com Thu Aug 8 15:18:02 2002 From: rob@uselesspython.com (Rob) Date: Thu, 8 Aug 2002 09:18:02 -0500 Subject: [Tutor] String comparison In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C7FB@mbtlipnt02.btlabs.bt.co.uk> Message-ID: > > How do I perform a string comparison in Python. > > if str1 == str2:... > if str1 < str2:.... > > etc > > Also using cmp() > > cmp(str1,str2) > > returns -1,0,1 for less than, equal, greater than... > > I wrote a short article called "Joe Useless Writes A Program" for Useless Python earlier this summer, in which cmp() is explained (a little bit, anyway) and fleshed into a whole program. If anyone's interested, here's the URL: http://uselesspython.com/JoeUselessWritesAProgram.html It still needs a bit of work, but I don't think it's too shabby. Rob From kb@mm.st Thu Aug 8 15:02:23 2002 From: kb@mm.st (Kyle Babich) Date: Thu, 8 Aug 2002 14:02:23 UT Subject: [Tutor] User input question Message-ID: <20020808140223.3128493715@server2.fastmail.fm> I'm still a newbie to python so I am taking my best guess in saying to un-indent the print that is causing the error. On Thu, 8 Aug 2002 14:15:32 +0100, "shey crompton" said: > I have been trying to modify a script that prints out the times tables > to > one that asks the user to input which times table they would like > printed > out (between 1 and 13). > I have tried so many different ways of doing this without any success. > I am > sure it's a simple answer, but I am starting to get frustrated. > The script below is my latest attempt, and the error message I get is > below > it.=20 > Hints, and tips greatly appreciated. >=20 > Shey >=20 >=20 > def timestab(n): > if i < 13: > print "%d x %d =3D %d" % (i,n,i*n) > else: > print "Only positive numbers between 1 and 12 please!" >=20 > i =3D input('Try a number ') > print timestab(i) >=20 >=20 > The error message is: >=20 > File "C:\Documents and Settings\shey\Desktop\timesTab_8.py", line 15 > print timestab(i) > ^ > SyntaxError: invalid syntax >=20 > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor >=20 -- Kyle From magnus@thinkware.se Thu Aug 8 15:28:02 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Thu, 08 Aug 2002 16:28:02 +0200 Subject: [Tutor] (no subject) In-Reply-To: Message-ID: <5.1.0.14.0.20020808160030.029497b0@www.thinkware.se> At 00:27 2002-08-08 +0100, steven bruce wrote: >Hi everyone again, > >I have sorted it now thanks to all your help and just to give you all a=20 >good laugh I thought id show you how not to do it. You are not so far off...but details make a big difference in programming. A few tips: If you ask for a password, you don't want it echoed to the screen in case someone looks over your shoulder. Use the "getpass" module as below. Secondly, an authentication routine is suitable for breaking out from the general program flow, so make it a function that returns different values for success and failure. (From version 2.3 (I think) the values true and false will be included in the Python language, but for now, 1 and 0 will do.) I placed your code indented in a function definition, and call the function below. For your 'count < max' to make sense you need to make a loop. You do that with the "while" statement. (I don't understand what 'password !=3D "steve":' was supposed to mean.) BTW, you should avoid redundant information such as in: if password =3D=3D "steve": count =3D 4 elif password <> "steve": count =3D count + 1 That is exactly the same thing as: if password =3D=3D "steve": count =3D 4 else: count =3D count + 1 Apart from being a bit faster, less typing and easier to read, the second version is less likely to cause problems when you change the password from steve to something else. One rainy day you will change the password in one place, but not in the other, like this: if password =3D=3D "batman": count =3D 4 elif password <> "steve": count =3D count + 1 In this case, count won't be incremented if the user persists in trying to log in as steve. So, remember that it's a virtue to be a lazy programmer! Type less! def authenticate(): count =3D 0 max =3D 4 while count < max: count =3D count + 1 password =3D getpass.getpass("What is your secret password? ") if password =3D=3D "steve": return 1 print "Sorry, only", max, "tries allowed!" return 0 if authenticate(): print "Access OK" else: print "Access denied" Now it might be a good time to introduce code to read the secret password from a file, and to allow for several users/passwords. Or perhaps to put the code to some real use... Good luck, Magnus --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From shey@argonaut.com Thu Aug 8 15:32:08 2002 From: shey@argonaut.com (shey crompton) Date: Thu, 8 Aug 2002 15:32:08 +0100 Subject: [Tutor] User input question Message-ID: <415C917D807AD411B72C00805FF7330B03836348@MAILSRV> That's got rid of the error message, thanks. It now just squares the number that the user inputs, and also returns 'None' on the line below (confused?). I am thinking I need a range command to get it to do multiply within a range. I have just tried adding: For n in range(1,13): Between the 'def' line and the if statement with no result. Oh well, gives me something else to ponder on during an otherwise boring day at work. :-) -----Original Message----- From: Kyle Babich [mailto:kb@mm.st] Sent: 08 August 2002 15:02 To: shey crompton; tutor Subject: Re: [Tutor] User input question I'm still a newbie to python so I am taking my best guess in saying to un-indent the print that is causing the error. On Thu, 8 Aug 2002 14:15:32 +0100, "shey crompton" said: > I have been trying to modify a script that prints out the times tables > to > one that asks the user to input which times table they would like > printed > out (between 1 and 13). > I have tried so many different ways of doing this without any success. > I am > sure it's a simple answer, but I am starting to get frustrated. > The script below is my latest attempt, and the error message I get is > below > it. > Hints, and tips greatly appreciated. > > Shey > > > def timestab(n): > if i < 13: > print "%d x %d = %d" % (i,n,i*n) > else: > print "Only positive numbers between 1 and 12 please!" > > i = input('Try a number ') > print timestab(i) > > > The error message is: > > File "C:\Documents and Settings\shey\Desktop\timesTab_8.py", line 15 > print timestab(i) > ^ > SyntaxError: invalid syntax > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- Kyle From rob@uselesspython.com Thu Aug 8 15:39:55 2002 From: rob@uselesspython.com (Rob) Date: Thu, 8 Aug 2002 09:39:55 -0500 Subject: [Tutor] (no subject) In-Reply-To: Message-ID: I see you have already received a few responses, so I'll just add one little handy thing: >>> count = 0 >>> count = count + 1 >>> count 1 >>> count += 1 >>> count 2 Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > steven bruce > Sent: Wednesday, August 07, 2002 6:28 PM > To: tutor@python.org > Subject: [Tutor] (no subject) > > > Hi everyone again, > > I have sorted it now thanks to all your help and just to give you > all a good > laugh I thought id show you how not to do it. > > > password = "hjgjhj" > password != "steve": > count = 0 > max = 4 > count < max > password = raw_input ("What is your Username? ") > if password == "steve": > count = 4 > elif password <> "steve": > count = count + 1 > print "Hi",password > > I really appreciate all the e-mails. I didnt quite expect that sort of > reaction but goes to prove what an excellent site for beginners. > > Many Thanks > > Steve > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From magnus@thinkware.se Thu Aug 8 15:42:57 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Thu, 08 Aug 2002 16:42:57 +0200 Subject: [Tutor] My first counter... is broken. In-Reply-To: <20020808113629.D5F7E939FA@server2.fastmail.fm> Message-ID: <5.1.0.14.0.20020808163243.028c54b0@www.thinkware.se> At 11:36 2002-08-08 +0000, Kyle Babich wrote: >I thought I would try to make my first counter. Once I wrote it and >worked a bug out my counter started working... well, sort of. >It counted 1, 2, and then it jumped to something in the hundreds, then >thousands, and then the page just went white. >This is what showed in my error log: > >Traceback (most recent call last): > File "/home/sites/kmb/www/public_html/njindenial/counter.py", line 8, > in ? > number =3D int(number) >ValueError: int() literal too large: 01213121412131215 Can't you guess? Perhaps you could have a look in the file after each access, and you might figure it out. (I don't really want to take this debugging experience away from you. You will probably get this Aha! experience after a while.) Make sure there are no parallel executions of the script while you debug it. Hint: What does FILEOBJECT.write() really do? What would happen if you called it several times? What is FILEOBJECT.seek() for? --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From dturner@e-healthconsultants.com Thu Aug 8 15:57:24 2002 From: dturner@e-healthconsultants.com (David Turner) Date: Thu, 8 Aug 2002 15:57:24 +0100 Subject: [Tutor] User input question Message-ID: OK guys, bear with me - this is my first EVER foray into Python, but I think I may have stumbled clumsily into a solution (of sorts).... Here goes.... ***** def timestab(n): m = 1 if i < 13: while m < 14: print "%d x %d = %d" % (m,n,m*n) m = m + 1 else: print "Only positive numbers between 1 and 12 please!" i = input('Try a number ') print timestab(i) ***** This seems to work OK (but I guess there will be far cleaner, neater ways to do it), and it doesn't get rid of the "None" at the bottom of the list... But anyway, since this was my first ever go with Python, I'm quite pleased with myself nonetheless!! *LARGE GRIN* Cheers DT -----Original Message----- From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of shey crompton Sent: 08 August 2002 15:32 To: tutor Subject: RE: [Tutor] User input question That's got rid of the error message, thanks. It now just squares the number that the user inputs, and also returns 'None' on the line below (confused?). I am thinking I need a range command to get it to do multiply within a range. I have just tried adding: For n in range(1,13): Between the 'def' line and the if statement with no result. Oh well, gives me something else to ponder on during an otherwise boring day at work. :-) -----Original Message----- From: Kyle Babich [mailto:kb@mm.st] Sent: 08 August 2002 15:02 To: shey crompton; tutor Subject: Re: [Tutor] User input question I'm still a newbie to python so I am taking my best guess in saying to un-indent the print that is causing the error. On Thu, 8 Aug 2002 14:15:32 +0100, "shey crompton" said: > I have been trying to modify a script that prints out the times tables > to > one that asks the user to input which times table they would like > printed > out (between 1 and 13). > I have tried so many different ways of doing this without any success. > I am > sure it's a simple answer, but I am starting to get frustrated. > The script below is my latest attempt, and the error message I get is > below > it. > Hints, and tips greatly appreciated. > > Shey > > > def timestab(n): > if i < 13: > print "%d x %d = %d" % (i,n,i*n) > else: > print "Only positive numbers between 1 and 12 please!" > > i = input('Try a number ') > print timestab(i) > > > The error message is: > From shey@argonaut.com Thu Aug 8 15:59:13 2002 From: shey@argonaut.com (shey crompton) Date: Thu, 8 Aug 2002 15:59:13 +0100 Subject: [Tutor] User input question Message-ID: <415C917D807AD411B72C00805FF7330B03836349@MAILSRV> Ahh, I see where I was going wrong now. Thanks. Out of curiosity, the if __name__ == "__main__": line... Where does __name__ and __main__ refer to in the script? -----Original Message----- From: ibraheem umaru-mohammed [mailto:iumarumo@eidosnet.co.uk] Sent: 08 August 2002 15:34 To: shey crompton Subject: Re: [Tutor] User input question [shey crompton wrote...] -| I have been trying to modify a script that prints out the times tables to -| one that asks the user to input which times table they would like printed -| out (between 1 and 13). -| I have tried so many different ways of doing this without any success. I am -| sure it's a simple answer, but I am starting to get frustrated. -| The script below is my latest attempt, and the error message I get is below -| it. -| Hints, and tips greatly appreciated. -| -| Shey -| -| -| def timestab(n): -| if i < 13: -| print "%d x %d = %d" % (i,n,i*n) -| else: -| print "Only positive numbers between 1 and 12 please!" -| -| i = input('Try a number ') -| print timestab(i) -| -| -| The error message is: -| -| File "C:\Documents and Settings\shey\Desktop\timesTab_8.py", line 15 -| print timestab(i) -| ^ -| SyntaxError: invalid syntax -| Firstly, the error you get is because of the whitespace in front of the print statement. Secondly, timestab doesn't explicitly return anything, so print'ing the return of timestab, will print 'None'. Thirdly, the timestab function checks that the value of i is less than 13, but doesn't check whether it is greater than zero. Fourthly, it is safer to use "raw_input" instead of "input", because input can return the result of an expression, and unless you trust your users, (which you shouldn't) then they might do something harmful. Finally, if you want to print the times table for a given number upto a given number, then you are going to need some sort of loop... Have a look at the following changes I have made: ...... #!/usr/bin/python def timestable(n): if n in range(1,13): for i in range(1,13): print "%d x %d = %d" % (n,i,n*i) else: print "Only positive numbers between 1 and 12 inclusive please" if __name__ == "__main__": userinput = raw_input("Please enter a number between 1 and 12 inclusive: ") try: timestable(int(userinput)) except ValueError, e: print "Invalid number entered" ...... Hope that helps a little. Kindest regards, --ibs. -- ibraheem umaru-mohammed www.micromuse.com --0-- From rob@uselesspython.com Thu Aug 8 16:27:17 2002 From: rob@uselesspython.com (Rob) Date: Thu, 8 Aug 2002 10:27:17 -0500 Subject: [Tutor] User input question In-Reply-To: Message-ID: May I also add a suggestion about the use of input() in this case? When you use input(), a user can provide input that you might expect, which could cause problems. An alternative solution is to use raw_input, and convert the input to the desired integer: >>> myInt = raw_input('try a number ') try a number 4 >>> myInt '4' # notice that '4' is a string >>> myInt = int(myInt) # this converts myInt into an integer and stores it under the same name >>> myInt 4 # myInt is now an integer! Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > David Turner > Sent: Thursday, August 08, 2002 9:57 AM > To: tutor@python.org > Subject: RE: [Tutor] User input question > > > OK guys, bear with me - this is my first EVER foray into Python, > but I think > I may have stumbled clumsily into a solution (of sorts).... > > Here goes.... > > ***** > > def timestab(n): > m = 1 > if i < 13: > while m < 14: > print "%d x %d = %d" % (m,n,m*n) > m = m + 1 > else: > print "Only positive numbers between 1 and 12 please!" > > > i = input('Try a number ') > print timestab(i) > > ***** > > > This seems to work OK (but I guess there will be far cleaner, > neater ways to > do it), and it doesn't get rid of the "None" at the bottom of the list... > > But anyway, since this was my first ever go with Python, I'm quite pleased > with myself nonetheless!! *LARGE GRIN* > > Cheers > > DT > > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > shey crompton > Sent: 08 August 2002 15:32 > To: tutor > Subject: RE: [Tutor] User input question > > > That's got rid of the error message, thanks. > It now just squares the number that the user inputs, and also > returns 'None' > on the line below (confused?). > > I am thinking I need a range command to get it to do multiply within a > range. I have just tried adding: > For n in range(1,13): > Between the 'def' line and the if statement with no result. Oh well, gives > me something else to ponder on during an otherwise boring day at work. :-) > > > -----Original Message----- > From: Kyle Babich [mailto:kb@mm.st] > Sent: 08 August 2002 15:02 > To: shey crompton; tutor > Subject: Re: [Tutor] User input question > > I'm still a newbie to python so I am taking my best guess in saying to > un-indent the print that is causing the error. > > On Thu, 8 Aug 2002 14:15:32 +0100, "shey crompton" > said: > > I have been trying to modify a script that prints out the times tables > > to > > one that asks the user to input which times table they would like > > printed > > out (between 1 and 13). > > I have tried so many different ways of doing this without any success. > > I am > > sure it's a simple answer, but I am starting to get frustrated. > > The script below is my latest attempt, and the error message I get is > > below > > it. > > Hints, and tips greatly appreciated. > > > > Shey > > > > > > def timestab(n): > > if i < 13: > > print "%d x %d = %d" % (i,n,i*n) > > else: > > print "Only positive numbers between 1 and 12 please!" > > > > i = input('Try a number ') > > print timestab(i) > > > > > > The error message is: > > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From rob@uselesspython.com Thu Aug 8 16:57:36 2002 From: rob@uselesspython.com (Rob) Date: Thu, 8 Aug 2002 10:57:36 -0500 Subject: [Tutor] User input question In-Reply-To: Message-ID: I decided to follow up on myself and show an example of unexpected side-effects of the use of input(): >>> def silliness(): for i in range(1,4): print i >>> myInt = input("Please input an integer: ") Please input an integer: silliness() 1 2 3 In this case, the programmer had a function called silliness(), which has nothing to do with the request for an integer to be input from the user. The user input a call to the silliness() function instead of an integer, and input() did precisely what the programmer told it to do, which turned out to be an invocation of a function. In this case, the result was fairly harmless. However, you might be able to imagine some examples in which the result would be less pleasant. This isn't intended to scare people off from the use of input(), of course. As you can see, it is a powerful tool indeed, and you just might find it comes in handy later on. Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > Rob > Sent: Thursday, August 08, 2002 10:27 AM > To: Python Tutor > Subject: RE: [Tutor] User input question > > > May I also add a suggestion about the use of input() in this > case? When you > use input(), a user can provide input that you might expect, which could > cause problems. > > An alternative solution is to use raw_input, and convert the input to the > desired integer: > > >>> myInt = raw_input('try a number ') > try a number 4 > >>> myInt > '4' > > # notice that '4' is a string > > >>> myInt = int(myInt) > > # this converts myInt into an integer and stores it under the same name > > >>> myInt > 4 > > # myInt is now an integer! > > Rob > http://uselesspython.com > > > -----Original Message----- > > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > > David Turner > > Sent: Thursday, August 08, 2002 9:57 AM > > To: tutor@python.org > > Subject: RE: [Tutor] User input question > > > > > > OK guys, bear with me - this is my first EVER foray into Python, > > but I think > > I may have stumbled clumsily into a solution (of sorts).... > > > > Here goes.... > > > > ***** > > > > def timestab(n): > > m = 1 > > if i < 13: > > while m < 14: > > print "%d x %d = %d" % (m,n,m*n) > > m = m + 1 > > else: > > print "Only positive numbers between 1 and 12 please!" > > > > > > i = input('Try a number ') > > print timestab(i) > > > > ***** > > > > > > This seems to work OK (but I guess there will be far cleaner, > > neater ways to > > do it), and it doesn't get rid of the "None" at the bottom of > the list... > > > > But anyway, since this was my first ever go with Python, I'm > quite pleased > > with myself nonetheless!! *LARGE GRIN* > > > > Cheers > > > > DT > > > > -----Original Message----- > > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > > shey crompton > > Sent: 08 August 2002 15:32 > > To: tutor > > Subject: RE: [Tutor] User input question > > > > > > That's got rid of the error message, thanks. > > It now just squares the number that the user inputs, and also > > returns 'None' > > on the line below (confused?). > > > > I am thinking I need a range command to get it to do multiply within a > > range. I have just tried adding: > > For n in range(1,13): > > Between the 'def' line and the if statement with no result. Oh > well, gives > > me something else to ponder on during an otherwise boring day > at work. :-) > > > > > > -----Original Message----- > > From: Kyle Babich [mailto:kb@mm.st] > > Sent: 08 August 2002 15:02 > > To: shey crompton; tutor > > Subject: Re: [Tutor] User input question > > > > I'm still a newbie to python so I am taking my best guess in saying to > > un-indent the print that is causing the error. > > > > On Thu, 8 Aug 2002 14:15:32 +0100, "shey crompton" > > said: > > > I have been trying to modify a script that prints out the times tables > > > to > > > one that asks the user to input which times table they would like > > > printed > > > out (between 1 and 13). > > > I have tried so many different ways of doing this without any success. > > > I am > > > sure it's a simple answer, but I am starting to get frustrated. > > > The script below is my latest attempt, and the error message I get is > > > below > > > it. > > > Hints, and tips greatly appreciated. > > > > > > Shey > > > > > > > > > def timestab(n): > > > if i < 13: > > > print "%d x %d = %d" % (i,n,i*n) > > > else: > > > print "Only positive numbers between 1 and 12 please!" > > > > > > i = input('Try a number ') > > > print timestab(i) > > > > > > > > > The error message is: > > > > > > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > http://mail.python.org/mailman/listinfo/tutor > > > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From alan.gauld@bt.com Thu Aug 8 17:05:01 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 8 Aug 2002 17:05:01 +0100 Subject: [Tutor] My first counter... is broken. Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C800@mbtlipnt02.btlabs.bt.co.uk> > Traceback (most recent call last): > File > "/home/sites/kmb/www/public_html/njindenial/counter.py", line 8, > in ? > number = int(number) > ValueError: int() literal too large: 01213121412131215 > > So I guess the number got too big to be an int()? Lets look at that wjhats happening more closely: First it reads 0 so adds 1 to get 1 It aopends the 1 to the file to get 01 It reads 01 to get 1, 1+1=2 and appends to the file: 012 It reads 012=12, 12+1=13, appends to file 01213 It reads 01213, 1213+1=1214, append = 012131214 It reads 012131214, add 1 to get 12131215, append = 1213121412131215 It tries the file but can't convert it coz its too big... > #################### > #! /usr/bin/python > counter = open("counter.dat", "r+") > number = counter.read() This reads the whole file, try reading as lines with readlines() > number = int(number) then use slicing to get the last one: number = int(numbers[-1]) # NB numbers to store the readlines() > counter.write("%(number)s" % vars()) write adds to the end of the file but with no newline... Use writeline() to write your number into a new line. But since you probably don't want a file with an incrementing number on each line a better way is to use the seeek(0) call to rewind the file to the beginning and overwrite the line each time, then you can use readline() to just read a single line... HTH, Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Thu Aug 8 17:12:51 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 8 Aug 2002 17:12:51 +0100 Subject: [Tutor] ASP Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C801@mbtlipnt02.btlabs.bt.co.uk> Please use plain text when posting to public mailing lists. > Hi I am attempting to learn how to use python with asp. > I have set up IIS on a Windows 2000 server and have > succesfully run a sample python asp page to confirm > that I set everything up correctly. Well done thats the hard bit! > What I need now are some tutorials, refrence guides > or something similar any help would be greatly > appreciated. Depends on what level you are at. Do you know Python but not ASP? Do you know ASP but not Python? Do you not know either of them? If the first try any of the ASP tutorials on the web, there are many good ones. Next look at Mark Hammonds stuff on accessing COM from Python. If the second the official tutor that comes with python documentation is the best starting point. If you know ASP in another language theres little new in using Python. The only other tweek you'll need to look for is the winall stuff needed to use ASP and how it accesses COM objects. The only other caveat I'd offer is wroite as much of the Python stuff in functions at the top of the file then the inline stuff will mostly be single line code. Pythons indenting rules can get a bit messed up when used inline in ASP HTML. If you kow neither learn Python first then ASP. Start at the newbies page on the Python web site. Or even at my tutor :-) Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Thu Aug 8 17:24:28 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 8 Aug 2002 17:24:28 +0100 Subject: [Tutor] User input question Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C802@mbtlipnt02.btlabs.bt.co.uk> > The script below is my latest attempt, and the error message > I get is below it. Hi shey. To start at the end first... > i = input('Try a number ') > print timestab(i) This sets i to the number you want. And you correctly pass it to timestab but timestab doesn't return a printable result. It only prints things itself. Remove the print as a first step. Next, you have indented the timestab(which is why you get an error). Indentation is all important in Python and should only happen after an if test or a loop construct or something similar(basically after a line witrh a colon(:) at the end... Now lets look at timetab itself: > def timestab(n): > if i < 13: The function takes a parameter called n. Although you passed in an argument value held in a variable called 'i' the function seees that value as being stored in the parameter, n. Thus you need to do if n < 13: > print "%d x %d = %d" % (i,n,i*n) Since i is not defined and n holds whatever value i was when you passed it in this won't work either. Also it will only print this single line not the whole table, for that you need a loop of some kind. Assuming you are using my tutor (looks very like it! :-) you need to go and look at the function in the tutor again. Duplicate that within your function but change the value to refer to n. Finally, there is another way to go about things using namespace control described elsewhere in my tutor, but in this case its not a very good solution (I don't think it would do what you want!) so I won't tell you about it(yet)! :-) HTH Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Thu Aug 8 17:29:24 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 8 Aug 2002 17:29:24 +0100 Subject: [Tutor] User input question Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C803@mbtlipnt02.btlabs.bt.co.uk> > That's got rid of the error message, thanks. > It now just squares the number that the user inputs, and also > returns 'None' Gosh, blush! Of course it will see the i value because its global and you aren't assigning it. Oops, however thats still not what you are trying to do and your code should probably use the n instead of i inside the function as per my previous mail - which also explains why its printing None... Sorry, Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld > on the line below (confused?). > > I am thinking I need a range command to get it to do multiply within a > range. I have just tried adding: > For n in range(1,13): > Between the 'def' line and the if statement with no result. > Oh well, gives > me something else to ponder on during an otherwise boring day > at work. :-) > > > -----Original Message----- > From: Kyle Babich [mailto:kb@mm.st] > Sent: 08 August 2002 15:02 > To: shey crompton; tutor > Subject: Re: [Tutor] User input question > > I'm still a newbie to python so I am taking my best guess in saying to > un-indent the print that is causing the error. > > On Thu, 8 Aug 2002 14:15:32 +0100, "shey crompton" > said: > > I have been trying to modify a script that prints out the > times tables > > to > > one that asks the user to input which times table they would like > > printed > > out (between 1 and 13). > > I have tried so many different ways of doing this without > any success. > > I am > > sure it's a simple answer, but I am starting to get frustrated. > > The script below is my latest attempt, and the error > message I get is > > below > > it. > > Hints, and tips greatly appreciated. > > > > Shey > > > > > > def timestab(n): > > if i < 13: > > print "%d x %d = %d" % (i,n,i*n) > > else: > > print "Only positive numbers between 1 and 12 please!" > > > > i = input('Try a number ') > > print timestab(i) > > > > > > The error message is: > > > > File "C:\Documents and Settings\shey\Desktop\timesTab_8.py", line 15 > > print timestab(i) > > ^ > > SyntaxError: invalid syntax > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > http://mail.python.org/mailman/listinfo/tutor > > > > -- > Kyle > > From alan.gauld@bt.com Thu Aug 8 17:40:28 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 8 Aug 2002 17:40:28 +0100 Subject: [Tutor] User input question Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C804@mbtlipnt02.btlabs.bt.co.uk> > OK guys, bear with me - this is my first EVER foray into > Python, but I think > I may have stumbled clumsily into a solution (of sorts).... Pretty close. You should find you still get None printed at the end tho'... Now lets tidy it up a wee bit > def timestab(n): > m = 1 > if i < 13: Better to check if n<13 since n hold the value you pass to timestab(the value of i in your case). > while m < 14: It was conventional to only print the first 12 lines at my schoool! This prints 13... but idf thats what you want thats OK. > print "%d x %d = %d" % (m,n,m*n) > m = m + 1 > else: > print "Only positive numbers between 1 and 12 please!" An easier way uses a for loop and range: def timestab(n): if n<13: for m in range(1,14): print "%d x %d = %d" % (m, n, m*n) else: print "Only positive numbers please" Now tidy that up more by observing that the error message really relates to the input() operation rather than printing the table so if we move it outside def timestab(n): for m in range(1,14): print "%d x %d = %d" % (m, n, m*n) i = input("What table?") if i < 13: timestab(i) else: print "Only positive numbers 1-12 please" Finally we could check if the number really was positive by checking if it was divisible by 2 using the modulo operator: if i < 13 and (i % 2 == 0): .... But yours works and that's always a great result for a first timer. Well done. Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Thu Aug 8 17:45:55 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 8 Aug 2002 17:45:55 +0100 Subject: [Tutor] User input question Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C805@mbtlipnt02.btlabs.bt.co.uk> > Out of curiosity, the if __name__ == "__main__": line... > Where does __name__ and __main__ refer to in the script? Python has a bunch of "magic" names, usually surrounded by doubvle underscores at each end. __name__ is a value that python assgns to each file when it imports or runs it. If its imported __name__ is the name of the module ("sys","string" etc) but if the file is being run as a program python assigns the special value "__main__" to it. So the if clause above only runs the code under it if the file is being used as a program script, but not if its imported. This is explained further in my tutor in the case study in the subsection 'Turning it into a module'. HTH, Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From kb@mm.st Thu Aug 8 21:10:22 2002 From: kb@mm.st (Kyle Babich) Date: Thu, 8 Aug 2002 20:10:22 UT Subject: [Tutor] My first counter... is broken. Message-ID: <20020808201022.501AC9378E@server2.fastmail.fm> On Thu, 08 Aug 2002 16:42:57 +0200, "Magnus Lycka" said: > At 11:36 2002-08-08 +0000, Kyle Babich wrote: > >I thought I would try to make my first counter. Once I wrote it and > >worked a bug out my counter started working... well, sort of. > >It counted 1, 2, and then it jumped to something in the hundreds, then > >thousands, and then the page just went white. > >This is what showed in my error log: > > > >Traceback (most recent call last): > > File "/home/sites/kmb/www/public_html/njindenial/counter.py", line = 8, > > in ? > > number =3D int(number) > >ValueError: int() literal too large: 01213121412131215 >=20 > Can't you guess? Perhaps you could have a look in the file > after each access, and you might figure it out. (I don't really > want to take this debugging experience away from you. You will > probably get this Aha! experience after a while.) Make sure there > are no parallel executions of the script while you debug it. >=20 > Hint: What does FILEOBJECT.write() really do? What would > happen if you called it several times? What is FILEOBJECT.seek() > for? >=20 Someone already mentioned the seek so I fixed it. At some point I'll probably make it a hit counter instead of a regular counter though. I've got two ideas for this, either a cookie that tells the script that it already recieved a hit from that computer or so it will only take one hit per ip address. Maybe after that I could even add a config file, zip it, and put it on hotscripts. >=20 > --=20 > Magnus Lyck=E5, Thinkware AB > =C4lvans v=E4g 99, SE-907 50 UME=C5 > tel: 070-582 80 65, fax: 070-612 80 65 > http://www.thinkware.se/ mailto:magnus@thinkware.se >=20 >=20 -- Kyle From glingl@aon.at Thu Aug 8 22:05:10 2002 From: glingl@aon.at (Gregor Lingl) Date: Thu, 08 Aug 2002 23:05:10 +0200 Subject: [Tutor] math, cmath and all that ... References: <20020808201022.501AC9378E@server2.fastmail.fm> Message-ID: <3D52DD06.5000907@aon.at> Hello! Where is the module math? Or what is its special character? It's not in Lib (as for instance string), but its also not built-in. Like cmath, os, sys, ... ? [Perhaps it is, that they are written in C, do they constitute dlls or what?] What's the special character of those modules, is there a list of modules of that type and where can they be found (where are they hidden?) Thanks, Gregor From dyoo@hkn.eecs.berkeley.edu Thu Aug 8 22:27:17 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Thu, 8 Aug 2002 14:27:17 -0700 (PDT) Subject: [Tutor] User input question (fwd) Message-ID: I meant to forward this to tutor@python.org. Sorry about that, David. ---------- Forwarded message ---------- Date: Thu, 8 Aug 2002 10:29:10 -0700 (PDT) From: Danny Yoo To: tutor@hkn.eecs.berkeley.edu Cc: dturner@e-healthconsultants.com Subject: RE: [Tutor] User input question (fwd) Hi David, You probably meant to send this to the address 'tutor@python.org'. The address that you sent to, 'tutor-admin@python.org', is for administrative stuff. I'll forward the message for you. Good luck to you! ---------- Forwarded message ---------- Date: Thu, 8 Aug 2002 15:54:40 +0100 From: David Turner To: tutor-admin@python.org Subject: RE: [Tutor] User input question OK guys, bear with me - this is my first EVER foray into Python, but I think I may have stumbled clumsily into a solution (of sorts).... Here goes.... ***** def timestab(n): m = 1 if i < 13: while m < 14: print "%d x %d = %d" % (m,n,m*n) m = m + 1 else: print "Only positive numbers between 1 and 12 please!" i = input('Try a number ') print timestab(i) ***** This seems to work OK (but I guess there will be far cleaner, neater ways to do it), and it doesn't get rid of the "None" at the bottom of the list... But anyway, since this was my first ever go with Python, I'm quite pleased with myself nonetheless!! *LARGE GRIN* Cheers DT -----Original Message----- From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of shey crompton Sent: 08 August 2002 15:32 To: tutor Subject: RE: [Tutor] User input question That's got rid of the error message, thanks. It now just squares the number that the user inputs, and also returns 'None' on the line below (confused?). I am thinking I need a range command to get it to do multiply within a range. I have just tried adding: For n in range(1,13): Between the 'def' line and the if statement with no result. Oh well, gives me something else to ponder on during an otherwise boring day at work. :-) -----Original Message----- From: Kyle Babich [mailto:kb@mm.st] Sent: 08 August 2002 15:02 To: shey crompton; tutor Subject: Re: [Tutor] User input question I'm still a newbie to python so I am taking my best guess in saying to un-indent the print that is causing the error. On Thu, 8 Aug 2002 14:15:32 +0100, "shey crompton" said: > I have been trying to modify a script that prints out the times tables > to > one that asks the user to input which times table they would like > printed > out (between 1 and 13). > I have tried so many different ways of doing this without any success. > I am > sure it's a simple answer, but I am starting to get frustrated. > The script below is my latest attempt, and the error message I get is > below > it. > Hints, and tips greatly appreciated. > > Shey > > > def timestab(n): > if i < 13: > print "%d x %d = %d" % (i,n,i*n) > else: > print "Only positive numbers between 1 and 12 please!" > > i = input('Try a number ') > print timestab(i) > > > The error message is: > > File "C:\Documents and Settings\shey\Desktop\timesTab_8.py", line 15 > print timestab(i) > ^ > SyntaxError: invalid syntax > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- Kyle _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From sarmstrong13@mac.com Thu Aug 8 23:03:29 2002 From: sarmstrong13@mac.com (SA) Date: Thu, 08 Aug 2002 17:03:29 -0500 Subject: [Tutor] Which is better for flat dbs? Pickle or shelve? Message-ID: Which is better for flat db's? Pickle or shelve? Basically I will be writing a program that takes data and places it in a tab deliminated text file which then can be loaded into excel for viewing if needed. Different data will be placed in different files. Also. How can I secure this program so that when someone starts it it asks for a password? The user interface will be html forms. Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From sarmstrong13@mac.com Thu Aug 8 23:10:21 2002 From: sarmstrong13@mac.com (SA) Date: Thu, 08 Aug 2002 17:10:21 -0500 Subject: [Tutor] Tree? Message-ID: I want to write a tkinter app that shows an 'explorer' like tree in the left widget. And when an item is clicked on it can expand or compress trees. Selected items will then display a document text from the selected item in the right side widget. I think I can program the second half, what I need is some way of displaying the 'explorer' like tree. Where do I start? Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From darnold02@sprynet.com Fri Aug 9 00:33:28 2002 From: darnold02@sprynet.com (Don Arnold) Date: Thu, 8 Aug 2002 18:33:28 -0500 Subject: [Tutor] Tree? References: Message-ID: <076601c23f34$05100360$f011ba3f@defaultcomp> Remember, Google.com is your friend! ; ) This was the first hit I got when I searched on 'tkinter tree widget': http://www.esrf.fr/computing/bliss/guides/python/modules/Tree/Tree.html I haven't used it, but it looks pretty promising. Don ----- Original Message ----- From: "SA" To: "Tutor" Sent: Thursday, August 08, 2002 5:10 PM Subject: [Tutor] Tree? > I want to write a tkinter app that shows an 'explorer' like tree in the left > widget. And when an item is clicked on it can expand or compress trees. > Selected items will then display a document text from the selected item in > the right side widget. > > I think I can program the second half, what I need is some way of displaying > the 'explorer' like tree. Where do I start? > > Thanks. > SA > > > -- > "I can do everything on my Mac I used to on my PC. Plus a lot more ..." > -Me > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor From guillermo.fernandez@epfl.ch Fri Aug 9 01:37:04 2002 From: guillermo.fernandez@epfl.ch (Guillermo Fernandez) Date: Fri, 09 Aug 2002 10:07:04 +0930 Subject: [Tutor] math, cmath and all that ... References: <20020808201022.501AC9378E@server2.fastmail.fm> <3D52DD06.5000907@aon.at> Message-ID: <3D530EB0.9643E784@epfl.ch> Hi! > Where is the module math? Or what is its special character? > It's not in Lib (as for instance string), but its also not built-in. > Like cmath, os, sys, ... ? [Perhaps it is, that they are written in C, > do they constitute dlls or what?] I'm using python2.2 and I'll try to show the logic I followed to answer this question. I've made a little search (find is your friend, and if you don't have it, think about installing a real shell into your Windows box, like http://www.cygwin.com/). guille@guille:~ > find /usr/lib/python2.2/ -name "*math*" -print 2> /dev/null /usr/lib/python2.2/test/test_cmath.py /usr/lib/python2.2/test/test_math.py /usr/lib/python2.2/test/test_cmath.pyc /usr/lib/python2.2/test/test_cmath.pyo /usr/lib/python2.2/test/test_math.pyc /usr/lib/python2.2/test/test_math.pyo /usr/lib/python2.2/test/output/test_math /usr/lib/python2.2/lib-dynload/cmath.so /usr/lib/python2.2/lib-dynload/math.so The .pyc (python compiled) and .pyo (python compiled with optimisation) does not really help us, so we forget them. I've had a look at the sources of test/test_math.py and this seems to be a program that allow to test all the functions of the math module (with a name like that, it's quite logic :-) The next logical step is to look at the .so files. The .so files indicate a shared library, so probably they where writen in C and compiled in the installation of python. A little Google search shows this page: http://cvs.astro-wise.org:4711/math.html that sais about the lib-dynload/math.so that "This module is always available. It provides access to the mathematical functions defined by the C standard." This seems to said that, as I thought, it's a C file. I decide then to have a look at the sources of Python: guille@guille:~/Python-2.2.1 > find . -name "*math*" -print ./Doc/lib/libmath.tex ./Doc/lib/libcmath.tex ./Lib/test/test_cmath.py ./Lib/test/test_math.py ./Lib/test/output/test_math ./Modules/mathmodule.c ./Modules/cmathmodule.c Seems that the file we are looking for is Modules/mathmodule.c I had a look to the source and it seems to be the math module you are looking for :-) But maybe I did not understand your question... in that case, sorry for the long mail. Good luck! Guille From dyoo@hkn.eecs.berkeley.edu Fri Aug 9 01:52:31 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Thu, 8 Aug 2002 17:52:31 -0700 (PDT) Subject: [Tutor] math, cmath and all that ... [module.__file__] In-Reply-To: <3D530EB0.9643E784@epfl.ch> Message-ID: > > Where is the module math? Or what is its special character? It's not > > in Lib (as for instance string), but its also not built-in. Like > > cmath, os, sys, ... ? [Perhaps it is, that they are written in C, do > > they constitute dlls or what?] By the way, we can ask a module which file it belongs to: ### >>> import math >>> math.__file__ '/opt/Python-2.1.1/lib/python2.1/lib-dynload/math.so' ### So yes, the 'math' module isn't written in Python itself, but is an extension module written in C. '.so' is an extension used on Unix systems to say that these are dynamically linked libraries. (".so" stands for "shared object") On a Windows system, we'll probably see something like 'math.dll' instead. Hope this helps! From highdesertman@yahoo.com Fri Aug 9 02:22:31 2002 From: highdesertman@yahoo.com (Mathew P.) Date: Thu, 8 Aug 2002 18:22:31 -0700 (PDT) Subject: [Tutor] searching through a string list Message-ID: <20020809012231.85133.qmail@web13406.mail.yahoo.com> I have a huge list (imagine a list of pairs that is like, 12,000 entries long). The pairs each consist of a number and a persons name, both in string form (a list of lists, each sublist containing the pair). I need to parse this list, which I can figure out how to do, but while parsing it, I need to be able to search for a persons name. This list will have the same names in it more than once, and what I am actually doing is parsing the list to find out how many times a persons name appears in the list. To complicate things, I need to be able to do a partial match. For instance, I need to be able to find out how many "anthony" 's appear in the list - so if I have an anthony brown, and anthony johnson, and an anthony williams, the program will count three anthonys. I I was sure that the string library would have search facilities that would do just what I wanted. I have not found exactly what I was looking for though. The closest thing I came to was the string.find() method. Will string.find() (inside of a while or for loop) do partial matches for me like this? If so, can someone give me an example of how to use the find method, or point me to a URL? The python library docs have no example code that I was able to find, to illustrate how to use find. Thanks ahead of time, Mathew __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com From ak@silmarill.org Fri Aug 9 02:42:15 2002 From: ak@silmarill.org (Andrei Kulakov) Date: Thu, 8 Aug 2002 21:42:15 -0400 Subject: [Tutor] searching through a string list In-Reply-To: <20020809012231.85133.qmail@web13406.mail.yahoo.com> References: <20020809012231.85133.qmail@web13406.mail.yahoo.com> Message-ID: <20020809014215.GA1026@ak.silmarill.org> On Thu, Aug 08, 2002 at 06:22:31PM -0700, Mathew P. wrote: > I have a huge list (imagine a list of pairs that is like, 12,000 > entries long). The pairs each consist of a number and a persons name, > both in string form (a list of lists, each sublist containing the > pair). I need to parse this list, which I can figure out how to do, but > while parsing it, I need to be able to search for a persons name. > > This list will have the same names in it more than once, and what I am > actually doing is parsing the list to find out how many times a persons > name appears in the list. To complicate things, I need to be able to do > a partial match. For instance, I need to be able to find out how many > "anthony" 's appear in the list - so if I have an anthony brown, and > anthony johnson, and an anthony williams, the program will count three > anthonys. > I > I was sure that the string library would have search facilities that > would do just what I wanted. I have not found exactly what I was > looking for though. The closest thing I came to was the string.find() > method. Will string.find() (inside of a while or for loop) do partial > matches for me like this? If so, can someone give me an example of how > to use the find method, or point me to a URL? The python library docs > have no example code that I was able to find, to illustrate how to use > find. > > Thanks ahead of time, > > Mathew This sounds like it ought to be a dictionary - {"person name": [number1, number2], ...} Then if you wanted to find all anthonies, you could do: results = [] for key in mydict.keys(): if key.find("anthony") != -1: results.append(key) > > > __________________________________________________ > Do You Yahoo!? > HotJobs - Search Thousands of New Jobs > http://www.hotjobs.com > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Cymbaline: intelligent learning mp3 player: python, linux, console. get it at: http://silmarill.org/cymbaline.htm From shalehperry@attbi.com Fri Aug 9 02:42:53 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Thu, 08 Aug 2002 18:42:53 -0700 (PDT) Subject: [Tutor] searching through a string list In-Reply-To: <20020809012231.85133.qmail@web13406.mail.yahoo.com> Message-ID: On 09-Aug-2002 Mathew P. wrote: > I have a huge list (imagine a list of pairs that is like, 12,000 > entries long). The pairs each consist of a number and a persons name, > both in string form (a list of lists, each sublist containing the > pair). I need to parse this list, which I can figure out how to do, but > while parsing it, I need to be able to search for a persons name. > > This list will have the same names in it more than once, and what I am > actually doing is parsing the list to find out how many times a persons > name appears in the list. To complicate things, I need to be able to do > a partial match. For instance, I need to be able to find out how many > "anthony" 's appear in the list - so if I have an anthony brown, and > anthony johnson, and an anthony williams, the program will count three > anthonys. > I > I was sure that the string library would have search facilities that > would do just what I wanted. I have not found exactly what I was > looking for though. The closest thing I came to was the string.find() > method. Will string.find() (inside of a while or for loop) do partial > matches for me like this? If so, can someone give me an example of how > to use the find method, or point me to a URL? The python library docs > have no example code that I was able to find, to illustrate how to use > find. > Unfortunately string.find will also match in the middle of words. So if you are looking for say all of the women named Jean it would also match Jean-Luc. This is a problem which will take some effort on your part (regardless of the language used). Python's string and maybe re library will help but much of the logic will be your own. Just start an instance of python and play around in the interpreter -- this is one of python's great strengths. A common idiom is to use a dictionary to store the instances of each name along with a count. in simple python code: for name in list: if name in known_names: known_name[name] += 1 else known_name[name] = 1 I know this is only part of your request but it should point you in the right direction. From glingl@aon.at Fri Aug 9 03:14:34 2002 From: glingl@aon.at (Gregor Lingl) Date: Fri, 09 Aug 2002 04:14:34 +0200 Subject: [Tutor] math, cmath and all that ... [module.__file__] References: Message-ID: <3D53258A.4070206@aon.at> Thanks to both of you for your explanations. Before I asked, I did a (rudimentary) search, but as I'm working on a Windows-System and since I don't have the sources on my machine, I didn't find them. Danny Yoo schrieb: >By the way, we can ask a module which file it belongs to: > >### > > >>>>import math >>>>math.__file__ >>>> >>>> >'/opt/Python-2.1.1/lib/python2.1/lib-dynload/math.so' >### > >On a Windows system, we'll probably see something like >'math.dll' instead. > > No: Python 2.2.1 (#34, Apr 9 2002, 19:34:33) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. IDLE 0.8 -- press F1 for help >>> import math >>> math.__file__ Traceback (most recent call last): File "", line 1, in ? math.__file__ AttributeError: 'module' object has no attribute '__file__' >>> Thanks again, Gregor From glingl@aon.at Fri Aug 9 03:23:58 2002 From: glingl@aon.at (Gregor Lingl) Date: Fri, 09 Aug 2002 04:23:58 +0200 Subject: [Tutor] searching through a string list References: <20020809012231.85133.qmail@web13406.mail.yahoo.com> Message-ID: <3D5327BE.6080304@aon.at> Mathew P. schrieb: >I have a huge list (imagine a list of pairs that is like, 12,000 >entries long). The pairs each consist of a number and a persons name, >both in string form (a list of lists, each sublist containing the >pair). I need to parse this list, which I can figure out how to do, but >while parsing it, I need to be able to search for a persons name. > >This list will have the same names in it more than once, and what I am >actually doing is parsing the list to find out how many times a persons >name appears in the list. To complicate things, I need to be able to do >a partial match. For instance, I need to be able to find out how many >"anthony" 's appear in the list - so if I have an anthony brown, and >anthony johnson, and an anthony williams, the program will count three >anthonys. >I >I was sure that the string library would have search facilities that >would do just what I wanted. I have not found exactly what I was >looking for though. The closest thing I came to was the string.find() >method. Will string.find() (inside of a while or for loop) do partial >matches for me like this? If so, can someone give me an example of how >to use the find method, or point me to a URL? The python library docs >have no example code that I was able to find, to illustrate how to use >find. > > Could you use this approach: >>> l = [[1, 'anthony curl'], [2, 'anthony baxter']] >>> str(l) "[[1, 'anthony curl'], [2, 'anthony baxter']]" >>> str(l).count('anthony') 2 >>> ? Gregor From lsloan@umich.edu Fri Aug 9 12:57:46 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Fri, 09 Aug 2002 07:57:46 -0400 Subject: [Tutor] Tree? In-Reply-To: References: Message-ID: <1640644.1028879866@[192.168.2.201]> --On Thursday, August 8, 2002 5:10 PM -0500 SA wrote: > I think I can program the second half, what I need is some way of > displaying the 'explorer' like tree. Where do I start? I found a nice tree widget by Gene Cash through searching Google. It's the same Tree module that's already been mentioned on this mailing list, but I wanted to point out the URL for it at Mr. Cash's actual website is . I also wanted to confirm that it is quite nice. I began using it for a project I was working on. Unfortunately, the customer that contracted my group ran out of funds and the project was cancelled. So I don't have anything to show for it, but take my word, it's a good tree module. -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From anandrs@hexaware.com Fri Aug 9 13:09:48 2002 From: anandrs@hexaware.com (Anand Ramakrishna) Date: Fri, 9 Aug 2002 17:39:48 +0530 Subject: [Tutor] (no subject) Message-ID: <372DD7320F873B43929D49BFF86F950B645A42@cdc1.chennai.corp.hexaware.com> This is a multi-part message in MIME format. ------_=_NextPart_001_01C23F9D.A88A6E03 Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01C23F9D.A88A6E03" ------_=_NextPart_002_01C23F9D.A88A6E03 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I am having a strange problem with my python code for reversing a = number. I tried it on a few combinations and works fine with most of = them except when the number starts in '1'. If I give input as 123 it = reverses and displays as 442. If I give input as 12 it reverses and = displays as 12. Where as if I give any other number, it reverses = properly and displays the correct result. The code is pasted below. =20 =20 =20 print 'This program accepts a number and then reverses it' number =3D int(raw_input("Enter a number =3D ")) temp_var =3D 0 =20 while (number/10) > 1 : temp_var =3D (temp_var*10) + (number%10) number =3D number/10 else: temp_var =3D (temp_var*10) + number print 'The reversed number is ', temp_var=20 =20 =20 Anbudan,=20 Anand~=20 =20 -------------------------------------------------------------------------= ----------=20 If you think you can't beat your computer at Chess, try kickboxing.=20 ------_=_NextPart_002_01C23F9D.A88A6E03 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
    I=20 am having a strange problem with my python code for reversing a number. = I tried=20 it on a few combinations and works fine with most of them except when = the number=20 starts in '1'. If I give input as 123 it reverses and displays as 442. = If I give=20 input as 12 it reverses and displays as 12. Where as if I give any other = number,=20 it reverses properly and displays the correct result. The code is pasted = below.
 
 
 
print = 'This program=20 accepts a number and then reverses it'
number =3D = int(raw_input("Enter a number=20 =3D "))
temp_var =3D 0
 
while = (number/10)=20 > 1 :
  temp_var =3D (temp_var*10) + (number%10)
  = number =3D=20 number/10
else:
  temp_var =3D (temp_var*10) + = number
  print=20 'The reversed number is ', temp_var
 
 

Anbudan,
Anand~=20
 
-----------------------------------------------------------= ------------------------=20
If you think you can't beat your computer at = Chess, try=20 kickboxing.

------_=_NextPart_002_01C23F9D.A88A6E03-- ------_=_NextPart_001_01C23F9D.A88A6E03 Content-Type: image/gif; name="TechTool.gif" Content-Transfer-Encoding: base64 Content-ID: <718330200@10082002-1631> Content-Description: TechTool.gif Content-Location: TechTool.gif R0lGODlhQQByAPcAAAAAADMzM2ZmZpmZmcDAwAAAAAAAAAAAAPB0AQBMAE0AAABNABoAAAAMF1AA fOxvADcBAACg9m8AcIj7vzCL+7//////yOxvAKxK978AAAAAMxdQACBK978BAAAADBdQALvxQwDY H1AAAAAAAGYAAAAMF1AArAwAACgYUAABAAAA2B9QAEwAAACsDAAAAABAANgfUAAAAAAAAAAAAAEA AAAsGVAABAEAAAAAAAAAAAAAKBhQADztbwBsAAgAGgAjAA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tGd554hITKISk7g/CpHrWhCqGoOgY61yde5qM0TO0KzYqLKgJnpRW1KDtpi+VTXwiexrG6Ke FyzdofFa9sqVChW3KUp56IWjmmPiQIIyIYUmQPJL2uqABh6faEYmaYSNhey3R9b5LYfYSySHfDe7 ohErh3xhGc0+JzkKNk0ozYqYJEXZpMNIEVXlYcqinIMeznRmdfhBD3vuI8sl/kQ+8tkVLlH2ScAQ xGeJjI+l0oIypemkXph0DMJiwiECWU4xfKLUiczlsPPRzjenu51M+mjA1HGLkW/8oQsB5abPKY41 htyZH3P4qGeqrlSQCRKDMAksqynthAB85JcC1zSw2OGzYIF8mWrgxLl81qksbZni1c5VooBm6XZ4 jCeg6HnBSrZwfqYhYk8eZ8uOevSjAAgIADs= ------_=_NextPart_001_01C23F9D.A88A6E03-- From sarmstrong13@mac.com Fri Aug 9 13:34:56 2002 From: sarmstrong13@mac.com (SA) Date: Fri, 09 Aug 2002 07:34:56 -0500 Subject: [Tutor] Tree? In-Reply-To: <076601c23f34$05100360$f011ba3f@defaultcomp> Message-ID: On 8/8/02 6:33 PM, "Don Arnold" wrote: > Remember, Google.com is your friend! ; ) This was the first hit I got when I > searched on 'tkinter tree widget': > > http://www.esrf.fr/computing/bliss/guides/python/modules/Tree/Tree.html > Great start. Thanks. Now let me ask you this. Have you heard of a tree module that does not require Tkinter. Maybe one that can work with an html gui front-end? There must be something that is not Tkinter specific since Zope has a tree in it. Right? Thanks. SA From neutron878@oco.net Thu Aug 8 21:52:33 2002 From: neutron878@oco.net (Ricardo Ortega) Date: Thu, 8 Aug 2002 16:52:33 -0400 (Eastern Daylight Time) Subject: Fw: RE: [Tutor] ASP Message-ID: <3D52DA11.000009.01496@palamino> --------------Boundary-00=_LZLJMY50000000000000 Content-Type: Multipart/Alternative; boundary="------------Boundary-00=_LZLJH890000000000000" --------------Boundary-00=_LZLJH890000000000000 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =0D =0D =0D =0D I do know Python but not ASP. Thanks for the info I will do some searches= =0D and see what I can find. Do you recomend any one in particular ?=0D -------Original Message-------=0D =0D From: alan.gauld@bt.com=0D Date: Thursday, August 08, 2002 12:19:36 PM=0D To: neutron878@oco.net; tutor@python.org=0D Subject: RE: [Tutor] ASP=0D =0D Please use plain text when posting to public mailing lists.=0D =0D > Hi I am attempting to learn how to use python with asp.=0D > I have set up IIS on a Windows 2000 server and have=0D > succesfully run a sample python asp page to confirm=0D > that I set everything up correctly.=0D =0D Well done thats the hard bit!=0D =0D > What I need now are some tutorials, refrence guides=0D > or something similar any help would be greatly=0D > appreciated.=0D =0D Depends on what level you are at.=0D Do you know Python but not ASP?=0D Do you know ASP but not Python?=0D Do you not know either of them?=0D =0D If the first try any of the ASP tutorials on=0D the web, there are many good ones. Next look=0D at Mark Hammonds stuff on accessing COM from=0D Python.=0D =0D If the second the official tutor that comes with=0D python documentation is the best starting point.=0D If you know ASP in another language theres little=0D new in using Python. The only other tweek you'll=0D need to look for is the winall stuff needed to=0D use ASP and how it accesses COM objects. The only=0D other caveat I'd offer is wroite as much of the=0D Python stuff in functions at the top of the file=0D then the inline stuff will mostly be single line=0D code. Pythons indenting rules can get a bit messed=0D up when used inline in ASP HTML.=0D =0D If you kow neither learn Python first then ASP.=0D Start at the newbies page on the Python web site.=0D =0D Or even at my tutor :-)=0D =0D Alan g.=0D Author of the 'Learning to Program' web site=0D http://www.freenetpages.co.uk/hp/alan.gauld=0D =0D =0D _______________________________________________=0D Tutor maillist - Tutor@python.org=0D http://mail.python.org/mailman/listinfo/tutor=0D =0D =2E --------------Boundary-00=_LZLJH890000000000000 Content-Type: Text/HTML; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =0D =0A =20
 
 
 

I do know Python but not ASP. Thanks for the i= nfo I=20 will do some searches
and see what I can find. Do you recomend a= ny one=20 in particular ?
-------Original Message-------

From: alan.gauld@bt.com
Date: Th= ursday,=20 August 08, 2002 12:19:36 PM
To: neutron878@oco.net; tutor@python.org
Subject: R= E:=20 [Tutor] ASP

Please use plain text when posting to public mai= ling=20 lists.

> Hi I am attempting to learn how to use python wi= th=20 asp.
> I have set up IIS on a Windows 2000 server and have>=20 succesfully run a sample python asp page to confirm
> that I = set=20 everything up correctly.

Well done thats the hard bit!
>=20 What I need now are some tutorials, refrence guides
> or some= thing=20 similar any help would be greatly
> appreciated.

Depen= ds on=20 what level you are at.
Do you know Python but not ASP?
Do you= know=20 ASP but not Python?
Do you not know either of them?

If th= e first=20 try any of the ASP tutorials on
the web, there are many good one= s. Next=20 look
at Mark Hammonds stuff on accessing COM from
Python.
=
If=20 the second the official tutor that comes with
python documentati= on is=20 the best starting point.
If you know ASP in another language the= res=20 little
new in using Python. The only other tweek you'll
need = to look=20 for is the winall stuff needed to
use ASP and how it accesses CO= M=20 objects. The only
other caveat I'd offer is wroite as much of=20 the
Python stuff in functions at the top of the file
then the= inline=20 stuff will mostly be single line
code. Pythons indenting rules c= an get=20 a bit messed
up when used inline in ASP HTML.

If you kow = neither=20 learn Python first then ASP.
Start at the newbies page on the Py= thon=20 web site.

Or even at my tutor :-)

Alan g.
Author o= f the=20 'Learning to Program' web site
http://www.fre= enetpages.co.uk/hp/alan.gauld


____________________________= ___________________
Tutor=20 maillist - Tutor@python.org=
http://mail.= python.org/mailman/listinfo/tutor

.
=20
____________________________________________________
  IncrediMail - Email has finally evolved -=20
Click=20 Here
--------------Boundary-00=_LZLJH890000000000000-- --------------Boundary-00=_LZLJMY50000000000000 Content-Type: image/gif Content-Transfer-Encoding: base64 Content-ID: <612A31A7-86C9-4924-96AF-3C4CB966FAA8> R0lGODlhFAAPALMIAP9gAM9gAM8vAM9gL/+QL5AvAGAvAP9gL////wAAAAAAAAAAAAAAAAAAAAAA AAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJFAAIACwAAAAAFAAPAAAEVRDJSaudJuudrxlEKI6B URlCUYyjKpgYAKSgOBSCDEuGDKgrAtC3Q/R+hkPJEDgYCjpKr5A8WK9OaPFZwHoPqm3366VKyeRt E30tVVRscMHDqV/u+AgAIfkEBWQACAAsAAAAABQADwAABBIQyUmrvTjrzbv/YCiOZGmeaAQAIfkE CRQACAAsAgABABAADQAABEoQIUOrpXIOwrsPxiQUheeRAgUA49YNhbCqK1kS9grQhXGAhsDBUJgZ AL2Dcqkk7ogFpvRAokSn0p4PO6UIuUsQggSmFjKXdAgRAQAh+QQFCgAIACwAAAAAFAAPAAAEEhDJ Sau9OOvNu/9gKI5kaZ5oBAAh+QQJFAAIACwCAAEAEAANAAAEShAhQ6ulcg7Cuw/GJBSF55ECBQDj 1g2FsKorWRL2CtCFcYCGwMFQmBkAvYNyqSTuiAWm9ECiRKfSng87pQi5SxCCBKYWMpd0CBEBACH5 BAVkAAgALAAAAAAUAA8AAAQSEMlJq7046827/2AojmRpnmgEADs= --------------Boundary-00=_LZLJMY50000000000000-- From lsloan@umich.edu Fri Aug 9 15:44:41 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Fri, 09 Aug 2002 10:44:41 -0400 Subject: [Tutor] (no subject) In-Reply-To: <372DD7320F873B43929D49BFF86F950B645A42@cdc1.chennai.corp.hexaware.com> References: <372DD7320F873B43929D49BFF86F950B645A42@cdc1.chennai.corp.hexawa re.com> Message-ID: <2224539.1028889881@[192.168.2.201]> --On Friday, August 9, 2002 5:39 PM +0530 Anand Ramakrishna wrote: > I am having a strange problem with my python code for reversing a > number. I tried it on a few combinations and works fine with most of them > except when the number starts in '1'. If I give input as 123 it reverses > and displays as 442. If I give input as 12 it reverses and displays as > 12. Where as if I give any other number, it reverses properly and > displays the correct result. The code is pasted below. I don't know what's wrong with the math in your attempt. I didn't try to figure it out, as it sounds like this problem is more easily solved using strings: print 'This program accepts a number and then reverses it' # The int() here may be unneccessary as we convert back to a string next, # but it does help remove nondigits and leading zeroes. number = int(raw_input("Enter a number = ")) numString = str(number) # There's probably a more clever way to do this part. newnumString = '' for n in numString: newnumString = n + newnumString newnum = int(newnumString) print 'The reversed number is ', newnum -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From yduppen@xs4all.nl Fri Aug 9 15:50:41 2002 From: yduppen@xs4all.nl (Yigal Duppen) Date: Fri, 9 Aug 2002 16:50:41 +0200 Subject: [Tutor] (no subject) In-Reply-To: <372DD7320F873B43929D49BFF86F950B645A42@cdc1.chennai.corp.hexaware.com> References: <372DD7320F873B43929D49BFF86F950B645A42@cdc1.chennai.corp.hexaware.com> Message-ID: <200208091650.41634.yduppen@xs4all.nl> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > I am having a strange problem with my python code for reversing a > number. There is an interesting bug in your program, based on a wrong assumption. My suggestion: replace the while loop by the following code while (number/10) > 1 : print "A) number/10:", number/10, "temp:", temp_var, "number:", number temp_var = (temp_var*10) + (number%10) number = number/10 else: print "B) number/10:", number/10, "temp:", temp_var, "number:", number temp_var = (temp_var*10) + number print 'The reversed number is ', temp_var (in other words: add some debug output) and try to figure out what went wrong. You'll probably find it pretty soon :) YDD - -- http://www.xs4all.nl/~yduppen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9U9bBLsKMuCf5EdwRAoZLAKCu7cdV+89eZiANZKLHCJ09ll/wMQCgyu+V J64RHjTS+lc8ihjB8a7eNuI= =QAar -----END PGP SIGNATURE----- From alan.gauld@bt.com Fri Aug 9 18:04:33 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 9 Aug 2002 18:04:33 +0100 Subject: [Tutor] Tree? Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C80A@mbtlipnt02.btlabs.bt.co.uk> > Have you heard of a tree module that does not > require Tkinter. There are lots. I think wxPython has one, I'm sure pyQt has too. > Maybe one that can work with an html gui front-end? But this is limited to one of the several Java or ActiveX tree widgets I guess... > There must be something that is not Tkinter specific > since Zope has a tree in it. Right? I'll take your word for it... :-) Alan G From alan.gauld@bt.com Fri Aug 9 18:11:00 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 9 Aug 2002 18:11:00 +0100 Subject: [Tutor] (no subject) Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C80C@mbtlipnt02.btlabs.bt.co.uk> Please use plain text when posting. > I am having a strange problem with my python code for > reversing a number. Try converting to a string and then iterating over the string from back to front using range... > while (number/10) > 1 : > number = number/10 I suspect you are using Python 2.2 which no longer does integer division with /. Try it at the >>> prompt to see how it works >>> 123/10 >>> (123/10)%10 etc. I think the new integer division operator is '//' I could be wrong, but that's my guess... Alan G. From yduppen@xs4all.nl Fri Aug 9 18:20:12 2002 From: yduppen@xs4all.nl (Yigal Duppen) Date: Fri, 9 Aug 2002 19:20:12 +0200 Subject: [Tutor] Tree? In-Reply-To: References: Message-ID: <200208091920.12934.yduppen@xs4all.nl> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > There must be something that is not Tkinter specific since Zope has a tree > in it. Right? Zope's tree is just a collection of craftily connected HTML pages; click on a leaf, your browser follows the link, zope generates a new page associated with the leaf; and if the leaf is a non-terminal leaf, zope generates a page with that leaf expanded. It works, but to me it isn't the epitome of usability... YDD - -- http://www.xs4all.nl/~yduppen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9U/nMLsKMuCf5EdwRAswLAJ9Sew1ZMy9Uro1HPm0dk4PdGRodyQCg40i4 bwjIqHyIUGJpu6Eod8jD6Ts= =fXI+ -----END PGP SIGNATURE----- From alan.gauld@bt.com Fri Aug 9 18:06:51 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 9 Aug 2002 18:06:51 +0100 Subject: [Tutor] ASP Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C80B@mbtlipnt02.btlabs.bt.co.uk> > I do know Python but not ASP. > Do you recomend any one in particular ? I used this successfully: http://www.learnasp.com/learn/newbie.asp Alan G From jeff@ccvcorp.com Fri Aug 9 19:05:18 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Fri, 09 Aug 2002 11:05:18 -0700 Subject: [Tutor] (no subject) References: <372DD7320F873B43929D49BFF86F950B645A42@cdc1.chennai.corp.hexaware.com> Message-ID: <3D54045E.51705F63@ccvcorp.com> Hi Anand, When emailing the tutor list, could you please turn off the html mail? I found it almost impossible to read this last message over the background image, and html mail looks really ugly in the archive. I don't like to complain about this, but it's hard to offer assistance when I can't read what you're saying.... :) Thanks. Jeff Shannon Technician/Programmer Credit International From jeff@ccvcorp.com Fri Aug 9 19:13:16 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Fri, 09 Aug 2002 11:13:16 -0700 Subject: [Tutor] Tree? References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C80A@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <3D54063C.78D50DEF@ccvcorp.com> alan.gauld@bt.com wrote: > sarmstrong13@mac.com wrote: > > Have you heard of a tree module that does not > > require Tkinter. > > There are lots. I think wxPython has one, I'm sure pyQt has too. Yes, wxPython has one. (At least on Windows, wxPython simply wraps the native Windows tree control; the wxGTK version may be a clone, as I'm not sure whether or not GTK *has* a native tree control.) > > There must be something that is not Tkinter specific > > since Zope has a tree in it. Right? Any tree control is going to be specific to some GUI toolkit, just as any other GUI widget is specific for a single toolkit. There's just too much involved to make it even remotely practical to create multi-toolkit widgets. Any time you're creating a graphical front-end, you will have to pick some toolkit and use that kit's widgets and architecture. Even if that "toolkit" is HTML rendered in a browser. Let us know how you're planning on rendering this application on-screen, and maybe we can help out a bit more. Jeff Shannon Technician/Programmer Credit International From darnold02@sprynet.com Fri Aug 9 21:05:51 2002 From: darnold02@sprynet.com (Don Arnold) Date: Fri, 9 Aug 2002 15:05:51 -0500 Subject: [Tutor] (no subject) References: <372DD7320F873B43929D49BFF86F950B645A42@cdc1.chennai.corp.hexaware.com> Message-ID: <089201c23fe0$2a3ab570$f011ba3f@defaultcomp> >>Hi, Hello! >> I am having a strange problem with my python code for reversing a number. I tried it on a few combinations and works fine with most of them except when the number starts in '1'. If I give input as 123 >>it reverses and displays as 442. If I give input as 12 it reverses and displays as 12. Where as if I give any other number, it reverses properly and displays the correct result. The code is pasted below. >>print 'This program accepts a number and then reverses it' >>number = int(raw_input("Enter a number = ")) >>temp_var = 0 >>while (number/10) > 1 : >> temp_var = (temp_var*10) + (number%10) >> number = number/10 >>else: >> temp_var = (temp_var*10) + number >> print 'The reversed number is ', temp_var >>Anbudan, >>Anand~ You're being bitten by Python's integer division, which drops the remainder: >>> print 19/10 1 >>> print 12/5 2 As a result, you're 'while' loop exits as soon as number drops below 20 (since 19/10 equals 1) and throws off your results. You can get around this by dividing by 10.0 to force a floating point division (which won't drop the remainder), or restating the loop as 'while number > 10' (which takes the division out of the picture). Don From gwatt3@backbonesecurity.com Fri Aug 9 21:38:16 2002 From: gwatt3@backbonesecurity.com (Watt III, Glenn) Date: Fri, 9 Aug 2002 16:38:16 -0400 Subject: [Tutor] wait command Message-ID: <94FD5825A793194CBF039E6673E9AFE034D615@bbserver1.backbonesecurity.com> this is probobly a stupid question but is there a command to wait for a condition like when condition: action or something that would do the same thing but a diffrent manner i would appreciate any help thanks From darnold02@sprynet.com Fri Aug 9 21:54:21 2002 From: darnold02@sprynet.com (Don Arnold) Date: Fri, 9 Aug 2002 15:54:21 -0500 Subject: [Tutor] Tree? References: Message-ID: <08a401c23fe6$fd24a3a0$f011ba3f@defaultcomp> > On 8/8/02 6:33 PM, "Don Arnold" wrote: > > > Remember, Google.com is your friend! ; ) This was the first hit I got when I > > searched on 'tkinter tree widget': > > > > http://www.esrf.fr/computing/bliss/guides/python/modules/Tree/Tree.html > > > > > Great start. Thanks. > > Now let me ask you this. Have you heard of a tree module that does not > require Tkinter. Maybe one that can work with an html gui front-end? > There must be something that is not Tkinter specific since Zope has a tree > in it. Right? > > Thanks. > SA > Well, I dabble in Python a bit, but haven't done much with HTML. You could always download the Zope source and see how they do their tree. Don From rob@uselesspython.com Fri Aug 9 23:05:01 2002 From: rob@uselesspython.com (Rob) Date: Fri, 9 Aug 2002 17:05:01 -0500 Subject: [Tutor] printing puzzlement Message-ID: I decided to see if I could convert a simple amortization schedule program written in C++ into something similar written in Python, because I thought the explanation would make for some interesting Useless Python material. Most of it is simple enough, but I'm puzzled about one part. As seen in the C++ code snippet here, calculations are performed in the middle of the display of each line of output. Does anyone know of a good way to reproduce similar behavior in a Python program? // Display the amortization schedule cout << "Pmt # Cur. Prin. Payment Int. Paid Rem. Prin." << endl; cout << "----- ---------- ------- --------- ----------" << endl; for (int index = 0; index < numPayments; index++) { cout << setw(5) << right << (index + 1); cout << setw(12) << right << fixed << setprecision(2) << principle; cout << setw(9) << right << fixed << amtPayment; float interest = (float (int (principle * monthRate * 100) ) ) / 100.0; cout << setw(11) << right << fixed << interest; principle = principle + interest - amtPayment; cout << setw(12) << right << fixed << principle; cout << endl; } Rob From kb@mm.st Sat Aug 10 00:02:17 2002 From: kb@mm.st (Kyle Babich) Date: Fri, 9 Aug 2002 23:02:17 UT Subject: [Tutor] wait command Message-ID: <20020809230217.3397A93720@server2.fastmail.fm> On Fri, 9 Aug 2002 16:38:16 -0400, "Watt III, Glenn" said: > this is probobly a stupid question but is there a command to wait for a > condition like > when condition: > action You probably mean if/elsif/else: if name =3D=3D "billy": print "Hi Billy" elsif name =3D=3D "bob": print "Hi Bob" elsif name =3D=3D "joe": print "Hi Joe" else: print "Hi BillyBobJoe" > or something that would do the same thing but a diffrent manner i would > appreciate any help thanks >=20 > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor >=20 -- Kyle From ruger@comnett.net Sat Aug 10 00:19:43 2002 From: ruger@comnett.net (D. Rick Anderson) Date: Fri, 09 Aug 2002 16:19:43 -0700 Subject: [Tutor] wait command References: <20020809230217.3397A93720@server2.fastmail.fm> Message-ID: <3D544E0F.3020906@comnett.net> You can always: while 1: if actionvar == 'blatherskite': function() actionvar = 'notblatherskite' That would sit and cycle until actionvar was equal to 'blatherskite' and then run function. It would probably be more useful if it were also calling another function that may be checking something and changing the state of actionvar. I'm sure there's more elegant ways of doing this, but I'm not a Jedi yet. :) HTH Rick Kyle Babich wrote: >On Fri, 9 Aug 2002 16:38:16 -0400, "Watt III, Glenn" > said: > > >>this is probobly a stupid question but is there a command to wait for a >>condition like >>when condition: >> action >> >> > >You probably mean if/elsif/else: > >if name == "billy": > print "Hi Billy" >elsif name == "bob": > print "Hi Bob" >elsif name == "joe": > print "Hi Joe" >else: > print "Hi BillyBobJoe" > > > >>or something that would do the same thing but a diffrent manner i would >>appreciate any help thanks >> >>_______________________________________________ >>Tutor maillist - Tutor@python.org >>http://mail.python.org/mailman/listinfo/tutor >> >> >> > >-- >Kyle > >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > > > From glingl@aon.at Sat Aug 10 00:49:50 2002 From: glingl@aon.at (Gregor Lingl) Date: Sat, 10 Aug 2002 01:49:50 +0200 Subject: [Tutor] printing puzzlement References: Message-ID: <3D54551E.5080105@aon.at> Rob schrieb: >As seen in the C++ code snippet here, calculations are performed in the >middle of the display of each line of output. Does anyone know of a good way >to reproduce similar behavior in a Python program? > > > // Display the amortization schedule > cout << > "Pmt # Cur. Prin. Payment Int. Paid Rem. Prin." << endl; > cout << > "----- ---------- ------- --------- ----------" << endl; > for (int index = 0; index < numPayments; index++) > { > cout << setw(5) << right << (index + 1); > cout << setw(12) << right << fixed << setprecision(2) << principle; > cout << setw(9) << right << fixed << amtPayment; > float interest = (float (int (principle * monthRate * 100) ) ) / 100.0; > cout << setw(11) << right << fixed << interest; > principle = principle + interest - amtPayment; > cout << setw(12) << right << fixed << principle; > cout << endl; > } > >Rob > > > Again I'd like to point you to http://www.oreilly.com/catalog/pythoncook/chapter/ Section 1.9 contains an interesting discussion and some propositions far a solution to this (more exactly: to a very similar) problem. Gregor From ak@silmarill.org Sat Aug 10 01:07:49 2002 From: ak@silmarill.org (Andrei Kulakov) Date: Fri, 9 Aug 2002 20:07:49 -0400 Subject: [Tutor] wait command In-Reply-To: <94FD5825A793194CBF039E6673E9AFE034D615@bbserver1.backbonesecurity.com> References: <94FD5825A793194CBF039E6673E9AFE034D615@bbserver1.backbonesecurity.com> Message-ID: <20020810000749.GA910@ak.silmarill.org> On Fri, Aug 09, 2002 at 04:38:16PM -0400, Watt III, Glenn wrote: > this is probobly a stupid question but is there a command to wait for a > condition like > when condition: > action > or something that would do the same thing but a diffrent manner i would > appreciate any help thanks if condition: action does that, but it won't wait - it'll either do it or skip if condition is false. You can however do this: while 1: if condition: action break time.sleep(1) - Andrei > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Cymbaline: intelligent learning mp3 player: python, linux, console. get it at: http://silmarill.org/cymbaline.htm From ckasso@sprynet.com Sat Aug 10 02:05:30 2002 From: ckasso@sprynet.com (Chris Kassopulo) Date: Fri, 9 Aug 2002 21:05:30 -0400 Subject: [Tutor] reverse a number (was no subject) In-Reply-To: <372DD7320F873B43929D49BFF86F950B645A42@cdc1.chennai.corp.hexaware.com> References: <372DD7320F873B43929D49BFF86F950B645A42@cdc1.chennai.corp.hexaware.com> Message-ID: <20020809210530.29c5535c.ckasso@sprynet.com> On Fri, 9 Aug 2002 17:39:48 +0530 "Anand Ramakrishna" wrote: > Hi, > I am having a strange problem with my python code for reversing a > number. I tried it on a few combinations and works fine with most > of them except when the number starts in '1'. If I give input as > 123 it reverses and displays as 442. If I give input as 12 it > reverses and displays as 12. Where as if I give any other number, > it reverses properly and displays the correct result. The code is > pasted below. > > > > print 'This program accepts a number and then reverses it' > number = int(raw_input("Enter a number = ")) > temp_var = 0 > > while (number/10) > 1 : > temp_var = (temp_var*10) + (number%10) > number = number/10 > else: > temp_var = (temp_var*10) + number > print 'The reversed number is ', temp_var > > > > Anbudan, > Anand~ > > --------------------------------------------------------------------- > -------------- If you think you can't beat your computer at Chess, try > kickboxing. > > -- Chris Kassopulo _/\_ Linux User #199893 _/\_ Slackware From ckasso@sprynet.com Sat Aug 10 02:12:15 2002 From: ckasso@sprynet.com (Chris Kassopulo) Date: Fri, 9 Aug 2002 21:12:15 -0400 Subject: [Tutor] reverse a number (was no subject) In-Reply-To: <372DD7320F873B43929D49BFF86F950B645A42@cdc1.chennai.corp.hexaware.com> References: <372DD7320F873B43929D49BFF86F950B645A42@cdc1.chennai.corp.hexaware.com> Message-ID: <20020809211215.6a76e90d.ckasso@sprynet.com> On Fri, 9 Aug 2002 17:39:48 +0530 "Anand Ramakrishna" wrote: > Hi, > I am having a strange problem with my python code for reversing a > number. I tried it on a few combinations and works fine with most > of them except when the number starts in '1'. If I give input as > 123 it reverses and displays as 442. If I give input as 12 it > reverses and displays as 12. Where as if I give any other number, > it reverses properly and displays the correct result. The code is > pasted below. > > > > print 'This program accepts a number and then reverses it' > number = int(raw_input("Enter a number = ")) > temp_var = 0 > > while (number/10) > 1 : > temp_var = (temp_var*10) + (number%10) > number = number/10 > else: > temp_var = (temp_var*10) + number > print 'The reversed number is ', temp_var > > Greetings, Ahem, sorry about the last mail. To do this without using a string I had to loop through the number twice. The first time to see how many digits, the second to actually compute the number. It's mighty ugly, but it works. There must be a better way. __________________________________________________________ print 'This program accepts a number and then reverses it' userInput = int(raw_input("Enter a number = ")) # initialize variables tempVar = 0 i = 0 # determine number of digits number = userInput while number >= 10: number = number/10 i += 1 # compute reversed number number = userInput while number >= 10: tempVar = tempVar + (number%10)*10**i print (number%10)*10**i number = number/10 i -= 1 else: print (number%10)*10**i number = tempVar + number print 'The reversed number is', number __________________________________________________________ Chris Kassopulo _/\_ Linux User #199893 _/\_ Slackware From slime@vsnl.net Sat Aug 10 02:30:33 2002 From: slime@vsnl.net (Prahlad Vaidyanathan) Date: Sat, 10 Aug 2002 07:00:33 +0530 Subject: [Tutor] Reversing digits of number (WAS Re: (no subject)) In-Reply-To: <372DD7320F873B43929D49BFF86F950B645A42@cdc1.chennai.corp.hexaware.com> References: <372DD7320F873B43929D49BFF86F950B645A42@cdc1.chennai.corp.hexaware.com> Message-ID: <20020810013033.GA1675@localhost.localdomain> Hi, On Fri, 09 Aug 2002 Anand Ramakrishna spewed into the ether: > Hi, > I am having a strange problem with my python code for > reversing a number. I tried it on a few combinations and > works fine with most of them except when the number starts > in '1'. If I give input as 123 it reverses and displays as > 442. If I give input as 12 it reverses and displays as 12. Well, your logic is a *little* flawed. Read below .. [-- snippity --] > print 'This program accepts a number and then reverses it' > number = int(raw_input("Enter a number = ")) > temp_var = 0 > > while (number/10) > 1 : ^^^^ Here is your problem. This should be ">= 1". For example, when you enter "12", look at what happens. """ >>> number = 12 >>> number/10 1 >>> (number/10) > 1 ## False 0 >>> (number/10) >= 1 ## True 1 >>> """ Therefore, by your method, if the 1st digit is exactly "1", then the program comes out of the while loop, and thus the "number" now holds the 1st *and* the 2nd digit (12, in this case) when it enters the else loop. Thus, you get results like so : Input: 123 => Output: ((3*10) + 12) = 42 Input: 1557 => Output: ((75*10) + 15) = 765 HTH, pv. -- Prahlad Vaidyanathan Rich bachelors should be heavily taxed. It is not fair that some men should be happier than others. -- Oscar Wilde From trivas7@rawbw.com Sat Aug 10 05:19:07 2002 From: trivas7@rawbw.com (Thomas Rivas) Date: Fri, 9 Aug 2002 21:19:07 -0700 Subject: [Tutor] index elongated/decreased Message-ID: <200208100414.g7A4EDU82225@mail0.rawbw.com> Hi progressing pythonistas-- Playing with the interpreter I came up with this: >>> a = [66.6, 333, 333, 1, 1234.5] >>> print a.count(333), a.count(66.6), a.count('y') 2 1 0 >>> a.insert(2, -1) >>> a.append(333) >>> a [66.599999999999994, 333, -1, 333, 1, 1234.5, 333] Can anyone explain why 0th index came out as it did? Is this a floating point arithmetic issue/limitation? Thanks. Tom Rivas From flash1210@hotmail.com Sat Aug 10 06:28:24 2002 From: flash1210@hotmail.com (Frank Holmes) Date: Fri, 09 Aug 2002 22:28:24 -0700 Subject: [Tutor] when to use OOP Message-ID: After beating my head against classes for a while, I think I am finally beginning to understand how to write them (well, simple ones at least). So now the next question arises... when/why would I use class rather than a straightforeward script with just alotta def() statements? Frank _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com From rob@uselesspython.com Sat Aug 10 06:42:24 2002 From: rob@uselesspython.com (Rob) Date: Sat, 10 Aug 2002 00:42:24 -0500 Subject: [Tutor] when to use OOP In-Reply-To: Message-ID: When you catch yourself repeating certain behaviors more than you want, ask yourself if you're really thinking deep down inside that a function would be nice. When you find yourself thinking about an object with its own behaviors, consider whether coding one or more objects might make life easier and the code more sensible. When you'd like some help with all that head-banging, ask the Tutor List if there are any bandages about. wink-wink-nudge-nudge, Rob > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > Frank Holmes > Sent: Saturday, August 10, 2002 12:28 AM > To: tutor@python.org > Subject: [Tutor] when to use OOP > > > After beating my head against classes for a while, I think I > am finally > beginning to understand how to write them (well, simple ones at > least). So > now the next question arises... when/why would I use class rather than a > straightforeward script with just alotta def() statements? > > > > Frank > > > _________________________________________________________________ > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From tutor@python.org Sat Aug 10 07:17:45 2002 From: tutor@python.org (Tim Peters) Date: Sat, 10 Aug 2002 02:17:45 -0400 Subject: [Tutor] index elongated/decreased In-Reply-To: <200208100414.g7A4EDU82225@mail0.rawbw.com> Message-ID: [Thomas Rivas] > Hi progressing pythonistas-- Hi! > Playing with the interpreter I came up with this: > > >>> a = [66.6, 333, 333, 1, 1234.5] > >>> print a.count(333), a.count(66.6), a.count('y') > 2 1 0 > >>> a.insert(2, -1) > >>> a.append(333) > >>> a > [66.599999999999994, 333, -1, 333, 1, 1234.5, 333] > > Can anyone explain why 0th index came out as it did? Is this a > floating point arithmetic issue/limitation? Thanks. Indeed it is. A full explantion is here: Note that you can demonstrate the effect with less effort : >>> 66.6 66.599999999999994 >>> From dyoo@hkn.eecs.berkeley.edu Sat Aug 10 07:42:53 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Fri, 9 Aug 2002 23:42:53 -0700 (PDT) Subject: [Tutor] printing puzzlement In-Reply-To: Message-ID: On Fri, 9 Aug 2002, Rob wrote: > As seen in the C++ code snippet here, calculations are performed in the > middle of the display of each line of output. Yikes. It's usually not a good thing when "presentation logic" --- the table display --- is so closely tied to the calculation logic. Perhaps we can try to refactor this, and yank out the calculation into separate functions. > cout << "Pmt # Cur. Prin. Payment Int. Paid Rem. Prin." << endl; > cout << > "----- ---------- ------- --------- ----------" << endl; > for (int index = 0; index < numPayments; index++) > { > cout << setw(5) << right << (index + 1); > cout << setw(12) << right << fixed > << setprecision(2) << principle; > cout << setw(9) << right << fixed << amtPayment; > float interest = > (float (int (principle * monthRate * 100) ) ) / 100.0; > cout << setw(11) << right << fixed << interest; > principle = principle + interest - amtPayment; > cout << setw(12) << right << fixed << principle; > cout << endl; > } Here's one possible way to recode this: ### ## Warning: untested code class AmortizationSchedulePrinter: def __init__(self, starting_principle, amtPayment, monthRate): self.startingPrinciple = startingPrinciple self.amtPayment = amtPayment self.monthRate = monthRate def printAmortizationSchedule(self): self.printHeader() p = self.startingPrinciple for index in range(self.numPayments): printReportLine(index, p) p = self.nextPrinciple(p) def printReportLine(self, index, principle): print ("%5f" "%12.2f" "%9.2f" "%11.2f" "%12.2f") % \ (index + 1, principle, self.amtPayment, self.interest(principle), self.nextPrinciple(principle)) def nextPrinciple(self, principle): return principle + self.interest(principle) - self.amtPayment; def interest(self, principle): return (float (int (principle * self.monthRate * 100) ) ) / 100.0; def printHeader(self): print "Pmt # Cur. Prin. Payment Int. Paid Rem. Prin." print "----- ---------- ------- --------- ----------" ### It is a bit longer than the original version, but it does allow us to make changes to the line format more easily, since all of the formatting stuff is in printHeader() and printReportLine(). Hope this helps! From shalehperry@attbi.com Sat Aug 10 07:49:26 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Fri, 09 Aug 2002 23:49:26 -0700 (PDT) Subject: [Tutor] when to use OOP In-Reply-To: Message-ID: On 10-Aug-2002 Frank Holmes wrote: > After beating my head against classes for a while, I think I am finally > beginning to understand how to write them (well, simple ones at least). So > now the next question arises... when/why would I use class rather than a > straightforeward script with just alotta def() statements? > the whole point of OOP is to think in terms of objects, i.e. real things. This means nouns which have state/data and verbs which cause them to perform actions. GUI programming is one place where OO is rather handy and obvious. Having a Window class which draws itself makes sense. A list of windows which your program owns is then quite simple. When I find myself defining data and then writing functions to act on the data I usually ask myself if a class is not what is really needed. When I find myself wanting multiple instances of a particular state I usually turn to a class. For instance a networking daemon which handles multiple simultaneous connections might have a class for each connection. From KMahaindra@beijing.sema.slb.com Sat Aug 10 12:15:41 2002 From: KMahaindra@beijing.sema.slb.com (Ketut Mahaindra) Date: Sat, 10 Aug 2002 19:15:41 +0800 Subject: [Tutor] Redirecting Python Interpreter Output Message-ID: <53830B7409B1D511A09C001083FD58FC0193B2DB@asia15-ofbj.beijing.oilfield.slb.com> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --Boundary_(ID_qG23WymfPxRLrWTS/42SLw) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Hi, I am currently developing an application which embed / extend Python in C++ / MSVC 6.0 If I embed the Python interpreter in my C++ code, is there any way to redirect the output of the interpreter or the output of the script ? For example I want to catch the output and display it in an edit box Any suggestions here ? -- Best regards Ito --Boundary_(ID_qG23WymfPxRLrWTS/42SLw) Content-type: text/html; charset=iso-8859-1 Content-transfer-encoding: 7BIT Redirecting Python Interpreter Output

Hi,

I am currently developing an application
which embed / extend Python in C++ / MSVC 6.0

If I embed the Python interpreter in my C++ code, is there any way to
redirect the output of the interpreter or the output of the script ?
For example I want to catch the output and display it in an edit box
Any suggestions here ?

--
Best regards

Ito

--Boundary_(ID_qG23WymfPxRLrWTS/42SLw)-- From millsl@cofc.edu" The vpython library has wonderful plotting routines. One of them is gdots. Gdots plots points on a graph. Although one can control the color of the dots, one apparently cannot control the size of the dots. Suppose I wanted to write Python program to create the Mandelbrot set, which has hundreds of thousands of dots. One needs to plot individual pixels. Here are my two questions then: Is there a formal description of the various vpython routines? There is a wonderful tutor, but no formal description with list all the attributes ascribable to gdots. If gdots can't be made to plot individuals at a given (x,y) point, is there some other way to do it? Thanks Laney Mills From darnold02@sprynet.com Sat Aug 10 13:47:05 2002 From: darnold02@sprynet.com (Don Arnold) Date: Sat, 10 Aug 2002 07:47:05 -0500 Subject: [Tutor] (no subject) References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C80C@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <001a01c2406c$0957cd70$cb11ba3f@defaultcomp> ----- Original Message ----- From: To: ; Sent: Friday, August 09, 2002 12:11 PM Subject: RE: [Tutor] (no subject) > Please use plain text when posting. > > > I am having a strange problem with my python code for > > reversing a number. > > Try converting to a string and then iterating over > the string from back to front using range... > > > > while (number/10) > 1 : > > number = number/10 > > I suspect you are using Python 2.2 which no longer > does integer division with /. > > Try it at the >>> prompt to see how it works > > >>> 123/10 > >>> (123/10)%10 > > etc. > > I think the new integer division operator is '//' > > I could be wrong, but that's my guess... > > Alan G. Python 2.2 still defaults to integer division unless you import division from __future__. After that, // performs integer division and / performs 'regular' division: >>> 2/3 0 >>> from __future__ import division >>> 2/3 0.66666666666666663 >>> 2//3 0 >>> Don From sarmstrong13@mac.com Sat Aug 10 14:57:02 2002 From: sarmstrong13@mac.com (SA) Date: Sat, 10 Aug 2002 08:57:02 -0500 Subject: [Tutor] Redirecting Python Interpreter Output In-Reply-To: <53830B7409B1D511A09C001083FD58FC0193B2DB@asia15-ofbj.beijing.oilfield.slb.com> Message-ID: > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3111814626_82358 Content-type: text/plain; charset="ISO-8859-1" Content-transfer-encoding: quoted-printable On 8/10/02 6:15 AM, "Ketut Mahaindra" wrote: > Hi,=20 >=20 > I am currently developing an application > which embed / extend Python in C++ / MSVC 6.0 >=20 > If I embed the Python interpreter in my C++ code, is there any way to > redirect the output of the interpreter or the output of the script ? > For example I want to catch the output and display it in an edit box > Any suggestions here ? I managed to do this with a little Python/Tkinter script. This is not the best of scripts, but if you look in the =B3def expyth=B2 function you will see what you are looking for. t1 is the input text box and t2 is the output tex= t box. This script is designed to run the python code in t1 and display the output in t2. #!/usr/bin/env python from Tkinter import * import os import commands import sys import tkSimpleDialog class PyShell: =20 def clearin(self): self.t1.delete(0.0,END) def clearout(self): self.t2.delete(0.0,END) def expyth(self): self.t2.delete(0.0, END) #Clear Textbox 2, ready it for input. self.output =3D commands.getoutput("/sw/bin/python -c '%s'" % self.t1.get(0.0, END).strip()) #run commands from textbox1 and capture their output. self.t2.insert(END, self.output) #write output to textbox2 def doSave(self): SaveDialog =3D Saving(self.f) filename =3D SaveDialog.getName() self.saveText(filename) del(saveDialog) def __init__(self, top): self.t1 =3D Text(top, height=3D"12", width=3D"84", font=3D"Courier 12") self.t1.pack(side=3DTOP, pady=3D2) self.f =3D Frame(top) self.f.pack() self.b1 =3D Button(self.f, text=3D"Execute", command=3Dself.expyth) self.b1.pack(side=3DLEFT) self.b2 =3D Button(self.f, text=3D"Clear Input", command=3Dself.clearin) self.b2.pack(side=3DLEFT) self.b3 =3D Button(self.f, text=3D"Clear Output", command=3Dself.clearout= ) self.b3.pack(side=3DLEFT) self.b4 =3D Button(self.f, text=3D"Save Input", command=3Dself.doSave) self.b4.pack(side=3DLEFT) self.t2 =3D Text(top, height=3D"12", width=3D"84", bg=3D"lightblue", font=3D"Courier 12") self.t2.pack(side=3DTOP, pady=3D2) class Saving(tkSimpleDialog.Dialog): =20 def body(self, master): Label(master, text=3D"Directory:").grid(row=3D0) Label(master, text=3D"Filename:").grid(row=3D1) self.e1 =3D Entry(master) self.e2 =3D Entry(master) self.e1.grid(row=3D0, column=3D1) self.e2.grid(row=3D1, column=3D1) return self.e1 def apply(self): dir =3D self.e1.get() fn =3D self.e2.get() self.name =3D dir + fn def getName(self): return self.name =20 root =3D Tk() app =3D PyShell(root) root.mainloop() Hope this help you. SA --=20 "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me --B_3111814626_82358 Content-type: text/html; charset="US-ASCII" Content-transfer-encoding: quoted-printable Re: [Tutor] Redirecting Python Interpreter Output On 8/10/02 6:15 AM, "Ketut Mahaindra" <KM= ahaindra@beijing.sema.slb.com> wrote:

Hi,

I am currently developing an application
which embed / extend Python in C++ / MSVC 6.0


If I embed the Python interpreter in my C++ code, is there a= ny way to
redirect the output of the interpreter or the output of the = script ?
For example I want to catch the output and display it in an = edit box
Any suggestions here ?

I managed to do this with a little Python/Tkinter script. This is not the b= est of scripts, but if you look in the “def expyth” function you= will see what you are looking for. t1 is the input text box and t2 is the o= utput text box. This script is designed to run the python code in t1 and dis= play the output in t2.

#!/usr/bin/env python

from Tkinter import *
import os
import commands
import sys
import tkSimpleDialog

class PyShell:
    
    def clearin(self):
        self.t1.delete(0.0,END)
    def clearout(self):
        self.t2.delete(0.0,END)
    def expyth(self):
        self.t2.delete(0.0, END) &n= bsp;#Clear Textbox 2, ready it for input.
        self.output =3D commands.geto= utput("/sw/bin/python -c '%s'" % self.t1.get(0.0, END).strip()) &n= bsp;#run commands from textbox1 and capture their output.
        self.t2.insert(END, self.ou= tput) #write output to textbox2
    def doSave(self):
        SaveDialog =3D Saving(self.f)=
        filename =3D SaveDialog.getNa= me()
        self.saveText(filename)
        del(saveDialog)
    def __init__(self, top):
        self.t1 =3D Text(top, height=3D= "12", width=3D"84", font=3D"Courier 12")
        self.t1.pack(side=3DTOP, pady= =3D2)
        self.f =3D Frame(top)
        self.f.pack()
        self.b1 =3D Button(self.f, te= xt=3D"Execute", command=3Dself.expyth)
        self.b1.pack(side=3DLEFT)
        self.b2 =3D Button(self.f, te= xt=3D"Clear Input", command=3Dself.clearin)
        self.b2.pack(side=3DLEFT)
        self.b3 =3D Button(self.f, te= xt=3D"Clear Output", command=3Dself.clearout)
        self.b3.pack(side=3DLEFT)
        self.b4 =3D Button(self.f, te= xt=3D"Save Input", command=3Dself.doSave)
        self.b4.pack(side=3DLEFT)
        self.t2 =3D Text(top, height=3D= "12", width=3D"84", bg=3D"lightblue", font=3D"C= ourier 12")
        self.t2.pack(side=3DTOP, pady= =3D2)

class Saving(tkSimpleDialog.Dialog):
    
    def body(self, master):
        Label(master, text=3D"Di= rectory:").grid(row=3D0)
        Label(master, text=3D"Fi= lename:").grid(row=3D1)
        self.e1 =3D Entry(master)
        self.e2 =3D Entry(master)
        self.e1.grid(row=3D0, column=3D= 1)
        self.e2.grid(row=3D1, column=3D= 1)
        return self.e1
    def apply(self):
        dir =3D self.e1.get()
        fn =3D self.e2.get()
        self.name =3D dir + fn
    def getName(self):
        return self.name

            &nb= sp;       
root =3D Tk()
app =3D PyShell(root)
root.mainloop()


Hope this help you.
SA


--
"I can do everything on my Mac I used to on my PC. Plus a lot more ...= "
-Me
--B_3111814626_82358-- From rob@uselesspython.com Sat Aug 10 15:27:41 2002 From: rob@uselesspython.com (Rob) Date: Sat, 10 Aug 2002 09:27:41 -0500 Subject: [Tutor] printing puzzlement In-Reply-To: Message-ID: This is a multi-part message in MIME format. ------=_NextPart_000_000A_01C24050.2CC4EDE0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit I completely agree that a refactoring is in order. What I had in mind to do was to demonstrate how the code could be translated more or less literally, then show how it could be improved, and why. (The C++ code was donated as-is, and I had in mind to at least make it more readable. The original .cpp file is attached to this message.) After I've had some coffee, I'll take a good look at what you've got here. Thanks, Rob > -----Original Message----- > From: Danny Yoo [mailto:dyoo@hkn.eecs.berkeley.edu] > Sent: Saturday, August 10, 2002 1:43 AM > To: Rob > Cc: Python Tutor > Subject: Re: [Tutor] printing puzzlement > > > > > On Fri, 9 Aug 2002, Rob wrote: > > > As seen in the C++ code snippet here, calculations are performed in the > > middle of the display of each line of output. > > Yikes. It's usually not a good thing when "presentation logic" --- the > table display --- is so closely tied to the calculation logic. Perhaps we > can try to refactor this, and yank out the calculation into separate > functions. > > > > > cout << "Pmt # Cur. Prin. Payment Int. Paid Rem. Prin." << endl; > > cout << > > "----- ---------- ------- --------- ----------" << endl; > > for (int index = 0; index < numPayments; index++) > > { > > cout << setw(5) << right << (index + 1); > > cout << setw(12) << right << fixed > > << setprecision(2) << principle; > > cout << setw(9) << right << fixed << amtPayment; > > float interest = > > (float (int (principle * monthRate * 100) ) ) / 100.0; > > cout << setw(11) << right << fixed << interest; > > principle = principle + interest - amtPayment; > > cout << setw(12) << right << fixed << principle; > > cout << endl; > > } > > > Here's one possible way to recode this: > > > ### > ## Warning: untested code > > class AmortizationSchedulePrinter: > > def __init__(self, starting_principle, amtPayment, monthRate): > self.startingPrinciple = startingPrinciple > self.amtPayment = amtPayment > self.monthRate = monthRate > > > def printAmortizationSchedule(self): > self.printHeader() > p = self.startingPrinciple > for index in range(self.numPayments): > printReportLine(index, p) > p = self.nextPrinciple(p) > > > def printReportLine(self, index, principle): > print ("%5f" > "%12.2f" > "%9.2f" > "%11.2f" > "%12.2f") % \ > (index + 1, > principle, > self.amtPayment, > self.interest(principle), > self.nextPrinciple(principle)) > > > def nextPrinciple(self, principle): > return principle + self.interest(principle) - self.amtPayment; > > > def interest(self, principle): > return (float (int (principle * self.monthRate * 100) ) ) / 100.0; > > > def printHeader(self): > print "Pmt # Cur. Prin. Payment Int. Paid Rem. Prin." > print "----- ---------- ------- --------- ----------" > ### > > > It is a bit longer than the original version, but it does allow us to make > changes to the line format more easily, since all of the formatting stuff > is in printHeader() and printReportLine(). > > > Hope this helps! > > ------=_NextPart_000_000A_01C24050.2CC4EDE0 Content-Type: application/octet-stream; name="amortization.cpp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="amortization.cpp" #include #include #include using namespace std; int main() { // Get the loan specifics cout << "Enter the loan amount: "; float principle; cin >> principle; cout << "Enter the annual percentage rate (APR) as a percent: "; float annualRate; cin >> annualRate; float monthRate =3D annualRate / 1200.0; cout << "Enter the number of payments: "; unsigned numPayments; cin >> numPayments; // Calculate the payment amount float amtPayment =3D (principle * monthRate * pow((1.0 + monthRate), = numPayments)) / (pow((1.0 + monthRate), numPayments) - 1.0); // Truncate payment to whole cents amtPayment =3D (float (int (amtPayment * 100))) / 100.0; cout << endl; cout << "The monthly payment is $" << fixed << setprecision(2) << = amtPayment << endl; // Display the amortization schedule cout << "Pmt # Cur. Prin. Payment Int. Paid Rem. Prin." << endl; cout << "----- ---------- ------- --------- ----------" << endl; for (int index =3D 0; index < numPayments; index++) { cout << setw(5) << right << (index + 1); cout << setw(12) << right << fixed << setprecision(2) << principle; cout << setw(9) << right << fixed << amtPayment; float interest =3D (float (int (principle * monthRate * 100) ) ) / = 100.0; cout << setw(11) << right << fixed << interest; principle =3D principle + interest - amtPayment; cout << setw(12) << right << fixed << principle; cout << endl; } // Wrapup and exit cout << endl; return 0; } ------=_NextPart_000_000A_01C24050.2CC4EDE0-- From rellik19@yahoo.com Sat Aug 10 18:25:30 2002 From: rellik19@yahoo.com (Arie van Willigen) Date: Sat, 10 Aug 2002 10:25:30 -0700 (PDT) Subject: [Tutor] AAAACCCKKK LOOPS :( Message-ID: <20020810172530.48732.qmail@web14906.mail.yahoo.com> --0-1893635468-1029000330=:48232 Content-Type: text/plain; charset=us-ascii Hi Im having difficulty figuring out how to create a certain loop i wanted to know how whould I have a random number generator continue to spit outnumbers until it gets a one or a two. This is my current code: import random mynum = random.randrange(1,13) print mynum if mynum < 3: print "*Click*" else: print "Your Attempt Failed" thank you Me Myself And I... Oh Yeah Arie Too... --------------------------------- Do You Yahoo!? HotJobs, a Yahoo! service - Search Thousands of New Jobs --0-1893635468-1029000330=:48232 Content-Type: text/html; charset=us-ascii

Hi Im having difficulty figuring out how to create a certain loop i wanted to know how whould I have a random number generator continue to spit outnumbers until it gets a one or a two. This is my current code:

import random
mynum = random.randrange(1,13)
print mynum
if mynum < 3:
    print "*Click*"
else:
    print "Your Attempt Failed"

thank you

 

 



Me Myself And I... Oh Yeah Arie Too...



Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs --0-1893635468-1029000330=:48232-- From python@experimentzero.org Sat Aug 10 18:34:09 2002 From: python@experimentzero.org (Britt A. Green) Date: Sat, 10 Aug 2002 10:34:09 -0700 Subject: [Tutor] AAAACCCKKK LOOPS :( References: <20020810172530.48732.qmail@web14906.mail.yahoo.com> Message-ID: <00b201c24094$34541ba0$5f01000a@opentable.com.ot> If I understand you right, you want the loop to run until it gets a one or a two, correct? Try something like this: import random while 1: mynum = random.randrange(1,13) print mynum if mynum < 3: print "*Click*" break else: print "Your Attempt Failed" Note: I'm not at a computer with Python installed so the above code may need a bit of tweeking. -- "My mom says I'm cool." ----- Original Message ----- From: "Arie van Willigen" To: Sent: Saturday, August 10, 2002 10:25 AM Subject: [Tutor] AAAACCCKKK LOOPS :( > > Hi Im having difficulty figuring out how to create a certain loop i wanted to know how whould I have a random number generator continue to spit outnumbers until it gets a one or a two. This is my current code: > > import random > mynum = random.randrange(1,13) > print mynum > if mynum < 3: > print "*Click*" > else: > print "Your Attempt Failed" > > thank you > > > > > > > Me Myself And I... Oh Yeah Arie Too... > > > --------------------------------- > Do You Yahoo!? > HotJobs, a Yahoo! service - Search Thousands of New Jobs From kalle@lysator.liu.se Sat Aug 10 18:39:25 2002 From: kalle@lysator.liu.se (Kalle Svensson) Date: Sat, 10 Aug 2002 19:39:25 +0200 Subject: [Tutor] AAAACCCKKK LOOPS :( In-Reply-To: <20020810172530.48732.qmail@web14906.mail.yahoo.com> References: <20020810172530.48732.qmail@web14906.mail.yahoo.com> Message-ID: <20020810173924.GB930@i92.ryd.student.liu.se> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [Arie van Willigen] > > Hi Im having difficulty figuring out how to create a certain loop i > wanted to know how whould I have a random number generator continue > to spit outnumbers until it gets a one or a two. This is my current > code: > > import random > mynum = random.randrange(1,13) > print mynum > if mynum < 3: > print "*Click*" > else: > print "Your Attempt Failed" The most common way to do this would be to create an infinite loop and then break from it when the condition is reached. while 1: mynum = random.randrange(1,13) print mynum if mynum < 3: print "*Click*" break else: print "Your Attempt Failed" You'll have to watch out and make sure that the exit condition (mynum < 3, in this case) will eventually become true. Otherwise, the program will hang in an infinite loop, since 1 is always true. Peace, Kalle - -- Kalle Svensson, http://www.juckapan.org/~kalle/ Student, root and saint in the Church of Emacs. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.6 iD8DBQE9VU/HdNeA1787sd0RApuZAJwL1XDuXcalBvX+N3y/CQJNsuct1wCgtnRA 0YPhzg5jziQ2gwc0U8Hmjr0= =RYJN -----END PGP SIGNATURE----- From pydan@danshafer.com Sat Aug 10 19:30:51 2002 From: pydan@danshafer.com (Dan Shafer) Date: Sat, 10 Aug 2002 11:30:51 -0700 Subject: [Tutor] RE: when to use OOP Message-ID: <5.1.0.14.0.20020810112330.02c8d1f0@mail.hurrah.com> Probably a minority view. I think that designing and programming software that goes beyond the fairly trivial should always be an occasion to consider seriously using OOP techniques. I am a strong advocate of OOP for almost any application that isn't just a toy demo app, in fact. There are lots of reasons for this and the case for OOP has been more than adequately made by far smarter people than I. But I have one reason for recommending that this virtually *always* be the strategy that is only sort of touched on by other advocates. I have found in many, many years of programming everything from relatively trivial and focused examples for some of my books to large-scale systems that I seldom if ever have a really keen view of what the software will ultimately want to be or become. Users change their minds (even when the user is me and I'm writing what feels at first like a trivial application). Specs and needs change. Potential add-ons and features that could not occur to someone before seeing the first cut at an application become must-haves. As a result, code -- even code you think is small, single-purpose, and static and therefore not necessarily a good candidate for OOP -- morphs over time. I have found it invariably to be true that when I need to extend or enhance software, having OOP code makes that process easier, faster, more effective, and far less bug-prone. This is a subset of the major argument for OOP that involves the whole issue of code maintenance; I just extend it to include code that at first blush seems not to call for OOP. There is no doubt OOP takes longer in the design stage (at least most of the time) over the more traditional jump-in-and-code approach many coders writing smallish things tend to take (myself included). And there is no doubt that there is some overhead associated with OOP design and coding. But I have never seen the end result prove unworthy of the additional time and overhead. So my advice is not to look for a reason to use OOP but rather to start every project with the assumption that OOP is in order and only deviate from that decision when clear circumstances dictate. I've never seen a project that was harder to extend or maintain because it was built using OOP strategies and techniques. Dan Shafer, Chief Scribe and Tablet Keeper PythonCard Open Source Project http://pythoncard.sourceforge.net From python@experimentzero.org Sat Aug 10 22:06:04 2002 From: python@experimentzero.org (Britt A. Green) Date: Sat, 10 Aug 2002 14:06:04 -0700 Subject: [Tutor] AAAACCCKKK LOOPS :( References: <20020810205341.27753.qmail@web14911.mail.yahoo.com> Message-ID: <016101c240b1$cf343750$5f01000a@opentable.com.ot> Let me answer the second question first. Basically a while loop repeats as long as a condition is true. You could do something like this: x = 1 while x < 10: print x x = x+1 This will cause this script to run until x is equal to 10. If you do while 1: The script will run until you tell it to exit since its always true (1 equals true, btw.) The word break is used to break out of a loop when some condition is met. In your case it was a random number being less than three. You can find out more about loops by going here: http://www.python.org/doc/current/tut/node6.html As for the sleep command, Python includes a sleep module. To use it, you need to import the time module. Then call sleep where you want, like so: time.sleep(number of seconds you want to sleep) So your program would look like this: import random, time while 1: mynum = random.randrange(1,13) print mynum if mynum < 3: print "*Click*" break else: print "Your Attempt Failed" time.sleep(5) // I'm guess you want to sleep here, after each failed attempt. Britt -- "My mom says I'm cool." ----- Original Message ----- From: "Arie van Willigen" To: "Britt A. Green" Sent: Saturday, August 10, 2002 1:53 PM Subject: Re: [Tutor] AAAACCCKKK LOOPS :( > > OK so how would i incorporate a 5 sec sleep mode in between each retry? > Also how come this works how does the "while" and "break" work??? > "Britt A. Green" > wrote:If I understand you right, you want the loop to run until it gets a one or a > two, correct? Try something like this: > > import random > while 1: > mynum = random.randrange(1,13) > print mynum > if mynum < 3: > print "*Click*" > break > else: > print "Your Attempt Failed" > > Note: I'm not at a computer with Python installed so the above code may need > a bit of tweeking. > > -- > "My mom says I'm cool." > ----- Original Message ----- > From: "Arie van Willigen" > To: > Sent: Saturday, August 10, 2002 10:25 AM > Subject: [Tutor] AAAACCCKKK LOOPS :( > > > > > > Hi Im having difficulty figuring out how to create a certain loop i wanted > to know how whould I have a random number generator continue to spit > outnumbers until it gets a one or a two. This is my current code: > > > > import random > > mynum = random.randrange(1,13) > > print mynum > > if mynum < 3: > > print "*Click*" > > else: > > print "Your Attempt Failed" > > > > thank you > > > > > > > > > > > > > > Me Myself And I... Oh Yeah Arie Too... > > > > > > --------------------------------- > > Do You Yahoo!? > > HotJobs, a Yahoo! service - Search Thousands of New Jobs > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > Me Myself And I... Oh Yeah Arie Too... > > > --------------------------------- > Do You Yahoo!? > HotJobs, a Yahoo! service - Search Thousands of New Jobs From dyoo@hkn.eecs.berkeley.edu Sat Aug 10 22:56:23 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sat, 10 Aug 2002 14:56:23 -0700 (PDT) Subject: [Tutor] RE: when to use OOP In-Reply-To: <5.1.0.14.0.20020810112330.02c8d1f0@mail.hurrah.com> Message-ID: > So my advice is not to look for a reason to use OOP but rather to start > every project with the assumption that OOP is in order and only deviate > from that decision when clear circumstances dictate. I've never seen a > project that was harder to extend or maintain because it was built using > OOP strategies and techniques. I still feel that unmaintainable code can be written using the most sophisticated of techniques. *grin* But seriously, there are ways of writing really bad OOP programs if we apply OOP techniques gratuitously. Bruce Tate has written a book called "Bitter Java" that talks about hideously bad OOP designs and how to improve them: http://www.manning.com/tate/ His focus is on "Antipatterns" --- OOP designs that can cause long-term maintainability problems. It's quite good, and even if its implementation language is Java, there's quite a lot that can apply well to Python programming. Best of wishes to you! From dyoo@hkn.eecs.berkeley.edu Sat Aug 10 23:07:54 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sat, 10 Aug 2002 15:07:54 -0700 (PDT) Subject: [Tutor] A quicky example of writing a SocketServer application (fwd) Message-ID: Doh; I meant to forward that off to tutor@python.org, not tutor@hkn. My apologies! ---------- Forwarded message ---------- Date: Sat, 10 Aug 2002 15:06:38 -0700 (PDT) From: Danny Yoo To: tutor@hkn.eecs.berkeley.edu Cc: Rob Andrews Subject: A quicky example of writing a SocketServer application Hi Rob, I'm starting to work with socket programming again, and thought this example might be interesting to folks. The standard library's 'SocketServer' module does have some documentation, but it's quite dense, and doesn't come with a working example. It looks a lot more intimidating than it should be, but it's actually not too scary. Here is a simple "echoing" server that repeats whatever is being sent to it. For example: ### dyoo@einfall:~$ python echo_server.py 123456 & [1] 3900 dyoo@einfall:~$ telnet localhost 123456 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. hello HELLO Connection closed by foreign host. dyoo@einfall:~$ telnet localhost 123456 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. hi, this is a test HI, THIS IS A TEST Connection closed by foreign host. ### ### """A small example of using the SocketServer module.""" import SocketServer class EchoRequestHandler(SocketServer.StreamRequestHandler): def handle(self): line = self.rfile.readline() self.wfile.write(line) class UppercaseRequestHandler(SocketServer.StreamRequestHandler): def handle(self): line = self.rfile.readline() self.wfile.write(line.upper()) if __name__ == '__main__': import sys port = int(sys.argv[1]) ## tcpserver = SocketServer.TCPServer(('localhost', port), ## EchoRequestHandler) tcpserver = SocketServer.TCPServer(('localhost', port), UppercaseRequestHandler) tcpserver.serve_forever() ### I hope this helps! From dyoo@hkn.eecs.berkeley.edu Sat Aug 10 23:20:25 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sat, 10 Aug 2002 15:20:25 -0700 (PDT) Subject: [Tutor] Telnetlib (Tutor.org) (fwd) Message-ID: Hi Levy, I hope you don't mind, but let me forward this to the rest of Tutor; there should be people there who can give suggestions on getting Telnetlib to send errors to a custom file. About password input: is it possible to use the 'getpass' module for this? It handles the display of a prompt, and also disguises the user's keystrokes so that the password doesn't show on screen. Best of wishes to you! ---------- Forwarded message ---------- Date: Tue, 6 Aug 2002 19:55:37 -0700 (PDT) From: Levy Lazarre To: dyoo@hkn.eecs.berkeley.edu Subject: Telnetlib (Tutor.org) Hi Danny, Thanks for your suggestion about redirecting stderr to a file. The problem is that the TelnetLib module sends the errors to stdout, not stderr. I cannot redirect stdout because I prompt the user for a user ID and password and they would not see those prompts if I redirect stdout. Maybe I should tweak the module itself and redirect the errors to stderr then redirect stderr to a file? Thanks, Levy __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From pydan@danshafer.com Sun Aug 11 02:10:11 2002 From: pydan@danshafer.com (Dan Shafer) Date: Sat, 10 Aug 2002 18:10:11 -0700 Subject: [Tutor] RE: when to use OOP In-Reply-To: References: <5.1.0.14.0.20020810112330.02c8d1f0@mail.hurrah.com> Message-ID: <5.1.0.14.0.20020810180900.00af9238@mail.hurrah.com> At 02:56 PM 8/10/2002 -0700, Danny Yoo wrote: > > So my advice is not to look for a reason to use OOP but rather to start > > every project with the assumption that OOP is in order and only deviate > > from that decision when clear circumstances dictate. I've never seen a > > project that was harder to extend or maintain because it was built using > > OOP strategies and techniques. > >I still feel that unmaintainable code can be written using the most >sophisticated of techniques. *grin* Oh, that's for sure! You can write unmaintainable code in English. They're called user manuals! :-) >But seriously, there are ways of writing really bad OOP programs if we >apply OOP techniques gratuitously. Bruce Tate has written a book called >"Bitter Java" that talks about hideously bad OOP designs and how to >improve them: > > http://www.manning.com/tate/ > >His focus is on "Antipatterns" --- OOP designs that can cause long-term >maintainability problems. It's quite good, and even if its implementation >language is Java, there's quite a lot that can apply well to Python >programming. Patterns are another level of complexity and are, IMNSHO, more suited to designing frameworks than applications. I know that flies in the face of conventional wisdom but I've seldom let that slow me down! >Best of wishes to you! Dan Shafer, Chief Scribe and Tablet Keeper PythonCard Open Source Project http://pythoncard.sourceforge.net From KMahaindra@beijing.sema.slb.com Sun Aug 11 03:23:27 2002 From: KMahaindra@beijing.sema.slb.com (Ketut Mahaindra) Date: Sun, 11 Aug 2002 10:23:27 +0800 Subject: [Tutor] Redirecting Python Interpreter Output Message-ID: <53830B7409B1D511A09C001083FD58FC0193B2EB@asia15-ofbj.beijing.oilfield.slb.com> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --Boundary_(ID_h9VI79z7PdZK7gRSxuf97w) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Hi, Thanks for the response ... But now what if I want to catch the output from C++ ? Anybody got any experience on this ? So, for example I have a PyRun_SimpleString() or PyRun_SimpleFile or PyObject_CallObject on my C++ code ... Can I capture the output of the Python interpreter ? thanks in advance best regards ito -----Original Message----- From: SA [mailto:sarmstrong13@mac.com] Sent: Saturday, August 10, 2002 9:57 PM To: Ketut Mahaindra; 'tutor@python.org' Subject: Re: [Tutor] Redirecting Python Interpreter Output On 8/10/02 6:15 AM, "Ketut Mahaindra" wrote: Hi, I am currently developing an application which embed / extend Python in C++ / MSVC 6.0 If I embed the Python interpreter in my C++ code, is there any way to redirect the output of the interpreter or the output of the script ? For example I want to catch the output and display it in an edit box Any suggestions here ? I managed to do this with a little Python/Tkinter script. This is not the best of scripts, but if you look in the "def expyth" function you will see what you are looking for. t1 is the input text box and t2 is the output text box. This script is designed to run the python code in t1 and display the output in t2. #!/usr/bin/env python from Tkinter import * import os import commands import sys import tkSimpleDialog class PyShell: def clearin(self): self.t1.delete(0.0,END) def clearout(self): self.t2.delete(0.0,END) def expyth(self): self.t2.delete(0.0, END) #Clear Textbox 2, ready it for input. self.output = commands.getoutput("/sw/bin/python -c '%s'" % self.t1.get(0.0, END).strip()) #run commands from textbox1 and capture their output. self.t2.insert(END, self.output) #write output to textbox2 def doSave(self): SaveDialog = Saving(self.f) filename = SaveDialog.getName() self.saveText(filename) del(saveDialog) def __init__(self, top): self.t1 = Text(top, height="12", width="84", font="Courier 12") self.t1.pack(side=TOP, pady=2) self.f = Frame(top) self.f.pack() self.b1 = Button(self.f, text="Execute", command=self.expyth) self.b1.pack(side=LEFT) self.b2 = Button(self.f, text="Clear Input", command=self.clearin) self.b2.pack(side=LEFT) self.b3 = Button(self.f, text="Clear Output", command=self.clearout) self.b3.pack(side=LEFT) self.b4 = Button(self.f, text="Save Input", command=self.doSave) self.b4.pack(side=LEFT) self.t2 = Text(top, height="12", width="84", bg="lightblue", font="Courier 12") self.t2.pack(side=TOP, pady=2) class Saving(tkSimpleDialog.Dialog): def body(self, master): Label(master, text="Directory:").grid(row=0) Label(master, text="Filename:").grid(row=1) self.e1 = Entry(master) self.e2 = Entry(master) self.e1.grid(row=0, column=1) self.e2.grid(row=1, column=1) return self.e1 def apply(self): dir = self.e1.get() fn = self.e2.get() self.name = dir + fn def getName(self): return self.name root = Tk() app = PyShell(root) root.mainloop() Hope this help you. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me --Boundary_(ID_h9VI79z7PdZK7gRSxuf97w) Content-type: text/html; charset=iso-8859-1 Content-transfer-encoding: 7BIT RE: [Tutor] Redirecting Python Interpreter Output

Hi,

Thanks for the response ...
But now what if I want to catch the output from C++ ?
Anybody got any experience on this ?

So, for example I have a PyRun_SimpleString() or
PyRun_SimpleFile or PyObject_CallObject on my C++ code ...
Can I capture the output of the Python interpreter ?

thanks in advance

best regards

ito


-----Original Message-----
From: SA [mailto:sarmstrong13@mac.com]
Sent: Saturday, August 10, 2002 9:57 PM
To: Ketut Mahaindra; 'tutor@python.org'
Subject: Re: [Tutor] Redirecting Python Interpreter Output


On 8/10/02 6:15 AM, "Ketut Mahaindra" <KMahaindra@beijing.sema.slb.com> wrote:


Hi,

I am currently developing an application
which embed / extend Python in C++ / MSVC 6.0

If I embed the Python interpreter in my C++ code, is there any way to
redirect the output of the interpreter or the output of the script ?
For example I want to catch the output and display it in an edit box
Any suggestions here ?


I managed to do this with a little Python/Tkinter script. This is not the best of scripts, but if you look in the "def expyth" function you will see what you are looking for. t1 is the input text box and t2 is the output text box. This script is designed to run the python code in t1 and display the output in t2.

#!/usr/bin/env python

from Tkinter import *
import os
import commands
import sys
import tkSimpleDialog

class PyShell:
   
    def clearin(self):
        self.t1.delete(0.0,END)
    def clearout(self):
        self.t2.delete(0.0,END)
    def expyth(self):
        self.t2.delete(0.0, END)  #Clear Textbox 2, ready it for input.
        self.output = commands.getoutput("/sw/bin/python -c '%s'" % self.t1.get(0.0, END).strip())  #run commands from textbox1 and capture their output.

        self.t2.insert(END, self.output) #write output to textbox2
    def doSave(self):
        SaveDialog = Saving(self.f)
        filename = SaveDialog.getName()
        self.saveText(filename)
        del(saveDialog)
    def __init__(self, top):
        self.t1 = Text(top, height="12", width="84", font="Courier 12")
        self.t1.pack(side=TOP, pady=2)
        self.f = Frame(top)
        self.f.pack()
        self.b1 = Button(self.f, text="Execute", command=self.expyth)
        self.b1.pack(side=LEFT)
        self.b2 = Button(self.f, text="Clear Input", command=self.clearin)
        self.b2.pack(side=LEFT)
        self.b3 = Button(self.f, text="Clear Output", command=self.clearout)
        self.b3.pack(side=LEFT)
        self.b4 = Button(self.f, text="Save Input", command=self.doSave)
        self.b4.pack(side=LEFT)
        self.t2 = Text(top, height="12", width="84", bg="lightblue", font="Courier 12")
        self.t2.pack(side=TOP, pady=2)

class Saving(tkSimpleDialog.Dialog):
   
    def body(self, master):
        Label(master, text="Directory:").grid(row=0)
        Label(master, text="Filename:").grid(row=1)
        self.e1 = Entry(master)
        self.e2 = Entry(master)
        self.e1.grid(row=0, column=1)
        self.e2.grid(row=1, column=1)
        return self.e1
    def apply(self):
        dir = self.e1.get()
        fn = self.e2.get()
        self.name = dir + fn
    def getName(self):
        return self.name

                   
root = Tk()
app = PyShell(root)
root.mainloop()


Hope this help you.
SA


--
"I can do everything on my Mac I used to on my PC. Plus a lot more ..."
-Me

--Boundary_(ID_h9VI79z7PdZK7gRSxuf97w)-- From dyoo@hkn.eecs.berkeley.edu Sun Aug 11 03:44:50 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sat, 10 Aug 2002 19:44:50 -0700 (PDT) Subject: [Tutor] Redirecting Python Interpreter Output In-Reply-To: <53830B7409B1D511A09C001083FD58FC0193B2EB@asia15-ofbj.beijing.oilfield.slb.com> Message-ID: On Sun, 11 Aug 2002, Ketut Mahaindra wrote: > But now what if I want to catch the output from C++ ? Anybody got any > experience on this ? > > So, for example I have a PyRun_SimpleString() or PyRun_SimpleFile or > PyObject_CallObject on my C++ code ... Can I capture the output of the > Python interpreter ? Probably; what you can do is assign a file-like object to the 'sys.stdout' variable of your embedded interpreter. A StringIO.StringIO() instance should do nicely. Afterwards, once you allow the user to do a PyRun_SimpleString(), you can pull out what was written to stdout by looking into the StringIO's contents. If you'd like, we can try to write a small sample application that does this, although I've haven't played with embedding Python before! From KMahaindra@beijing.sema.slb.com Sun Aug 11 03:55:00 2002 From: KMahaindra@beijing.sema.slb.com (Ketut Mahaindra) Date: Sun, 11 Aug 2002 10:55:00 +0800 Subject: [Tutor] Redirecting Python Interpreter Output Message-ID: <53830B7409B1D511A09C001083FD58FC0193B2EC@asia15-ofbj.beijing.oilfield.slb.com> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --Boundary_(ID_/hO1gunmB8QyqtTaxyfutA) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Hi, Thanks, your suggestion give some shed of light to me ... :) Since I am quite new to Python also, I will need more in depth look on the StringIO class and how to assign an object to the sys.stdout variable ... ;) I will try it out, any help is greatly appreciated ... especially if you're willing to make that "small apps" that you mentioned previously ... :) -- best regards ito @> -----Original Message----- @> From: Danny Yoo [mailto:dyoo@hkn.eecs.berkeley.edu] @> Sent: Sunday, August 11, 2002 10:45 AM @> To: Ketut Mahaindra @> Cc: 'tutor@python.org'; 'SA' @> Subject: RE: [Tutor] Redirecting Python Interpreter Output @> @> @> @> @> On Sun, 11 Aug 2002, Ketut Mahaindra wrote: @> @> > But now what if I want to catch the output from C++ ? @> Anybody got any @> > experience on this ? @> > @> > So, for example I have a PyRun_SimpleString() or @> PyRun_SimpleFile or @> > PyObject_CallObject on my C++ code ... Can I capture the @> output of the @> > Python interpreter ? @> @> Probably; what you can do is assign a file-like object to @> the 'sys.stdout' @> variable of your embedded interpreter. A @> StringIO.StringIO() instance @> should do nicely. @> @> Afterwards, once you allow the user to do a @> PyRun_SimpleString(), you can @> pull out what was written to stdout by looking into the StringIO's @> contents. @> @> If you'd like, we can try to write a small sample @> application that does @> this, although I've haven't played with embedding Python before! @> --Boundary_(ID_/hO1gunmB8QyqtTaxyfutA) Content-type: text/html; charset=iso-8859-1 Content-transfer-encoding: 7BIT RE: [Tutor] Redirecting Python Interpreter Output

Hi,

Thanks, your suggestion give some shed of light to me ... :)

Since I am quite new to Python also,
I will need more in depth look on the StringIO class and
how to assign an object to the sys.stdout variable ... ;)

I will try it out, any help is greatly appreciated ...
especially if you're willing to make that "small apps"
that you mentioned previously ... :)

--
best regards

ito

@> -----Original Message-----
@> From: Danny Yoo [mailto:dyoo@hkn.eecs.berkeley.edu]
@> Sent: Sunday, August 11, 2002 10:45 AM
@> To: Ketut Mahaindra
@> Cc: 'tutor@python.org'; 'SA'
@> Subject: RE: [Tutor] Redirecting Python Interpreter Output
@>
@>
@>
@>
@> On Sun, 11 Aug 2002, Ketut Mahaindra wrote:
@>
@> > But now what if I want to catch the output from C++ ?
@> Anybody got any
@> > experience on this ?
@> >
@> > So, for example I have a PyRun_SimpleString() or
@> PyRun_SimpleFile or
@> > PyObject_CallObject on my C++ code ... Can I capture the
@> output of the
@> > Python interpreter ?
@>
@> Probably; what you can do is assign a file-like object to
@> the 'sys.stdout'
@> variable of your embedded interpreter.  A
@> StringIO.StringIO() instance
@> should do nicely.
@>
@> Afterwards, once you allow the user to do a
@> PyRun_SimpleString(), you can
@> pull out what was written to stdout by looking into the StringIO's
@> contents.
@>
@> If you'd like, we can try to write a small sample
@> application that does
@> this, although I've haven't played with embedding Python before!
@>

--Boundary_(ID_/hO1gunmB8QyqtTaxyfutA)-- From KMahaindra@beijing.sema.slb.com Sun Aug 11 03:58:48 2002 From: KMahaindra@beijing.sema.slb.com (Ketut Mahaindra) Date: Sun, 11 Aug 2002 10:58:48 +0800 Subject: [Tutor] Python Debug Library Message-ID: <53830B7409B1D511A09C001083FD58FC0193B2ED@asia15-ofbj.beijing.oilfield.slb.com> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --Boundary_(ID_Q8MRSVIR5AEFsJjMOIO1YA) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Hi, I know this might be an old question ;) I need to know where to get python22_d.lib and the rest of python debug libraries ... I have searched for this in the mailing list archive And the only answer I found is that it will be available with the ActiveState ActivePython distribution However, I have tried to install ActivePython but they also doesn't have the debug libraries that I required ... :| Anybody else has the same experience ? Can I get those libraries somewhere else ? thanks in advance -- best regards ito --Boundary_(ID_Q8MRSVIR5AEFsJjMOIO1YA) Content-type: text/html; charset=iso-8859-1 Content-transfer-encoding: 7BIT Python Debug Library

Hi,

I know this might be an old question ;)

I need to know where to get python22_d.lib
and the rest of python debug libraries ...

I have searched for this in the mailing list archive
And the only answer I found is that it will be available
with the ActiveState ActivePython distribution

However, I have tried to install ActivePython
but they also doesn't have the debug libraries that
I required ... :|

Anybody else has the same experience ?
Can I get those libraries somewhere else ?

thanks in advance

--
best regards

ito

--Boundary_(ID_Q8MRSVIR5AEFsJjMOIO1YA)-- From pfjakub@earthlink.net Sun Aug 11 05:29:05 2002 From: pfjakub@earthlink.net (Peter F. Jakubowicz) Date: Sat, 10 Aug 2002 21:29:05 -0700 Subject: [Tutor] new to this Message-ID: <3.0.6.32.20020810212905.0079f640@earthlink.net> Hi. I have always wanted to learn to program, and as I have rather a lot of time on my hands at the moment, I'm going to do it. Mainly, I decided to learn Python because I'm a big Monty Python fan. Also, I have bought two Python books, Learn to Program Using Python and Learning Python. One motivation to learning to program is that I've read a bit about Chaos over the years, I am fascinated by that, and I think it would be great to write my own programs involving AI, fractals, and what have you. I probably shall have lots of annoying questions soon, but at the moment I'm just curious if there is any reason not to use Python for writing these sorts of programs. I guess I could still return the books if there is a better language for this. Regards, Peter From pfjakub@earthlink.net Sun Aug 11 05:38:24 2002 From: pfjakub@earthlink.net (Peter F. Jakubowicz) Date: Sat, 10 Aug 2002 21:38:24 -0700 Subject: [Tutor] erratum Message-ID: <3.0.6.32.20020810213824.0079dde0@earthlink.net> am fascinated by that, and I think it would be great to write my own programs involving AI --Sorry that should have read A-Life not AI - been (maybe) reading to many Philip K. Dick novels lately, Peter. From KMahaindra@beijing.sema.slb.com Sun Aug 11 08:10:36 2002 From: KMahaindra@beijing.sema.slb.com (Ketut Mahaindra) Date: Sun, 11 Aug 2002 15:10:36 +0800 Subject: [Tutor] Python Debug Library Message-ID: <53830B7409B1D511A09C001083FD58FC0193B2F1@asia15-ofbj.beijing.oilfield.slb.com> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --Boundary_(ID_o4w5OIzMyeDE5AZTQz6f6w) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Cancel the request, It is easy to build them out from the python 2.2.1 distribution using MSVC Anyone who needs it can contact me directly if you're too lazy to try :) -- best regards ito -----Original Message----- From: Ketut Mahaindra [mailto:KMahaindra@beijing.sema.slb.com] Sent: Sunday, August 11, 2002 10:59 AM To: 'tutor@python.org' Subject: [Tutor] Python Debug Library Hi, I know this might be an old question ;) I need to know where to get python22_d.lib and the rest of python debug libraries ... I have searched for this in the mailing list archive And the only answer I found is that it will be available with the ActiveState ActivePython distribution However, I have tried to install ActivePython but they also doesn't have the debug libraries that I required ... :| Anybody else has the same experience ? Can I get those libraries somewhere else ? thanks in advance -- best regards ito --Boundary_(ID_o4w5OIzMyeDE5AZTQz6f6w) Content-type: text/html; charset=iso-8859-1 Content-transfer-encoding: 7BIT RE: [Tutor] Python Debug Library

Cancel the request,
It is easy to build them out from the python 2.2.1 distribution using MSVC
Anyone who needs it can contact me directly if you're too lazy to try :)

--
best regards

ito

-----Original Message-----
From: Ketut Mahaindra [mailto:KMahaindra@beijing.sema.slb.com]
Sent: Sunday, August 11, 2002 10:59 AM
To: 'tutor@python.org'
Subject: [Tutor] Python Debug Library


Hi,
I know this might be an old question ;)
I need to know where to get python22_d.lib
and the rest of python debug libraries ...
I have searched for this in the mailing list archive
And the only answer I found is that it will be available
with the ActiveState ActivePython distribution
However, I have tried to install ActivePython
but they also doesn't have the debug libraries that
I required ... :|
Anybody else has the same experience ?
Can I get those libraries somewhere else ?
thanks in advance
--
best regards
ito

--Boundary_(ID_o4w5OIzMyeDE5AZTQz6f6w)-- From glingl@aon.at Sun Aug 11 08:20:26 2002 From: glingl@aon.at (Gregor Lingl) Date: Sun, 11 Aug 2002 09:20:26 +0200 Subject: [Tutor] new to this References: <3.0.6.32.20020810212905.0079f640@earthlink.net> Message-ID: <3D56103A.7030101@aon.at> A short sunday-morning-reply: Peter F. Jakubowicz schrieb: >Hi. I have always wanted to learn to program, and as I have rather a lot of >time on my hands at the moment, I'm going to do it. Mainly, I decided to >learn Python > a good idea! Python is a first class learning language! >because I'm a big Monty Python fan. > this only concerns the emotional component of your project which, of course, is an important one >Also, I have bought two >Python books, Learn to Program Using Python and Learning Python. > these belong to the best you can have these days - hot from the press is Magnus Hetlands Practical Python, http://www.apress.com/book/bookDisplay.html?bID=93 with a sample chaper - seems to be promising! (see also: his Instant Python: http://www.hetland.org/python/instant-python.php >One >motivation to learning to program is that I've read a bit about Chaos over >the years, I am fascinated by that, and I think it would be great to write >my own programs involving AI, fractals, and what have you. > Python is an all-purpose programming language, well suited for almost everything, except - as is often states - for real-time control of airplanes and nuclear power-plants etc ... What concerns AI, there is the new editition of google-director Peter Norvigs and Stuart Russels classic "leading textbook in Artificial Intelligence", AI: a modern approach, now beeing equipped with Python-Code. See: http://www.cs.berkeley.edu/~russell/aima.html About A-Life I don't know nothing, but what should A-Life be without AI? Now about Chaos: if I hat to stress one weak point of Python for people interested in things like you are, it is the lack of an easy-to-use graphics-output-(software)-device (widget) which supports drawing of individual pixels. And without this, drawing fractals is cumbersome.The other point - that Python performs only 1/10th as fast as for instance C - is of minor importance imho. One should think, that it were an easy task for one of the thousands of smart programmes out there to provide and glue-in such a widget - preferably for use in Tkinter-Apps, but as far as I know, it didn't happen until now! Nonetheless: no language surpasses Python for Learnig How To Program! What you will have learned, you will be able to transfer to other languages easily! So don't return your books! Have a nice sunday! Gregor >I probably shall >have lots of annoying questions soon, but at the moment I'm just curious if >there is any reason not to use Python for writing these sorts of programs. >I guess I could still return the books if there is a better language for >this. Regards, > >Peter > > >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > > > > From ae_iou11@hotmail.com Sun Aug 11 08:30:21 2002 From: ae_iou11@hotmail.com (Preeyanuch Sangsinlerd) Date: Sun, 11 Aug 2002 14:30:21 +0700 Subject: [Tutor] More Information Message-ID: Hi All, I'm now interestes in Python. Do you have more information about Python' s regular expression, symbol, how to write it, function, etc. (information that not have in Python web site) Thank you all, Ae _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com From sarmstrong13@mac.com Sun Aug 11 14:04:49 2002 From: sarmstrong13@mac.com (SA) Date: Sun, 11 Aug 2002 08:04:49 -0500 Subject: [Tutor] new to this In-Reply-To: <3D56103A.7030101@aon.at> Message-ID: On 8/11/02 2:20 AM, "Gregor Lingl" wrote: > Now about Chaos: if I hat to stress one weak point of Python for people > interested in things like you are, > it is the lack of an easy-to-use graphics-output-(software)-device > (widget) which supports drawing of individual > pixels. And without this, drawing fractals is cumbersome.The other > point - that Python performs only > 1/10th as fast as for instance C - is of minor importance imho. > What about Canvas? Part of Tkinter I believe. I seem to remember this was used to draw fractals in "Learning Python in 24 houurs". I'll have to check. Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From sarmstrong13@mac.com Sun Aug 11 14:08:37 2002 From: sarmstrong13@mac.com (SA) Date: Sun, 11 Aug 2002 08:08:37 -0500 Subject: [Tutor] More Information In-Reply-To: Message-ID: On 8/11/02 2:30 AM, "Preeyanuch Sangsinlerd" wrote: > Hi All, > I'm now interestes in Python. Do you have more information about Python' s > regular expression, symbol, how to write it, function, etc. (information > that not have in Python web site) > Thank you all, > Ae > Try the re module. http://www.python.org/doc/current/lib/module-re.html Of course you could use the os module to run grep outside of the python script or to run a perl script. But then why not just learn the obfuscated language Perl? But seriously, I believe the re module will give you pretty good regular expression code. Good Luck. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From fleet@teachout.org Sun Aug 11 15:06:44 2002 From: fleet@teachout.org (fleet@teachout.org) Date: Sun, 11 Aug 2002 10:06:44 -0400 (EDT) Subject: [Tutor] parse problem Message-ID: Have created a little script to scan my procmail filter for some information and ran into a little problem. I have the following type lines of interest: procmail: Matched "216.19.163.134" procmail: Matched "inbox.lv" procmail: Matched "spambites.com" procmail: Matched "Bill(s) 1618" To create the "fields" in this case, I'm using: log=open("log","r") for rline in log.readlines(): line=string.split(rline," ") if line[1]=="Matched": line1=line[2][1:-2] print "%s %s" % (line1, curdate) This works fine except for cases like the last line above where the "field" I want consists of words separated by spaces. I only want the information between the quotes. I don't think I should be using the quotes for field separators, as most of the log consists of quoted items as: procmail: Assigning "INCLUDERC=/home/fleet/.procmail/action.rc" procmail: No match on "^From.*(fleet|root)@fleet1\.paxp\.com" procmail: Assigning "INCLUDERC=/home/fleet/.procmail/root.rc" procmail: Match on "root@raq2\.paxp\.com" procmail: Assigning "LASTFOLDER=root" procmail: Opening "root" Any thoughts? - fleet - From glingl@aon.at Sun Aug 11 16:14:10 2002 From: glingl@aon.at (Gregor Lingl) Date: Sun, 11 Aug 2002 17:14:10 +0200 Subject: [Tutor] More Information References: Message-ID: <3D567F42.2020704@aon.at> SA schrieb: >On 8/11/02 2:30 AM, "Preeyanuch Sangsinlerd" wrote: > > > >>Hi All, >>I'm now interestes in Python. Do you have more information about Python' s >>regular expression, symbol, how to write it, function, etc. (information >>that not have in Python web site) >>Thank you all, >>Ae >> >> >> >Try the re module. >http://www.python.org/doc/current/lib/module-re.html > > Moreover there is a very fine regular-expression-HOWTO (along with other HOWTOs): http://py-howto.sourceforge.net/ Note that there is also a link to pdf-versions of these HOWTO's on this page, specifically to http://py-howto.sourceforge.net/pdf/regex.pdf Gregor From glingl@aon.at Sun Aug 11 18:56:39 2002 From: glingl@aon.at (Gregor Lingl) Date: Sun, 11 Aug 2002 19:56:39 +0200 Subject: [Tutor] new to this References: Message-ID: <3D56A557.5070305@aon.at> SA schrieb: >On 8/11/02 2:20 AM, "Gregor Lingl" wrote: > > >>Now about Chaos: if I had to stress one weak point of Python for people >>interested in things like you are, >>it is the lack of an easy-to-use graphics-output-(software)-device >>(widget) which supports drawing of individual >>pixels. And without this, drawing fractals is cumbersome.The other >>point - that Python performs only >>1/10th as fast as for instance C - is of minor importance imho. >> >> >> > >What about Canvas? Part of Tkinter I believe. I seem to remember this was >used to draw fractals in "Learning Python in 24 houurs". I'll have to check. > > > This is perfectly correct. But at the same time the examples from this book show how tedious this task is. Or not? I tried it out and made a quick and dirty fractal - it took me two hours to find the relevant information in all those books and websites - "Learning Python in 24 houurs" has also somewhat obfuscated code ;-) O.k., it's less tedious than I thaught. Nevertheless there remain some oddities: e. g. it's not easy to draw the sides of the ractangle a,b,c - because there is no line - method. You can't always get what you want! Gregor Here (and also in the attachment) is the code as well as another question appended: (Start start by clicking the window, exit by typing Escape) #### Sirpinski - triangle #### glingl@aon.at from Tkinter import * from random import randrange root = Tk() img = PhotoImage(width=300, height=300) lbl = Label(root, image=img, bg='white') lbl.pack() corners = [a, b, c] = [(22,260),(278,260),(150, 38)] p = (randrange(300), randrange(300)) for pixel in corners+[p]: img.put('black',pixel) root.update() done = 0 def start(event): p = pixel # weird! while not done: for i in range(20): c = corners[randrange(3)] p = ((p[0]+c[0])/2.0,(p[1]+c[1])/2.0) dot = (int(p[0]), int(p[1])) img.put('black',dot) root.update() def exit(event): import sys global done done = 1 sys.exit() root.bind('', start) root.bind('', exit) root.mainloop() ---------------- btw: how could I accomplish, that drawing starts with opening the window? In other words: to which event do I have to bind start? From glingl@aon.at Sun Aug 11 19:10:59 2002 From: glingl@aon.at (Gregor Lingl) Date: Sun, 11 Aug 2002 20:10:59 +0200 Subject: [Tutor] UsualAttForgottenError - Was: new to this References: <3D56A557.5070305@aon.at> Message-ID: <3D56A8B3.2010907@aon.at> This is a multi-part message in MIME format. --------------070503030009080704020900 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit As the code in the email is not correctly indented (at least in my email-client) here the forgotten attachment Sorry, Gregor --------------070503030009080704020900 Content-Type: text/plain; name="simplesirp.py" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="simplesirp.py" #### Sirpinski - triangle #### glingl@aon.at from Tkinter import * from random import randrange root = Tk() img = PhotoImage(width=300, height=300) lbl = Label(root, image=img, bg='white') lbl.pack() corners = [a, b, c] = [(22,260),(278,260),(150, 38)] p = (randrange(300), randrange(300)) for pixel in corners+[p]: img.put('black',pixel) root.update() done = 0 def start(event): p = pixel # weird! while not done: for i in range(20): c = corners[randrange(3)] p = ((p[0]+c[0])/2.0,(p[1]+c[1])/2.0) dot = (int(p[0]), int(p[1])) img.put('black',dot) root.update() def exit(event): import sys global done done = 1 sys.exit() root.bind('', start) root.bind('', exit) root.mainloop() --------------070503030009080704020900-- From lumbricus@gmx.net Sun Aug 11 19:05:31 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Sun, 11 Aug 2002 20:05:31 +0200 (MEST) Subject: [Tutor] Telnetlib (Tutor.org) (fwd) References: Message-ID: <28254.1029089131@www32.gmx.net> > Hi Levy, Hello! [ snip ] > About password input: is it possible to use the 'getpass' module for this? > It handles the display of a prompt, and also disguises the user's > keystrokes so that the password doesn't show on screen. > > > Best of wishes to you! > > ---------- Forwarded message ---------- > Date: Tue, 6 Aug 2002 19:55:37 -0700 (PDT) > From: Levy Lazarre > To: dyoo@hkn.eecs.berkeley.edu > Subject: Telnetlib (Tutor.org) > > Hi Danny, > > Thanks for your suggestion about redirecting stderr to > a file. The problem is that the TelnetLib module sends > the errors to stdout, not stderr. I cannot redirect > stdout because I prompt the user for a user ID and > password and they would not see those prompts if I > redirect stdout. perhaps you can start your program via shell script and then capture stdout with tee(1) man 1 tee > Maybe I should tweak the module itself and redirect > the errors to stderr then redirect stderr to a file? Sounds interesting. > Thanks, > > Levy HTH, HAND J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From dyoo@hkn.eecs.berkeley.edu Sun Aug 11 20:03:50 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sun, 11 Aug 2002 12:03:50 -0700 (PDT) Subject: [Tutor] new to this In-Reply-To: <3D56103A.7030101@aon.at> Message-ID: > >One motivation to learning to program is that I've read a bit about > >Chaos over the years, I am fascinated by that, and I think it would be > >great to write my own programs involving AI, fractals, and what have > >you. > > > Python is an all-purpose programming language, well suited for almost > everything, except - as is often states - for real-time control of > airplanes and nuclear power-plants etc ... > > What concerns AI, there is the new editition of google-director Peter > Norvigs and Stuart Russels classic "leading textbook in Artificial > Intelligence", AI: a modern approach, now beeing equipped with > Python-Code. See: http://www.cs.berkeley.edu/~russell/aima.html Peter Norvig, coauthor of "AI: A Modern Approach", is also known for his book "Foundations of Artificial Intellegence Programming: Case Studies in Common Lisp". http://norvig.com/ Incidently, he's also the author of the Python IAQ (Infrequently Asked Questions). *grin* Good luck! From GoreInventedAIM@netscape.net Sun Aug 11 20:06:11 2002 From: GoreInventedAIM@netscape.net (GoreInventedAIM@netscape.net) Date: Sun, 11 Aug 2002 15:06:11 -0400 Subject: [Tutor] (no subject) Message-ID: <7E8D95A1.026138AE.4D7922B9@netscape.net> goreinventedaim@netscape.net __________________________________________________________________ Pre-order the NEW Netscape 7.0 browser. Reserve your FREE CD and pay only $2.99 shipping and handling. http://cd.netscape.com/promo_one/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ From anthonyhernandez9@hotmail.com Thu Aug 8 07:10:12 2002 From: anthonyhernandez9@hotmail.com (Anthony Hernandez) Date: Thu, 08 Aug 2002 01:10:12 -0500 Subject: [Tutor] Help Please Message-ID:


Hey,

I was wondering if there was any way to turn your python scripts into .exe files so you can like give a copy to other people. Is there a way to do that? Thanx

-Anthony

 


MSN Photos is the easiest way to share and print your photos: Click Here
From Avinash Dutta" hello sir, is it possible to call a function B() which is defined inside another function A() from the scope of another function C() in python? example.. ******** def A(): ----def B(): def x(): def C(): ----# how can i call B() from here. is it possible in python? please reply. regards, avinash __________________________________________________________ Give your Company an email address like ravi @ ravi-exports.com. Sign up for Rediffmail Pro today! Know more. http://www.rediffmailpro.com/signup/ From sgeorge@vianetworks.co.uk Fri Aug 9 14:34:36 2002 From: sgeorge@vianetworks.co.uk (Steve George) Date: 09 Aug 2002 14:34:36 +0100 Subject: [Tutor] searching through a string list In-Reply-To: <20020809012231.85133.qmail@web13406.mail.yahoo.com> References: <20020809012231.85133.qmail@web13406.mail.yahoo.com> Message-ID: <1028900076.6011.9.camel@laptop.rascal.org> Hi Mathew, I think my short example meets your request. On Fri, 2002-08-09 at 02:22, Mathew P. wrote: > This list will have the same names in it more than once, and what I am > actually doing is parsing the list to find out how many times a persons > name appears in the list. To complicate things, I need to be able to do > a partial match. For instance, I need to be able to find out how many > "anthony" 's appear in the list - so if I have an anthony brown, and > anthony johnson, and an anthony williams, the program will count three > anthonys. #!/usr/bin/env python import string input_list = [ ['1', 'george'], ['2', 'simon'], ['3', 'john'], ['4', 'simon smith'] ] output_dict = { } search_term = "simon" for x, y in input_list: ret = y.find( search_term ) if ret >= 0: if search_term in output_dict.keys(): output_dict[ search_term] += 1 else: output_dict[search_term] = 1 print output_dict The only downside with this logic is that it will also catch "john anthony" or in my specific example 'simone' because Pythons string find method will match any substring. You might want to consider the general expression library if you need anything more complex. Cheers, Steve From info@abreu-mx.com Fri Aug 9 19:46:30 2002 From: info@abreu-mx.com (Jose Alberto Abreu) Date: Fri, 09 Aug 2002 13:46:30 -0500 Subject: [Tutor] Getting info out of an Excel spreadsheet Message-ID: <3D540E06.7070108@abreu-mx.com> Hello list: Is there any not-too-difficult way to pull out two columns out of an Excel file, convert them into lists and play with them? Best Regards From Budman4106@aol.com Sat Aug 10 03:19:55 2002 From: Budman4106@aol.com (Budman4106@aol.com) Date: Fri, 9 Aug 2002 22:19:55 EDT Subject: [Tutor] Trouble getting started Message-ID: <163.12080e54.2a85d24b@aol.com> --part1_163.12080e54.2a85d24b_boundary Content-Type: multipart/alternative; boundary="163.12080e54_alt_bound" --163.12080e54_alt_bound Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Here's a screen shot of whats going on. I'm just getting started and dont understand what this syntax error means. Also when I try to run the "Hello World" Script it says the python buffer has not been saved and I need to know how to save the buffer. I know I'm being a pain but I want to learn some sort of programming just for fun and Python seems to be a good place to start...... any help would be appreciated [Unable to display image][Unable to display image] --163.12080e54_alt_bound Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: 7bit Here's a screen shot of whats going on. I'm just getting started and dont understand what this syntax error means. Also when I try to run the "Hello World" Script it says the python buffer has not been saved and I need to know how to save the buffer. I know I'm being a pain but I want to learn some sort of programming just for fun and Python seems to be a good place to start...... any help would be appreciated

--163.12080e54_alt_bound-- --part1_163.12080e54.2a85d24b_boundary Content-ID: Content-Type: image/jpeg Content-Disposition: inline Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAgAAAAAAAAD/wAARCAJYAyADASIAAhEBAxEB/9sAQwAQCwwODAoQDg0O EhEQExgoGhgWFhgxIyUdKDozPTw5Mzg3QEhcTkBEV0U3OFBtUVdfYmdoZz5NcXlwZHhcZWdj /9sAQwEREhIYFRgvGhovY0I4QmNjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2Nj Y2NjY2NjY2NjY2NjY2Nj/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAHwEA AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQR BRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RF RkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ip qrKztLW2t7i5usL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ufPnOO/Til9Xbs/6/rzDmtobtFQi 5iN2bUFjMsYkI2nAUkgc4x1B4zng1zV7bxHVLm1NlCy3F5FKcxAlsGH8wQZyf91/RqKVLndn oDdjq6Kwvt8n2n/j+/0r7T5f2H5P9X5m3dtxv+58+c479OKdaXf2jVrq3bWFzFcYigXy9zDa rMp4yQDuHGCMHJPZ+wlZvt6/5Bc26KyJ7qyj8TWytPbrObeSJgXUNktGVU9+ckgfWs/UrtH2 vdXqLJFfITbOikRIswAfpuTK4O5jghiP4hhww7lbzC509FVJIs6tby70G2CVdhPzHLRnIHoM c/UVbrBqyQwooopARpDHHLJIiAPKQXbucDAqSiigLWCiiigAooooAKKKKACiiigAooooAKKK KACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigA ooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigApkn3D+FP pkn3D+FAED/fb60lK/32+tJWYzE03/j/ALD/AK6S/wDs1dNXM6b/AMf9h/10l/8AZq6anDZi CiiirAKjf7/4VJUb/f8AwpMBV6Ur/wAP1pF6Ur/w/WgClov/ACDI/wDff/0M1X1E/wDE9sh6 2lz/ADiqxov/ACDI/wDff/0M1BqH/Ifsf+vW4/nFR0AzV1SWQyC30i5uESRozIjDBKkg/wAq d/aF2Rg6Bef99Crfhb/jwuOv/H7P/wChmlOsul5LE8R2xXCwEDqd23B/8fH5GiwFP7fd5z/Y F39dwzS/b7v/AKAV3/30K1JdXto1mY5xDKIX9nPQfqv50tvqcVxfT2qo4aGQxknoTtDfyNFg Mo391jnw9dn6sKguLmad4hLpc9oN4/eSEEHg8f59K2IdYia8uLWb5HimEWc/3gpU/jux+FVd XvYpvLgjJYpNy3bIBBH58fhUzXusT2HeEf8AkFz/APX3N/6Ga3Kw/CP/ACC5/wDr7m/9DNWo pZftzpaO88O4+aJchIznnY+Msc7vl5AxjK4ANLYpK5pUVmxSy/bnS0d54dx80S5CRnPOx8ZY 53fLyBjGV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H/voVSoouFy79sX+4f++hSreKGB2d D3YVRoouFyEQNEzKpDgsWBGB1OaXY/8Ad/Uf41LRVc7C5Fsf+7+o/wAaNj/3f1H+NS0Ue0YX Itj/AN39R/jRsf8Au/qP8aloo9owuMk82SRncZZiSTkcmm7H/u/qP8aloo9owuRbH/u/qP8A GjY/939R/jUtFHtGFyLY/wDd/Uf40bH/ALv6j/GpaKPaMLkWx/7v6j/GjY/939R/jUtFHtGF yLY/939R/jRsf+7+o/xqWij2jC5Fsf8Au/qP8aNj/wB39R/jUtFHtGFyLY/939R/jRsfP3f1 H+NS0Ue0YXLkMsccMaFwSqgZ+gqT7RH/AHhWfRU3C5ofaI/7wo+0R/3hWfRRcLmh9oj/ALwo +0R/3hWfRRcLmh9oj/vCj7RH/eFZ9FFwuaH2iP8AvCj7RH/eFZ9FFwuaH2iP+8KPtEf94Vn0 UXC5ofaI/wC8KPtEf94Vn0UXC5ofaI/7wo+0R/3hWfRRcLmh9oj/ALwo+0R/3hWfRRcLmh9o j/vCj7RH/eFZ9FFwuaH2iP8AvCj7RH/eFZ9FFwuaH2iP+8KPtEf94Vn0UXC5ofaI/wC8KPtE f94Vn0UXC5ofaI/7wo+0R/3hWfRRcLmh9oj/ALwo+0R/3hWfRRcLmh9oj/vCj7RH/eFZ9FFw uXJGtpPvhWq1aG3ggjaONVd0BYjryOmayavQ/wCoj/3B/Ki7NIO+hf8AtKe9H2lPeqlFS4xe rRpYt/aU96PtKe9VKKpaaILFv7SnvR9pT3qpRRcLFv7SnvR9pT3qpRRcLFv7SnvR9pT3qpRR cLFv7SnvR9pT3qpRRcL/2Q== --part1_163.12080e54.2a85d24b_boundary Content-ID: Content-Type: image/jpeg Content-Disposition: inline Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAgAAAAAAAAD/wAARCAJYAyADASIAAhEBAxEB/9sAQwAQCwwODAoQDg0O EhEQExgoGhgWFhgxIyUdKDozPTw5Mzg3QEhcTkBEV0U3OFBtUVdfYmdoZz5NcXl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+8Kz6KLhc0PtEf94UfaI/7wrPoo uFzQ+0R/3hR9oj/vCs+ii4XND7RH/eFH2iP+8Kz6KLhc0PtEf94UfaI/7wrPoouFzQ+0R/3h R9oj/vCs+ii4XND7RH/eFH2iP+8Kz6KLhc0PtEf94UfaI/7wrPoouFzQ+0R/3hR9oj/vCs+i i4XND7RH/eFH2iP+8Kz6KLhc0PtEf94UfaI/7wrPoouFzQ+0R/3hR9oj/vCs+ii4XND7RH/e FH2iP+8Kz6KLhcuSNbSffCtVq0NvBBG0caq7oCxHXkdM1k1eh/1Ef+4P5UXZpB30L/2lPej7 SnvVSipcYvVo0sW/tKe9H2lPeqlFUtNEFi39pT3o+0p71UoouFi39pT3o+0p71UoouFi39pT 3o+0p71UoouFi39pT3o+0p71UoouFv/Z --part1_163.12080e54.2a85d24b_boundary-- From KMahaindra@beijing.sema.slb.com Mon Aug 12 02:48:36 2002 From: KMahaindra@beijing.sema.slb.com (Ketut Mahaindra) Date: Mon, 12 Aug 2002 09:48:36 +0800 Subject: [Tutor] Trouble getting started Message-ID: <53830B7409B1D511A09C001083FD58FC0193B2F5@asia15-ofbj.beijing.oilfield.slb.com> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --Boundary_(ID_KC7DsitczD5/kis0Ee2MjA) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Hi, I believe you should have for i in range(10): print i notice that it is an "i" and not a "1" this is where the syntax error came up hope it helps best regards ito -----Original Message----- From: Budman4106@aol.com [mailto:Budman4106@aol.com] Sent: Saturday, August 10, 2002 10:20 AM To: tutor@python.org Subject: [Tutor] Trouble getting started Here's a screen shot of whats going on. I'm just getting started and dont understand what this syntax error means. Also when I try to run the "Hello World" Script it says the python buffer has not been saved and I need to know how to save the buffer. I know I'm being a pain but I want to learn some sort of programming just for fun and Python seems to be a good place to start...... any help would be appreciated --Boundary_(ID_KC7DsitczD5/kis0Ee2MjA) Content-type: text/html; charset=iso-8859-1 Content-transfer-encoding: 7BIT RE: [Tutor] Trouble getting started

Hi,
I believe you should have

for i in range(10):
        print i

notice that it is an "i" and not a "1"
this is where the syntax error came up

hope it helps
best regards

ito

-----Original Message-----
From: Budman4106@aol.com [mailto:Budman4106@aol.com]
Sent: Saturday, August 10, 2002 10:20 AM
To: tutor@python.org
Subject: [Tutor] Trouble getting started


Here's a screen shot of whats going on. I'm just getting started and dont understand what this syntax error means. Also when I try to run the "Hello World" Script it says the python buffer has not been saved and I need to know how to save the buffer. I know I'm being a pain but I want to learn some sort of programming just for fun and Python seems to be a good place to start...... any help would be appreciated

 

--Boundary_(ID_KC7DsitczD5/kis0Ee2MjA)-- From p.hartley@spitech.com Mon Aug 12 03:22:06 2002 From: p.hartley@spitech.com (Paul Hartley) Date: Mon, 12 Aug 2002 10:22:06 +0800 Subject: [Tutor] Gadfly database location Message-ID: <006001c241a7$426ed9a0$ebe710ac@pc7345> This is a multi-part message in MIME format. ------=_NextPart_000_005B_01C241EA.1C05F3A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Having just installed Gadfly on my Windows 98 PC (running the test = before installation produced 40 errors, but then installing was OK), I = have created my first database with table successfully. I have two questions. One, to open a database the second parameter is a directory name, and = gadlfy seems to look for the directory starting at the current = directory. So if my python module is in /python/test/gadfly and I start = a database located at 'testdb' then gadfly looks in = /python/test/gadfly/testdb. How do I get gadfly to look elsewhere for = the database (i.e. in /server/data?)=20 The second question is why, when I start programming a new language, do = the questions I want answers to never seem to be addressed in the books = or tutorials - like the above question? Is this kind of situation common = to all you experienced programmers or is it only the stupid ones like me = that get stuck on the first day with a question (usually to do with how = to use the language for a specific application?) With the question above = the assumption is that all code is written in the directory immediately = before the database - a kind of ridiculous assumption I would have = thought!! Paul ------=_NextPart_000_005B_01C241EA.1C05F3A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Having just installed Gadfly on my = Windows 98 PC=20 (running the test before installation produced 40 errors, but then = installing=20 was OK), I have created my first database with table=20 successfully.
 
I have two questions.
 
One, to open a database the second = parameter is a=20 directory name, and gadlfy seems to look for the directory starting at = the=20 current directory. So if my python module is in /python/test/gadfly and = I start=20 a database located at 'testdb' then gadfly looks in = /python/test/gadfly/testdb.=20 How do I get gadfly to look elsewhere for the database (i.e. in = /server/data?)=20
 
The second question is why, when I = start=20 programming a new language, do the questions I want answers to never = seem to be=20 addressed in the books or tutorials - like the above question? Is this = kind of=20 situation common to all you experienced programmers or is it only the = stupid=20 ones like me that get stuck on the first day with a question (usually to = do with=20 how to use the language for a specific application?) With the question = above the=20 assumption is that all code is written in the directory immediately = before the=20 database - a kind of ridiculous assumption I would have = thought!!
 
Paul
 
 
------=_NextPart_000_005B_01C241EA.1C05F3A0-- From dyoo@hkn.eecs.berkeley.edu Mon Aug 12 03:44:16 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sun, 11 Aug 2002 19:44:16 -0700 (PDT) Subject: [Tutor] a query In-Reply-To: <20020808152726.7645.qmail@webmail16.rediffmail.com> Message-ID: On 8 Aug 2002, Avinash Dutta wrote: > is it possible to call a function B() which is defined inside another > function A() from the scope of another function C() in python? When we define an function inside another, we can treat it as if it were a local variable --- it'll only be accessible from A(). So unless you return that 'B' function from A(), we shouldn't be able to touch B. > def A(): > ----def B(): > > def x(): > > def C(): > ----# how can i call B() from here. This isn't possible directly, because 'B' is a local function of A, that is, it's a local name as far as Python's concerned. However, we can do something like this: ### >>> def makeIncrementer(n): ... def inc(x): ... return x + n ... return inc ... >>> inc_by_one = makeIncrementer(1) >>> inc_by_one(42) 43 >>> makeIncrementer("world")("hello") 'helloworld' ### (I'm sorry about the last example; I just couldn't resist. *grin*) What are you trying to do with inner functions, though? There may be a more Pythonic way of approaching your problem. Hope this helps! From dyoo@hkn.eecs.berkeley.edu Mon Aug 12 03:46:30 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sun, 11 Aug 2002 19:46:30 -0700 (PDT) Subject: [Tutor] Help Please In-Reply-To: Message-ID: On Thu, 8 Aug 2002, Anthony Hernandez wrote: > I was wondering if there was any way to turn your python scripts into > .exe files so you can like give a copy to other people. Is there a way > to do that? Thanx Hi Anthony, Yes: on Windows systems, there's a utility called 'py2exe' that bundles up source code with a subset Python's runtime system, so that you can send your programs as '.exe's. Here's a link to the software: http://py2exe.sourceforge.net I hope this helps! From dyoo@hkn.eecs.berkeley.edu Mon Aug 12 03:50:30 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sun, 11 Aug 2002 19:50:30 -0700 (PDT) Subject: [Tutor] Trouble getting started In-Reply-To: <163.12080e54.2a85d24b@aol.com> Message-ID: On Fri, 9 Aug 2002 Budman4106@aol.com wrote: > Here's a screen shot of whats going on. I'm just getting started and > dont understand what this syntax error means. Hi Budman, I can't look at the screenshot at the moment (I'm using a text terminal at the moment). Can you cut-and-paste the error message? Don't worry if it looks ugly; as long as we can see the error and the 'traceback', we should be able to figure things out on this end. > Also when I try to run the "Hello World" Script it says the python > buffer has not been saved and I need to know how to save the buffer. I > know I'm being a pain but I want to learn some sort of programming just > for fun and Python seems to be a good place to start...... any help > would be appreciated Have you had a chance to look at: http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro It's a tutorial that might clear up that message about not saving the Python buffer. All that IDLE is saying is that, before you run your program in IDLE, you should save it to disk, just in case bad things happen. It's a safety feature, although it can get annoying in the heat of programming. *grin* If you have more questions, please feel free to ask them on Tutor! Good luck to you. From dyoo@hkn.eecs.berkeley.edu Mon Aug 12 03:55:36 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sun, 11 Aug 2002 19:55:36 -0700 (PDT) Subject: [Tutor] Getting info out of an Excel spreadsheet In-Reply-To: <3D540E06.7070108@abreu-mx.com> Message-ID: On Fri, 9 Aug 2002, Jose Alberto Abreu wrote: > Is there any not-too-difficult way to pull out two columns out of an > Excel file, convert them into lists and play with them? If you can convert your Excel file into a "tab-delimited" flat text file, that might be an easy way of extracting the columns out. I'm pretty sure Excel can do this; check in the "Save as" command in the File menu. Once you have your data as a flat text file, you can use the file and string tools that Python provides, including the string.split() function. Let's say that our flat text file looked like this: ### 1 2 3 4 5 6 7 8 ### and let's say that we wanted to get the sum of both columns --- we can go about it like this: ### my_data_file = open('flat_data.txt') sum1, sum2 = 0, 0 for line in my_data_file: column1, column2 = line.split() sum1 = sum1 + int(column1) sum2 = sum2 + int(column2) print "sum1:", sum1 print "sum2:", sum2 ### From dyoo@hkn.eecs.berkeley.edu Mon Aug 12 04:00:01 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sun, 11 Aug 2002 20:00:01 -0700 (PDT) Subject: [Tutor] A chat server in Python Message-ID: Hi everyone, I've started to write a chat server in Python! It's in preparation for writing the online network part of that dots-and-boxes project that I forgot about last month. *grin* The code is a bit long, so I've placed it here: http://hkn.eecs.berkeley.edu/~dyoo/python/chatserver/chatserver.py I'd like some comments on how to improve it to make it more readable and easy to understand. Thank you! From dylan.belsey@baesystems.com Mon Aug 12 04:58:09 2002 From: dylan.belsey@baesystems.com (BELSEY, Dylan) Date: Mon, 12 Aug 2002 13:28:09 +0930 Subject: [Tutor] Trouble getting started Message-ID: <86C3892A0C52D411AF5000A0C9EAA3B96320E1@wtntex1.baea.com.au> Just a note on the first error that you get in the first hello.py window, the invalid syntax error looks like it is the result of pasting the first line of the interpreter start up, into the file. The reason that the SyntaxError points to the 2.2 is that it thinks that "Python" is some sort of variable and doesn't recognise the format of the command thereafter. You might want to remove this line from your file. HTH Dylan. PS: "#" represents a comment so the rest of the line would not matter! From thomi@thomi.imail.net.nz Mon Aug 12 11:24:52 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Mon, 12 Aug 2002 22:24:52 +1200 Subject: [Tutor] design ideas? Message-ID: <20020812222452.5c72dcad.thomi@thomi.imail.net.nz> hey there all... I'm working on a project with python, and id appreciate some design answers.. The project is an artificial life simulator, very similar to matrem, but in python. basically the program runs through a series of steps, in a loop, until the user does something: 1.- processes animals, and moves them, one by one 2.- processes terrain, and moves it, a tile at a time 3.- updates graphics stuff. there are several problems with this, the first is, this program needs to be able to run at top speeds of 50 cycles a second. it will have over 65'000 things to calculate each turn, and the speed will obviously depend on the users computer, but what kind of things can i do to speed up the python program?? im just a beginner, and this will be a HUGE challenge, so ill probably post here many times before its done. -- Lord, what fools these mortals be! -- midsummer nights dream. Thomi Richards, thomi@imail.net.nz From alan.gauld@bt.com Mon Aug 12 11:26:18 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 12 Aug 2002 11:26:18 +0100 Subject: [Tutor] printing puzzlement Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C810@mbtlipnt02.btlabs.bt.co.uk> > As seen in the C++ code snippet here, calculations are > performed in the middle of the display of each line of > output. Does anyone know of a good way to reproduce > similar behavior in a Python program? The same way the C++ programmer would have done it if [s]he'd had any sense - using a string buffer and then writing the full string out! In Pythons case use a format string and some variables to hold the intermediate values... > // Display the amortization schedule > for (int index = 0; index < numPayments; index++) > { > cout << setw(5) << right << (index + 1); > cout << setw(12) << right << fixed << > setprecision(2) << principle; > cout << setw(9) << right << fixed << amtPayment; buff = "%5d%12.2d%9d" % (index+1,principle, amtPayment) > float interest = (float (int (principle * > monthRate * 100) ) ) / 100.0; > cout << setw(11) << right << fixed << interest; > principle = principle + interest - amtPayment; > cout << setw(12) << right << fixed << principle; buff = buff + "%11d%12d" % (interest, principle) > cout << endl; print buff The types and precisions might need frigging but you hopefully get the idea I'm suggesting. Alan g. From alan.gauld@bt.com Mon Aug 12 11:29:41 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 12 Aug 2002 11:29:41 +0100 Subject: [Tutor] reverse a number (was no subject) Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C811@mbtlipnt02.btlabs.bt.co.uk> > To do this without using a string I had to loop through > the number twice. The first time to see how many digits, > the second to actually compute the number. > > It's mighty ugly, but it works. There must be a better > way. length = len(str(number)) # beware of '.' in floats tho'! That OK??? Alan G. From scot@possum.in-berlin.de Mon Aug 12 09:55:43 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Mon, 12 Aug 2002 10:55:43 +0200 Subject: [Tutor] A chat server in Python In-Reply-To: References: Message-ID: <200208121055.43896.scot@possum.in-berlin.de> Hello Danny, > I've started to write a chat server in Python! It's in preparation for > writing the online network part of that dots-and-boxes project that I > forgot about last month. *grin* Thank you for the code example! If I could bother you with a few questions... ============================ from threading import * ============================ The docs for the threading module say that it is safe to do this, but I remember being told by one of the books (can't find the reference right now, will dig if important) not to unless you're importing Tkinter. Is threading another exception, or has "from import *" become less dangerous in Python 2.2, or was the original warning overdone? ============================ def _waitForShutdownOrNewMessages(self): return self._events.get() ============================ Is ease of maintainance the the reason not to put self._events.get() directly into the "while 1" loop? ============================ self._listeners_lock.acquire() try: listeners_copy = self._listeners[:] finally: self._listeners_lock.release() for listener in listeners_copy: self._tryToSendMessageToListener(msg, listener) ============================ I'm not sure I understand the reason for the copy of self._listeners, or in other words, why this part isn't simply --------------------------------------------------- self._listeners_lock.acquire() try: for listener in self._listeners: self._tryToSendMessageToListener(msg, listener) finally: self._listeners_lock.release() ---------------------------------------------------- since if self._listeners() is empty, the for-loop wouldn't run, and I don't see anything that could change self._listeners. Thank you again, Y, Scot -- 9:59am up 55 days, 7:21, 2 users, load average: 0.00, 0.07, 0.08 From scot@possum.in-berlin.de Mon Aug 12 11:54:44 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Mon, 12 Aug 2002 12:54:44 +0200 Subject: [Tutor] Generating sigs with Python for fun and education Message-ID: <200208121254.44192.scot@possum.in-berlin.de> Hi there, My mail program, kmail (part of KDE for Linux) has an option which lets you use the output of a program as a signature. So I got this idea to use Python to dynamically generate signatures instead of having a boring, static one. The rules are that you only get three lines with 78 characters each (I dimly remember there is a RFC for sigs, but these seem like safe values), and something should chance from signature to signature. The program included below produces sigs of the from: Scot W. Stevenson wrote this on Monday, 12. Aug 2002 in Berlin, Germany on his happy little Linux system that has been up for 1330 hours and has a CPU that is falling asleep at a system load of 0.02. The '--' part of the signature is added by my mailer. If anybody wants to join the fun, I'd be interested to see what they come up with. As alway, I am grateful for any suggestions to the code. This version has not been tested at high loads (yet). Y, Scot ============================================================= #!/usr/bin/env python # A Python Signature Generator, first 'uptime' version # Scot W. Stevenson scot@possum.in-berlin.de 11. August 2002 (c) GPL # Produces a signature with name of user, uptime in hours, and sys load # This works on *nix machines with the 'uptime' command only. # Tested with SuSE Linux 8.0 and Python 2.2 import os, time sig = '' lines = [] max_line_length = 78 # First line: Location, local time, username line_1_template = ' %s wrote this on %s in %s' user_name = 'Scot W. Stevenson' location = 'Berlin, Germany' real_days = {'Mon' : 'Monday', 'Tue' : 'Tuesday', 'Wed' : 'Wednesday', 'Thu' : 'Thursday', 'Fri' : 'Friday', 'Sat' : 'Saturday', 'Sun' : 'Sunday'} now_list = time.asctime(time.localtime(time.time())).split() now = "%s, %s. %s %s" % (real_days[now_list[0]], # Weekday now_list[2], # Day now_list[1], # Month now_list[4]) # Year lines.append(line_1_template % (user_name, now, location)) # Second line: System type and uptime in hours line_2_template = ' on his %s system that has been up for %s hours' system_type = 'happy little Linux' uptime = os.popen('uptime').read() split_uptime = uptime.split() days_up = int(split_uptime[2]) hours_up = int(split_uptime[4].split(':')[0]) uphours = days_up * 24 + hours_up lines.append(line_2_template % (system_type, uphours)) # Third line: System load line_3_template = ' and has a CPU that is %s at a system load of %s.' load_phrases = {0: 'falling asleep', 1: 'underemployed', 2: 'busy with other things', 3: 'keeping his toes warm'} # Cut load levels above size of load_phrases to max in load_phrases load_level = min(len(load_phrases)-1, int(split_uptime[9].split('.')[0])) lines.append(line_3_template % (load_phrases[load_level], split_uptime[9][:-1])) # Center lines and print them for line in lines: if len(line) > max_line_length: print 'Line too long (> %s characters):' % max_line_length print line break bufferspaces = int((max_line_length-len(line))/2) print ' ' * bufferspaces + line ============================================================= -- Scot W. Stevenson wrote this on Monday, 12. Aug 2002 in Berlin, Germany on his happy little Linux system that has been up for 1330 hours and has a CPU that is falling asleep at a system load of 0.01. From alan.gauld@bt.com Mon Aug 12 12:04:38 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 12 Aug 2002 12:04:38 +0100 Subject: [Tutor] Saving session in IDLE Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C813@mbtlipnt02.btlabs.bt.co.uk> One of my tutor 'students' has asked me an interesting question. How do you Save Session in IDLE? You can save your current shell window as a text file and edit it to remove '>>> ' plus output lines etc. But that's messy. It would indeed be convenient to save an entire interactive session such that you could resume later where you left off. Two approaches seem feasible: 1) The good way - save the internal state - builtins dir and all imports etc but this sounds like it's a lot easier to say/write than to do! 2) The dirty approach - save the session window then on strip out extraneous lines. This becomes harder if the lines are continuations using '\' but otherwise should be possible. The resultant file can then be imported and the previous session replayed. There's a snag if the previous session had faults - and which interactive session doesn't - you stop at the faulty line. yuck... Looks like we're back to option 1.... Or does anyone know of a way of doing this already? Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From glingl@aon.at Mon Aug 12 12:35:51 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 12 Aug 2002 13:35:51 +0200 Subject: [Tutor] Saving session in IDLE References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C813@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <3D579D97.10608@aon.at> alan.gauld@bt.com schrieb: >One of my tutor 'students' has asked me an interesting >question. > >How do you Save Session in IDLE? > >You can save your current shell window as a text file >and edit it to remove '>>> ' plus output lines etc. >But that's messy. > >It would indeed be convenient to save an entire >interactive session such that you could resume later >where you left off. > > Ideed could be useful! >Two approaches seem feasible: >1) The good way - save the internal state - builtins dir > and all imports etc but this sounds like it's a lot easier > to say/write than to do! > >2) The dirty approach - ... There's >a snag if the previous session had faults - and >which interactive session doesn't - you stop at the >faulty line. yuck... > This could possibly be caught by a try: ... except: ... clause. Nonetheless I think, you couldn't do it without a Python-parser. How would you otherwise manage to process the following fancy input (+ output): >>> print " ",(1, 3, 7); print " Hello" (1, 3, 7) Hello >>> > >Looks like we're back to option 1.... > >Or does anyone know of a way of doing this already? > > Equally interested Gregor From gwatt3@backbonesecurity.com Mon Aug 12 13:39:44 2002 From: gwatt3@backbonesecurity.com (Watt III, Glenn) Date: Mon, 12 Aug 2002 08:39:44 -0400 Subject: [Tutor] debugging problem Message-ID: <94FD5825A793194CBF039E6673E9AFE034D617@bbserver1.backbonesecurity.com> ok heres my problem i run the script for the first proram listed call coll.py it runs into an error that says "Traceback (most recent call last): File "\\Bbserver4\test\admin\newdesign\papers\cgi\coll.py", line 113, in ? mainAction() File "\\Bbserver4\test\admin\newdesign\papers\cgi\coll.py", line 18, in mainAction email =3D backbone.reqField("email", "E-mail Address") AttributeError: 'module' object has no attribute 'reqField'" however there is an atribute called reqField in the backbone module as you can see in the second program listed what am i doin wron as usual thanks for any help coll: #!/usr/local/bin/python import MySQLdb import cgi import sys import backboner cgiForm =3D cgi.FieldStorage() err =3D "" wrong =3D 0 def mainAction(): global backbone email =3D backbone.reqField("email", "E-mail Address") backbone: #!/usr/local/bin/python err =3D "" wrong =3D 0 cgiForm =3D cgi.FieldStorage() # A checker for any required fields input is the name of the cgi variable response is what the user sees if it gets thrown back def reqField(input, response): global wrong global err if cgiForm.has_key(input): input =3D cgiForm[input].value return input elif wrong =3D=3D 1: err =3D err + ', ' + response else: err =3D response wrong =3D 1 From glingl@aon.at Mon Aug 12 15:19:36 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 12 Aug 2002 16:19:36 +0200 Subject: [Tutor] debugging problem References: <94FD5825A793194CBF039E6673E9AFE034D617@bbserver1.backbonesecurity.com> Message-ID: <3D57C3F8.40206@aon.at> Watt III, Glenn schrieb: >ok heres my problem i run the script for the first proram listed call >coll.py it runs into an error that says > "Traceback (most recent call last): > File "\\Bbserver4\test\admin\newdesign\papers\cgi\coll.py", >line 113, in ? > mainAction() > File "\\Bbserver4\test\admin\newdesign\papers\cgi\coll.py", >line 18, in mainAction > email = backbone.reqField("email", "E-mail Address") > AttributeError: 'module' object has no attribute 'reqField'" >however there is an atribute called reqField in the backbone module as >you can see in the second program listed what am i doin wron as usual >thanks for any help > > > Strange case, I'm really curious what's going on. Only a ramark or two: (see bottom of mail) > > coll: >#!/usr/local/bin/python > > >import MySQLdb >import cgi >import sys >import backboner <--- > this certainly is a typo in the mail > > >cgiForm = cgi.FieldStorage() > >err = "" >wrong = 0 > > >def mainAction(): > global backbone > this global statement is superfluous, I think > email = backbone.reqField("email", "E-mail Address") > > > > backbone: >#!/usr/local/bin/python > >err = "" >wrong = 0 > >cgiForm = cgi.FieldStorage() > ># A checker for any required fields input is the name of the cgi >variable response is what the user sees if it gets thrown back > > >def reqField(input, response): > global wrong > global err > if cgiForm.has_key(input): > input = cgiForm[input].value > return input > elif wrong == 1: > err = err + ', ' + response > else: > err = response > wrong = 1 > >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > > > > "Traceback (most recent call last): File "\\Bbserver4\test\admin\newdesign\papers\cgi\coll.py", line 113, in ? mainAction() File "\\Bbserver4\test\admin\newdesign\papers\cgi\coll.py", line 18, in mainAction email = backbone.reqField("email", "E-mail Address") AttributeError: 'module' object has no attribute 'reqField'" however there is an atribute called reqField in the backbone module as you can see in the second program listed what am i doin wron as usual thanks for any help Apparently there are many lines in coll.py left out in this mail - so these could contain some reassignment to backbone: I could simulate your error-message: >>> import backbone >>> backbone >>> import math >>> def ma(): global backbone e = backbone.reqField("","") >>> backbone = math >>> ma() Traceback (most recent call last): File "", line 1, in ? ma() File "", line 3, in ma e = backbone.reqField("","") AttributeError: 'module' object has no attribute 'reqField' >>> backbone >>> So, if you have a look at backbone afte the error-message has occured, maybe you will get a clue .... Gregor Let us know, what turned out to be the cause ... From glingl@aon.at Mon Aug 12 15:27:54 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 12 Aug 2002 16:27:54 +0200 Subject: [Tutor] debugging problem References: <94FD5825A793194CBF039E6673E9AFE034D617@bbserver1.backbonesecurity.com> <3D57C3F8.40206@aon.at> Message-ID: <3D57C5EA.6080506@aon.at> You may get a simpler clue by looking at the attributes of backbone, you may also put a print dir() or two into the code to examine what happens when: >>> import backbone >>> import math >>> dir(backbone) ['__builtins__', '__doc__', '__file__', '__name__', 'cgi', 'cgiForm', 'err', 'reqField', 'wrong'] >>> backbone = math # ore some other weird action >>> dir(backbone) ['__doc__', '__name__', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'cosh', 'e', 'exp', 'fabs', 'floor', 'fmod', 'frexp', 'hypot', 'ldexp', 'log', 'log10', 'modf', 'pi', 'pow', 'sin', 'sinh', 'sqrt', 'tan', 'tanh'] >>> From sarmstrong13@mac.com Mon Aug 12 15:30:24 2002 From: sarmstrong13@mac.com (SA) Date: Mon, 12 Aug 2002 09:30:24 -0500 Subject: [Tutor] new to this In-Reply-To: <3D56A557.5070305@aon.at> Message-ID: On 8/11/02 12:56 PM, "Gregor Lingl" wrote: > "Learning Python in 24 houurs" has also somewhat obfuscated code ;-) > Well I never said it would be easy;) I will say this now. And let me clarify that this is my own opinion. After the first few chapters in "Learning Python in 24 Hours", I had to put it down. It is the worst book I could find on the subject, IMHO. And that is why I switched to O'reily. The explanations on classes alone was enough to make me want to lite "LP24H" on fire. Sorry, my opinion. I felt the book was not written for the novice and did not clearly explain concepts. But I'm glad you got Canvas to work somewhat. Godd Luck. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From gwatt3@backbonesecurity.com Mon Aug 12 15:47:02 2002 From: gwatt3@backbonesecurity.com (Watt III, Glenn) Date: Mon, 12 Aug 2002 10:47:02 -0400 Subject: [Tutor] debugging problem Message-ID: <94FD5825A793194CBF039E6673E9AFE034D618@bbserver1.backbonesecurity.com> ok i did what you suggested and got this as a result >>> import backbone >>> dir(backbone) ['__builtins__', '__doc__', '__file__', '__name__'] so indeed the attribute is not showing up but why all the resources i have show that im doing everything right oh i need to ad import cgi into the backbone file if that threw anyone off sorry=20 -----Original Message----- From: Gregor Lingl [mailto:glingl@aon.at] Sent: Monday, August 12, 2002 10:28 AM To: Gregor Lingl Cc: Watt III, Glenn; tutor@python.org Subject: Re: [Tutor] debugging problem=20 You may get a simpler clue by looking at the attributes of backbone, you may also put a print dir() or two into the code to examine what happens when: >>> import backbone >>> import math >>> dir(backbone) ['__builtins__', '__doc__', '__file__', '__name__', 'cgi', 'cgiForm',=20 'err', 'reqField', 'wrong'] >>> backbone =3D math # ore some other weird action >>> dir(backbone) ['__doc__', '__name__', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos',=20 'cosh', 'e', 'exp', 'fabs', 'floor', 'fmod', 'frexp', 'hypot', 'ldexp',=20 'log', 'log10', 'modf', 'pi', 'pow', 'sin', 'sinh', 'sqrt', 'tan', 'tanh'] >>> From daskalious@softhome.net Mon Aug 12 03:38:24 2002 From: daskalious@softhome.net (Andreas Daskalopoulos) Date: 12 Aug 2002 05:38:24 +0300 Subject: [Tutor] Python + editor Message-ID: Hello all, I am using emacs with python mode for editing my little python scripts on a Linux machine. I think its OK using emacs for python since i use emacs for almost anything i need (mail and news with gnus, HTML and latex) but i was thinking of trying something else too. What are you guys using for editing your python files on Linux? From dyoo@hkn.eecs.berkeley.edu Mon Aug 12 15:55:25 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 12 Aug 2002 07:55:25 -0700 (PDT) Subject: [Tutor] Trouble getting started (fwd) Message-ID: Hi Budman, Let me forward this to the rest of the Tutor list; if any one of us are busy, the others still will have a chance to look at this. My best guess is that your program has the three lines: ### Python 2.2.1 (#1, Jul 29 2002, 23:15:49) [GCC 2.95.4 20011002 (Debian prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. ### in the beginning of your program (or something similar to this). If so, you can safely take them out, as this is just something that Python prints whenever you start it up: it's not actually supposed to be incorporated in your own programs. Good luck to you! ---------- Forwarded message ---------- Date: Mon, 12 Aug 2002 08:25:33 EDT From: Budman4106@aol.com To: dyoo@hkn.eecs.berkeley.edu Subject: Re: [Tutor] Trouble getting started Thank you for your response. I recieved alot of other help from others as well. One guy said that I had put a 1 where there should have been an i so I tried replacing the 1's with i's and it still gives me an error. I dont know what I'm doing but I'm sure having fun trying to figure it out. Thank you for your help.............Kevin Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32 > > Type "copyright", "credits" or "license" for more information. > IDLE 0.8 -- press F1 for help > >>> print "Here are the ten numbers from 0 to 9<---I know what I did wrong > here :) > SyntaxError: invalid token > >>> print "Here are the numbers from 0 to 9" > Here are the numbers from 0 to 9 > >>> for i in range(10): > print i, > > File "C:/Python22/Numbers", line 1 > Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32 > ^ > SyntaxError: invalid syntax > > From kodokuchef@yahoo.com Mon Aug 12 16:02:09 2002 From: kodokuchef@yahoo.com (akira sugiura) Date: Mon, 12 Aug 2002 08:02:09 -0700 (PDT) Subject: [Tutor] (no subject) Message-ID: <20020812150209.29783.qmail@web10306.mail.yahoo.com> Hi, I am completly new to either python or a world of programing. Honestly I am a bit nervous using this service first time. Anyway whilst I've tried to solve this exercise but couldn't get to the answer. Can anyone help? ====================================================== Modify this program to keep track of how many times the user has entered the password wrong. If it is more than 3 times, print ``That must have been complicated.'' password = "foobar" while password != "unicorn": password = raw_input("Password:") print "Welcome in" ======================================================= Thank you very much ===== ----------------------------------- Akira Sugiura kodokuchef@yahoo.com ----------------------------------- __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com From valdas.jonikas@if.lt Mon Aug 12 17:09:33 2002 From: valdas.jonikas@if.lt (Valdas Jonikas) Date: Mon, 12 Aug 2002 17:09:33 +0100 Subject: [Tutor] Python + editor Message-ID: <9CA5BE43F9BD694FB63CC81CF75B0BBA1BE9D6@mariner.sampo.vlan> > What are you guys using for editing your python files on Linux?=20 Vim (and not only on Linux :) Regards, Valdas From dyoo@hkn.eecs.berkeley.edu Mon Aug 12 16:16:23 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 12 Aug 2002 08:16:23 -0700 (PDT) Subject: [Tutor] A chat server in Python In-Reply-To: <200208121055.43896.scot@possum.in-berlin.de> Message-ID: On Mon, 12 Aug 2002, Scot W. Stevenson wrote: > Thank you for the code example! If I could bother you with a few > questions... > > ============================ > from threading import * > ============================ > > The docs for the threading module say that it is safe to do this, but I > remember being told by one of the books (can't find the reference right > now, will dig if important) not to unless you're importing Tkinter. Is > threading another exception, or has "from import *" become less > dangerous in Python 2.2, or was the original warning overdone? Hmmm... I usually avoid using 'from import *', but the 'threading' docs says that the module has been explicitely designed to make 'from threading import *' safe. Until otherwise, I'll believe the docs. *grin* Hmmm! Perhaps it might be good to look into the 'threading' module later on, and see exactly what the module writer has done to make it 'from import *' safe. > ============================ > def _waitForShutdownOrNewMessages(self): > return self._events.get() > ============================ > > Is ease of maintainance the the reason not to put self._events.get() > directly into the "while 1" loop? I made that one-liner into a separate function for maintenance reasons: I wanted to make sure it was clear, to someone reading the program, that self._events.get() can pause for a long time. > ============================ > self._listeners_lock.acquire() > try: > listeners_copy = self._listeners[:] > finally: > self._listeners_lock.release() > for listener in listeners_copy: > self._tryToSendMessageToListener(msg, listener) > ============================ > > I'm not sure I understand the reason for the copy of self._listeners, or > in other words, why this part isn't simply > > --------------------------------------------------- > self._listeners_lock.acquire() > try: > for listener in self._listeners: > self._tryToSendMessageToListener(msg, listener) > finally: > self._listeners_lock.release() > ---------------------------------------------------- > > since if self._listeners() is empty, the for-loop wouldn't run, and I > don't see anything that could change self._listeners. I think I wasn't thinking clearly. *grin* Yes, that should be fixed; your revised loop is simpler and has the same meaning. The comment I embedded in MessageRoom._tryToSendMessageToListener() explains that: ''' ## Fixme: we should somehow a timeout here. If a message ## can't get through within a certain period of time, we ## should assume the listener is just delinquent, and toss ## them out of the listeners list. Very rough, but ## necessary if we don't want to deadlock waiting for any ## particular listener. ''' I was worried about locking out the '_listeners' from further modification, because sending messages might potentially take a long time. Perhaps I should really implement the timeout instead, like the comment says. *grin* Thank you for your feedback! From sarmstrong13@mac.com Mon Aug 12 16:21:27 2002 From: sarmstrong13@mac.com (SA) Date: Mon, 12 Aug 2002 10:21:27 -0500 Subject: [Tutor] Saving session in IDLE In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C813@mbtlipnt02.btlabs.bt.co.uk> Message-ID: On 8/12/02 6:04 AM, "alan.gauld@bt.com" wrote: Could you not rewrite idle to store each typed line into a file. Keeping the file open as you work. Then with a specific command, like exit, you are asked whether or not to save the file? Basically have all of the commands sitting in a que waiting to be dumped to file after you exit? Thanks. SA P.S. One other option would be to take a little Tkinter/Python shell script I wrote and tweak it for your own use, (but I would like to see all the improvements people come up with just to see the evolution of the program): #!/usr/bin/env python from Tkinter import * import os import commands import sys import tkSimpleDialog class PyShell: def clearin(self): self.t1.delete(0.0,END) def clearout(self): self.t2.delete(0.0,END) def expyth(self): self.t2.delete(0.0, END) self.output = commands.getoutput("/sw/bin/python -c '%s'" % self.t1.get(0.0, END).strip()) self.t2.insert(END, self.output) def doSave(self): SaveDialog = Saving(self.f) filename = SaveDialog.getName() self.saveText(filename) del(saveDialog) def __init__(self, top): self.t1 = Text(top, height="12", width="84", font="Courier 12") self.t1.pack(side=TOP, pady=2) self.f = Frame(top) self.f.pack() self.b1 = Button(self.f, text="Execute", command=self.expyth) self.b1.pack(side=LEFT) self.b2 = Button(self.f, text="Clear Input", command=self.clearin) self.b2.pack(side=LEFT) self.b3 = Button(self.f, text="Clear Output", command=self.clearout) self.b3.pack(side=LEFT) self.b4 = Button(self.f, text="Save Input", command=self.doSave) self.b4.pack(side=LEFT) self.t2 = Text(top, height="12", width="84", bg="lightblue", font="Courier 12") self.t2.pack(side=TOP, pady=2) class Saving(tkSimpleDialog.Dialog): def body(self, master): Label(master, text="Directory:").grid(row=0) Label(master, text="Filename:").grid(row=1) self.e1 = Entry(master) self.e2 = Entry(master) self.e1.grid(row=0, column=1) self.e2.grid(row=1, column=1) return self.e1 def apply(self): dir = self.e1.get() fn = self.e2.get() self.name = dir + fn def getName(self): return self.name root = Tk() app = PyShell(root) root.mainloop() -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From glingl@aon.at Mon Aug 12 16:20:07 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 12 Aug 2002 17:20:07 +0200 Subject: [Tutor] Trouble getting started (fwd) References: Message-ID: <3D57D227.5040302@aon.at> > > >>print i, >> >> File "C:/Python22/Numbers", line 1 >> Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32 >> ^ >>SyntaxError: invalid syntax >> >> >> Hi Budman! If you work qith IDLE you have thoroughly to distinguish to different modes of working: 1. Interactive Python Interpreter a) in *Python shell* window b) waiting for your input, prompting >>> c) you type in a single Python-statement d) the interpreter executes it AND gives you the result of the evaluation - if there is any e) continue with b) 2. A completely different thing is writing programs, or scripts: a) Open a "File|New Window" A NEW WINDOW!!! This will be a mere editor window! b) There write your code - a sequance of statements - as many as you like c) Save it with a name with a *.py extension. d) Execute it by using Edit|Run Script IN THE EDITOR-WINDOW, where your code is e) Program output as well as Error-messages will appear in the Python-Shell Window. (THE OTHER ONE) - Study it and dicide on further action - (e. g. coffe-break) f) Return to your code in the EDITOR-WINDOW, correct errors or put in new portions of code .... g) continue with c) While programming from time to time there occurs something, which isn't quite clear. At these moments, turn to the Python-Shell window and try out some test-statements to clarify your questions. If you have learned, what you wnted to know, turn to the EDITOR_WINDOW and incorporate new knoledge into your programs ... ... so have fun! Gregor P.S. File "C:/Python22/Numbers", line 1 Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32 ^ SyntaxError: invalid syntax P.P.S.: If you get this, that means, that you saved the Python-Shell-Window, which doesn't make sense in your situatuin (except, for instance, you want to show the results to someone els in the net, sending her the results viy email) The text in the *Python Shell* window is no program and cannot be run! ---- Whenever you have been fallen in love with Python, so you can't miss it any more, go to www.python.org and download Python 2.2.1 , ---- From sarmstrong13@mac.com Mon Aug 12 16:25:47 2002 From: sarmstrong13@mac.com (SA) Date: Mon, 12 Aug 2002 10:25:47 -0500 Subject: [Tutor] Saving session in IDLE In-Reply-To: Message-ID: On 8/12/02 10:21 AM, "SA" wrote: > On 8/12/02 6:04 AM, "alan.gauld@bt.com" wrote: ^ Oops. Typo. The first line stating what alan wrote should have been deleted. My bad. > Could you not rewrite idle to store each typed line into a file. Keeping the > file open as you work. Then with a specific command, like exit, you are > asked whether or not to save the file? > > Basically have all of the commands sitting in a que waiting to be dumped to > file after you exit? > > Thanks. > SA > > P.S. One other option would be to take a little Tkinter/Python shell script > I wrote and tweak it for your own use, (but I would like to see all the > improvements people come up with just to see the evolution of the program): > > #!/usr/bin/env python > > from Tkinter import * > import os > import commands > import sys > import tkSimpleDialog > > class PyShell: > > def clearin(self): > self.t1.delete(0.0,END) > def clearout(self): > self.t2.delete(0.0,END) > def expyth(self): > self.t2.delete(0.0, END) > self.output = commands.getoutput("/sw/bin/python -c '%s'" % > self.t1.get(0.0, END).strip()) > self.t2.insert(END, self.output) > def doSave(self): > SaveDialog = Saving(self.f) > filename = SaveDialog.getName() > self.saveText(filename) > del(saveDialog) > def __init__(self, top): > self.t1 = Text(top, height="12", width="84", font="Courier 12") > self.t1.pack(side=TOP, pady=2) > self.f = Frame(top) > self.f.pack() > self.b1 = Button(self.f, text="Execute", command=self.expyth) > self.b1.pack(side=LEFT) > self.b2 = Button(self.f, text="Clear Input", command=self.clearin) > self.b2.pack(side=LEFT) > self.b3 = Button(self.f, text="Clear Output", command=self.clearout) > self.b3.pack(side=LEFT) > self.b4 = Button(self.f, text="Save Input", command=self.doSave) > self.b4.pack(side=LEFT) > self.t2 = Text(top, height="12", width="84", bg="lightblue", > font="Courier 12") > self.t2.pack(side=TOP, pady=2) > > class Saving(tkSimpleDialog.Dialog): > > def body(self, master): > Label(master, text="Directory:").grid(row=0) > Label(master, text="Filename:").grid(row=1) > self.e1 = Entry(master) > self.e2 = Entry(master) > self.e1.grid(row=0, column=1) > self.e2.grid(row=1, column=1) > return self.e1 > def apply(self): > dir = self.e1.get() > fn = self.e2.get() > self.name = dir + fn > def getName(self): > return self.name > > > root = Tk() > app = PyShell(root) > root.mainloop() > > From glingl@aon.at Mon Aug 12 16:27:56 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 12 Aug 2002 17:27:56 +0200 Subject: [Tutor] Trouble getting started (fwd) References: <3D57D227.5040302@aon.at> Message-ID: <3D57D3FC.9070006@aon.at> Gregor Lingl schrieb: >> ... >> While programming from time to time there occurs something, which >> isn't quite clear. >> At these moments, turn to the Python-Shell window and try out some >> test-statements >> to clarify your questions. If you have learned, what you wnted to >> know, turn to the >> EDITOR_WINDOW and incorporate new knoledge into your programs ... >> >> ... so have fun! >> >> Gregor >> >> P.S. >> >> File "C:/Python22/Numbers", line 1 >> Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32 >> ^ >> SyntaxError: invalid syntax >> >> P.P.S.: If you get this, that means, that you saved the >> Python-Shell-Window, which doesn't make sense in >> your situatuin (except, for instance, you want to show the results to >> someone els in the net, sending >> her the results viy email) >> Excuse the awful lot of topys Gregor From bwinton@latte.ca Mon Aug 12 16:27:39 2002 From: bwinton@latte.ca (Blake Winton) Date: Mon, 12 Aug 2002 11:27:39 -0400 Subject: [Tutor] design ideas? In-Reply-To: <20020812222452.5c72dcad.thomi@thomi.imail.net.nz> References: <20020812222452.5c72dcad.thomi@thomi.imail.net.nz> Message-ID: <20020812152739.GA22501@latte.ca> * Thomi Richards [020812 06:26]: > there are several problems with this, the first is, this > program needs to be able to run at top speeds of 50 cycles a > second. it will have over 65'000 things to calculate each turn, > and the speed will obviously depend on the users computer, but > what kind of things can i do to speed up the python program?? The best advice you'll get is "Do nothing to speed it up". Seriously. First, write it so that it works. Then, if it's actually too slow, run a profiler on it to see where it's spending all of its time, and selectively optimize that part of it. If it's still too slow after all of that, you can look into using different algorithms for various parts of it (but _only_ the parts that are too slow!). After all of that, if it's still too slow, you can rewrite parts of it in C. But please, don't even start thinking about the second step until after the first step is completed. I work with someone who tries to optimize everything, as he's writing it, and it's really annoying, since it takes him several times as long as it should to get any single task done, and when it finally is done, we can't notice the difference in performance anyways. ("Great, so it takes 0.001 seconds to do this instead of 0.002. Whoopee. I'm glad you spent that extra week getting it so fast. Now can you fix this bug?") Later, Blake. -- 11:22am up 7 days, 19:09, 1 user, load average: 0.00, 0.00, 0.00 From bwinton@latte.ca Mon Aug 12 16:30:12 2002 From: bwinton@latte.ca (Blake Winton) Date: Mon, 12 Aug 2002 11:30:12 -0400 Subject: [Tutor] reverse a number (was no subject) In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C811@mbtlipnt02.btlabs.bt.co.uk> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C811@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <20020812153012.GB22501@latte.ca> * alan.gauld@bt.com [020812 06:35]: > > To do this without using a string I had to loop through > > the number twice. The first time to see how many digits, > > the second to actually compute the number. > length = len(str(number)) # beware of '.' in floats tho'! len(str(int(number))) #? Later, Blake. -- 11:29am up 7 days, 19:16, 1 user, load average: 0.00, 0.00, 0.00 From sarmstrong13@mac.com Mon Aug 12 16:37:11 2002 From: sarmstrong13@mac.com (SA) Date: Mon, 12 Aug 2002 10:37:11 -0500 Subject: [Tutor] Simple Flat DBs... Message-ID: Hi Everyone- I want to write a simple flat database. I thought of using dictionaries within dictionaries to store the data with simple relationships. For example: I would have the main dictionary use a key that would separate the data and inside that would be dictionaries that used keys for column headings. If that makes any sense. Basically, If you looked at a spreadsheet, you would have many columns labeled. The first column would contain the ID number for each row. So the main dictionary key would be the ID number, and the internal dictionary keys would be column headings for each data item. Does that make sense? Anyways. My question would be whether or not this is doable? If so, would pickle be a good option for packing and unpacking the data? Or whould shelve work better? One last question. I want to write a cgi/html front end for this. What would be a good way to secure this with a password? Maybe password protect the generated html page? Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From marcolinux@linuxbr.com.br Mon Aug 12 16:36:22 2002 From: marcolinux@linuxbr.com.br (Marc) Date: Mon, 12 Aug 2002 12:36:22 -0300 Subject: [Tutor] Python + editor In-Reply-To: References: Message-ID: <20020812153622.GA4692@marcolab.proconet> Andreas Daskalopoulos (daskalious@softhome.net) wrote: > What are you guys using for editing your python files on Linux? Still use vim (syntax colors very beautiful!)but recently converted to nedit ( http://www.nedit.org ): Here is some things I like. Certainly this is possible with others editors too, but nedit make it so easy for laz^H^H^Hbusy people like me that I cant live without it. Syntax colors almost as beautiful as vim; Easy keyboard AND mouse navigation; Ctrl+C,ctrl+V :-); Show line numbers; Show matching (), {},[]; Block selection (ctrl+mouse selection). Useful for moving functions around without the indentation; Grab shell output (alt-x -> date: Seg Ago 12 12:12:58 BRT 2002); Can redefine the print command: Install a2ps and gv; Edit .Xdefaults: nedit.printCommand: a2ps -4 -Pdisplay ; Voila: Can print up to four (-4) pages in one side of sheet!; (great for reading Danny's code on a bus. Yup,I don't have a zaurus yet.:) Of course this is all a matter of personal taste. Just sharing mine here. Hope you don't mind. See ya. .:: MarcoLinux ::. -- There are 10 kinds of people in the world: Those who understand binary, and those who don't. - Slashdot From fleet@teachout.org Mon Aug 12 16:49:25 2002 From: fleet@teachout.org (fleet@teachout.org) Date: Mon, 12 Aug 2002 11:49:25 -0400 (EDT) Subject: [Tutor] Parse Problem [2] Message-ID: Ok, I'll try to be less verbose. Given the strings 'xxxxx: xxxxx "xxx xxx"' and 'xxxxx: xxxxx "xxxxxxx"' If I use xx=split.string(string," ") I get xx[2] as "xxx in the first instance and "xxxxxxx" in the second. I need to get "xxx xxx". Ie, I need to get everything within the quotes as xx[2]. Please? - fleet - From lists@shrestha.net.np Mon Aug 12 16:55:43 2002 From: lists@shrestha.net.np (Ashish Shrestha) Date: Mon, 12 Aug 2002 21:40:43 +0545 Subject: [Tutor] Python + editor References: <20020812153622.GA4692@marcolab.proconet> Message-ID: <3D57DA7F.9090802@shrestha.net.np> I use vim 6.0 [http://www.vim.org] and jEdit [http://www.jedit.org] Both has folding and I don't think I could do without folding anymore! Ashish From dyoo@hkn.eecs.berkeley.edu Mon Aug 12 17:39:10 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 12 Aug 2002 09:39:10 -0700 (PDT) Subject: [Tutor] Parse Problem [2] In-Reply-To: Message-ID: On Mon, 12 Aug 2002 fleet@teachout.org wrote: > Ok, I'll try to be less verbose. > > Given the strings 'xxxxx: xxxxx "xxx xxx"' and 'xxxxx: xxxxx "xxxxxxx"' > If I use xx=split.string(string," ") I get xx[2] as "xxx in the first > instance and "xxxxxxx" in the second. I need to get "xxx xxx". Ie, I > need to get everything within the quotes as xx[2]. Hi fleet, Ah, so a simple string split doesn't work because it doesn't know what it means to "quote" something. You may want to use the CSV module for your program: http://www.object-craft.com.au/projects/csv/ It's supposed to handle quotes, and you can set the splitting character to tab by doing something like this: ### p = csv.parser(field_sep='\t') ### Good luck! From dyoo@hkn.eecs.berkeley.edu Mon Aug 12 17:47:12 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 12 Aug 2002 09:47:12 -0700 (PDT) Subject: [Tutor] Generating sigs with Python for fun and education In-Reply-To: <200208121254.44192.scot@possum.in-berlin.de> Message-ID: On Mon, 12 Aug 2002, Scot W. Stevenson wrote: > # Center lines and print them > for line in lines: > if len(line) > max_line_length: > print 'Line too long (> %s characters):' % max_line_length > print line > break > > bufferspaces = int((max_line_length-len(line))/2) > print ' ' * bufferspaces + line Strings have a method for center()ing, so those last two lines code can be simplified to: ### print line.center(max_line_length) ### Hope this helps! From dyoo@hkn.eecs.berkeley.edu Mon Aug 12 17:56:55 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 12 Aug 2002 09:56:55 -0700 (PDT) Subject: [Tutor] (no subject) In-Reply-To: <20020812150209.29783.qmail@web10306.mail.yahoo.com> Message-ID: On Mon, 12 Aug 2002, akira sugiura wrote: > I am completly new to either python or a world of programing. Honestly I > am a bit nervous using this service first time. Anyway whilst I've tried > to solve this exercise but couldn't get to the answer. Can anyone help? Hi Akira, Welcome aboard! Just wondering: what book or web site are you using? > ====================================================== > Modify this program to keep track of how many times > the user has entered the password wrong. If it is more > than 3 times, print ``That must have been > complicated.'' > > password = "foobar" > > while password != "unicorn": > password = raw_input("Password:") > print "Welcome in" > ======================================================= You may want to try to simplify the problem. How about modifying your program to print how many times the user has tried to guess? We can imagine working with it like: ### You've guessed 0 times. Password: foobar You've guessed 1 times. Password: marshmellow You've guessed 2 times. Password: mellon You've guessed 3 times. Password: xyzzy You've guessed 4 times. Password: unicorn ### If we remove that '3 times' restriction, that may be easier write, and you'll get a better feel for loops. The problem with the original question is that it's asking for two things --- loops and conditionals --- and dealing with both at the same time can be intimidating at first. Instead, let's take things one at a time. Please feel free to ask more questions, and if you see stuff on Tutor that's confusing, please tell us that we're just not making sense. *grin* Also, when you reply to a message here, make sure to send to 'tutor@python.org', so that all of us here can help you. Good luck to you! From alan.gauld@bt.com Mon Aug 12 17:51:24 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 12 Aug 2002 17:51:24 +0100 Subject: [Tutor] RE: when to use OOP Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C816@mbtlipnt02.btlabs.bt.co.uk> > Bruce Tate has written a book called > "Bitter Java" that talks about hideously bad OOP designs Hmm, a book about bad OOP design written in Java, how very appropriate! :-) Alan g From alan.gauld@bt.com Mon Aug 12 18:05:37 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 12 Aug 2002 18:05:37 +0100 Subject: [Tutor] new to this Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C817@mbtlipnt02.btlabs.bt.co.uk> > Python books, Learn to Program Using Python Good choice ;-) > my own programs involving AI, fractals, and what have you. AI can certainly be done although some advanced techniques are easier in languages like Prolog. However the basic principles you learn in Python are usable in any other language. Fractals are possible but don't expect blistering speed (unless you have a 2GHz P4 CPU and fast graphics card in which case they'll be fine!) But for experimentation Python is OK, and Ivan Laningham's book gives an example program - you can get the code from his web site... I can't find the URL on Google - anyone with the book got it? > have lots of annoying questions soon, That's what we are here for... Alan Gauld Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From kent@springfed.com Mon Aug 12 18:16:49 2002 From: kent@springfed.com (kent@springfed.com) Date: Mon, 12 Aug 2002 12:16:49 -0500 Subject: [Tutor] How to run startup.py? Message-ID: <20020812171744.D884A12E77@bucky.airstreamcomm.net> Howdy, I'm using ActiveState Python 2.2.1 How do I run a startup file?, setting the environmental variable PYTHONSTARTUP doesn't do it. TIA, Kent From alan.gauld@bt.com Mon Aug 12 18:12:54 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 12 Aug 2002 18:12:54 +0100 Subject: [Tutor] a query Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C818@mbtlipnt02.btlabs.bt.co.uk> > def A(): > ----def B(): > > def C(): > ----# how can i call B() from here. > > is it possible in python? Not unless A returns B as a value. Python correctly implements B within A's namespace so you can only call B within A. If B was supposed to be accessible outside A it should have been declared there - and if not there's probably a good reason for not declaring it externally - subtle side-effects for example. (Otherwise somebody was just being stupid and should have declared it globally...!) In general Python does the "right thing", then provides a way to do the wrong thing if you really really must... like accessing the underlying dictionaries etc... Alan g. From alan.gauld@bt.com Mon Aug 12 18:24:25 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 12 Aug 2002 18:24:25 +0100 Subject: [Tutor] (no subject) Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C819@mbtlipnt02.btlabs.bt.co.uk> > I am completly new to either python or a world of > programing. Honestly I am a bit nervous using this > service first time. That's OK we are here to help... Now lets break down your question: > ====================================================== > Modify this program to keep track of how many times > the user has entered the password wrong. The first bit just wants you to count the number of wrong guesses. So we need some kind of variable (lets call it counter?) We need to set counter to zero to start with. Each time round the loop add one to counter. At the end of the loop print out the value of counter. Why not try that bit first. We can come back to the second part below after you get this working. Even if you don;t get it working completely post your attempt here so we can see how you are approaching it. That often helps uys explain the issues better. We won't laugh, I promise! :-) Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Mon Aug 12 18:28:51 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 12 Aug 2002 18:28:51 +0100 Subject: [Tutor] Trouble getting started (fwd) Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C81A@mbtlipnt02.btlabs.bt.co.uk> > From: Gregor Lingl [mailto:glingl@aon.at] > If you work qith IDLE you have thoroughly to distinguish to different > modes of working: > 1. Interactive Python Interpreter > 2. A completely different thing is writing programs, or scripts: > a) Open a "File|New Window" A NEW WINDOW!!! This is very true and a common cause for confusion. I've had two mails from students of my tutor in the past week falling over this very issue. They tried to save/execute the shell window. The problem is that IDLE allows you to do this, then reports an error on the banner message! It would be much more sensible if the Python Shell window greyed out the RUN menu option... That way beginners wouldn't try to run the shell. Of course they can still save/open it and have the same pronblem - ideally the shell window should have a save session option instead of the usual save as...(see my previous post). But I am certainly seeing lots of beginners trying to save the shell window and then run it! Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From shey@argonaut.com Mon Aug 12 18:34:49 2002 From: shey@argonaut.com (shey crompton) Date: Mon, 12 Aug 2002 18:34:49 +0100 Subject: [Tutor] Python + editor Message-ID: <415C917D807AD411B72C00805FF7330B0383636C@MAILSRV> Would these be recommended over and above the IDLE? Had a look on the vim website, the editor looks cool. Does it recognise when Python is the code being entered? -----Original Message----- From: Ashish Shrestha [mailto:lists@shrestha.net.np] Sent: 12 August 2002 16:56 To: tutor@python.org Subject: Re: [Tutor] Python + editor I use vim 6.0 [http://www.vim.org] and jEdit [http://www.jedit.org] Both has folding and I don't think I could do without folding anymore! Ashish _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From alan.gauld@bt.com Mon Aug 12 18:33:03 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 12 Aug 2002 18:33:03 +0100 Subject: [Tutor] Parse Problem [2] Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C81B@mbtlipnt02.btlabs.bt.co.uk> > Given the strings 'xxxxx: xxxxx "xxx xxx"' and 'xxxxx: xxxxx > need to get everything within the quotes as xx[2]. A quick guess - why not split on the quotes: string.split(str, '"') ?? Would that help? Alan g From Doug.Shawhan@gecits.ge.com Mon Aug 12 18:48:44 2002 From: Doug.Shawhan@gecits.ge.com (Doug.Shawhan@gecits.ge.com) Date: Mon, 12 Aug 2002 13:48:44 -0400 Subject: [Tutor] two lists to keys and values in dictionary Message-ID: <47B6167F8E69D31194BA0008C7918D4205C54D5F@msxcvg02itscge.gecits.ge.com> Okay, I have two lists: l1=['wicky', 'wacky', 'woo'] l2=['hip', 'hop', 'hoo'] and a dictionary d={} I want to create entries in the dictionary with the contents of l1 as keys and l2 as values. I can do it this way: >>> count = 0 >>> for each in l1: d[each]= l2[count] count = count + 1 >>> d {'woo': 'hoo', 'wacky': 'hop', 'wicky': 'hip'} Since both lists have equal values, is there a way to combine both additions to the dictionary in the same loop without the kludgey counter? Something along the lines of: for k, v in l1, l2: d[k]=v It seems I have seen something similar done, but since I dont' have my books today and lunch is short.... :-) Thanks! From gwatt3@backbonesecurity.com Mon Aug 12 18:48:59 2002 From: gwatt3@backbonesecurity.com (Watt III, Glenn) Date: Mon, 12 Aug 2002 13:48:59 -0400 Subject: [Tutor] solved kinda Message-ID: <94FD5825A793194CBF039E6673E9AFE034D61C@bbserver1.backbonesecurity.com> ok i posted not to long ago a dubuging problem i was having where i could not call attributes of a module in another script. i finally worked it out but my results are kind of weird. i found that no "regular" variables could be assigned in the module only functions could be used. other wise the functions would dissappear as attributes leaving only the regular variables. is there some way to have both i tried assigning the functions to regular varibles however the funtions themselves require attributes and therefore when importing it thows and error. once again any help would be greatly apprectiated thanks =09 -Glenn From dyoo@hkn.eecs.berkeley.edu Mon Aug 12 19:05:47 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 12 Aug 2002 11:05:47 -0700 (PDT) Subject: [Tutor] Parse Problem [2] (fwd) Message-ID: Hi fleet, I'm forwarding your message to the Tutor mailing list, because it gives other people the opportunity to offer more suggestions. I'll play around with 'csv' a little bit and see if it can use multiple delimiters --- perhaps there's a "whitespace" setting that will work for all kinds of whitespace, so that we won't have to introduce tabs into the program input. ---------- Forwarded message ---------- Date: Mon, 12 Aug 2002 13:34:41 -0400 (EDT) From: fleet@teachout.org To: Danny Yoo Subject: Re: [Tutor] Parse Problem [2] Hmmm. The file I'm parsing is output from another program (procmail log) - so I don't have the option of formatting the output to include tabs or commas or whatever. It just struck me that I may be better off just slicing the string and removing the pieces I don't want. My bash "shell" command to provide this function is: grep 'Matched "' log | cut -d" " -f3 | sed 's/\"//g' and I think slice would accomplish the task in roughly the same way. Thanks, for the response! - fleet - PS: In case you don't recall the original post, the string in the log looks like: procmail: Matched "Flicks Softwares" and similar. On Mon, 12 Aug 2002, Danny Yoo wrote: > > > On Mon, 12 Aug 2002 fleet@teachout.org wrote: > > > Ok, I'll try to be less verbose. > > > > Given the strings 'xxxxx: xxxxx "xxx xxx"' and 'xxxxx: xxxxx "xxxxxxx"' > > If I use xx=split.string(string," ") I get xx[2] as "xxx in the first > > instance and "xxxxxxx" in the second. I need to get "xxx xxx". Ie, I > > need to get everything within the quotes as xx[2]. > > Hi fleet, > > Ah, so a simple string split doesn't work because it doesn't know what it > means to "quote" something. > > You may want to use the CSV module for your program: > > http://www.object-craft.com.au/projects/csv/ > > It's supposed to handle quotes, and you can set the splitting character to > tab by doing something like this: > > ### > p = csv.parser(field_sep='\t') > ### > > > Good luck! > From glingl@aon.at Mon Aug 12 19:10:16 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 12 Aug 2002 20:10:16 +0200 Subject: [Tutor] new to this References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C817@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <3D57FA08.3080705@aon.at> alan.gauld@bt.com schrieb: >But for experimentation Python is OK, and Ivan >Laningham's book gives an example program >- you can get the code from his web site... >I can't find the URL on Google - anyone with >the book got it? > > http://www.pauahtun.org/TYPython/ has a link to "Download All the Programs" The same for the German edition with German Text-Strings and Comments - but the original English identifiers is here: ftp://ftp.mut.de/public/python/JLI/ Regards, Gregor From glingl@aon.at Mon Aug 12 19:20:02 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 12 Aug 2002 20:20:02 +0200 Subject: [Tutor] two lists to keys and values in dictionary References: <47B6167F8E69D31194BA0008C7918D4205C54D5F@msxcvg02itscge.gecits.ge.com> Message-ID: <3D57FC52.3010704@aon.at> Doug.Shawhan@gecits.ge.com schrieb: >Okay, I have two lists: > >l1=['wicky', 'wacky', 'woo'] >l2=['hip', 'hop', 'hoo'] > > > >>> l1=['wicky', 'wacky', 'woo'] >>> l2=['hip', 'hop', 'hoo'] >>> zip(l1,l2) [('wicky', 'hip'), ('wacky', 'hop'), ('woo', 'hoo')] >>> pairs = zip(l1,l2) >>> key,value = pairs[0] >>> key,value ('wicky', 'hip') >>> d={} >>> d[key]=value >>> d {'wicky': 'hip'} >>> d={} >>> for key,value in pairs: d[key]=value >>> d {'woo': 'hoo', 'wacky': 'hop', 'wicky': 'hip'} Or shortly: >>> d={} >>> for key,value in zip(l1,l2): d[key]=value >>> d {'woo': 'hoo', 'wacky': 'hop', 'wicky': 'hip'} >>> hth, gl From sarmstrong13@mac.com Mon Aug 12 19:22:19 2002 From: sarmstrong13@mac.com (SA) Date: Mon, 12 Aug 2002 13:22:19 -0500 Subject: [Tutor] two lists to keys and values in dictionary In-Reply-To: <47B6167F8E69D31194BA0008C7918D4205C54D5F@msxcvg02itscge.gecits.ge.com> Message-ID: On 8/12/02 12:48 PM, "Doug.Shawhan@gecits.ge.com" wrote: > Okay, I have two lists: > > l1=['wicky', 'wacky', 'woo'] > l2=['hip', 'hop', 'hoo'] > > and a dictionary > > d={} > > I want to create entries in the dictionary with the contents of l1 as keys > and l2 as values. I can do it this way: > >>>> count = 0 >>>> for each in l1: > d[each]= l2[count] > count = count + 1 > > >>>> d > {'woo': 'hoo', 'wacky': 'hop', 'wicky': 'hip'} > > Since both lists have equal values, is there a way to combine both additions > to the dictionary in the same loop without the kludgey counter? > > Something along the lines of: > > for k, v in l1, l2: > d[k]=v > > It seems I have seen something similar done, but since I dont' have my books > today and lunch is short.... :-) > Here is another bit of a cludgeon: >>> d={} >>> for k in l1: ... for v in l2: ... d[k]=v ... >>> print d {'woo': 'hoo', 'wacky': 'hoo', 'wicky': 'hoo'} Hope this helps. (one good turn deserves another;)) SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From sarmstrong13@mac.com Mon Aug 12 19:28:42 2002 From: sarmstrong13@mac.com (SA) Date: Mon, 12 Aug 2002 13:28:42 -0500 Subject: [Tutor] two lists to keys and values in dictionary In-Reply-To: Message-ID: On 8/12/02 1:22 PM, "SA" wrote: >> > Here is another bit of a cludgeon: > >>>> d={} >>>> for k in l1: > ... for v in l2: > ... d[k]=v > ... >>>> print d > {'woo': 'hoo', 'wacky': 'hoo', 'wicky': 'hoo'} > > > My bad. I just noticed that the output did not iterate properly over l2. Sorry. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From sarmstrong13@mac.com Mon Aug 12 19:31:00 2002 From: sarmstrong13@mac.com (SA) Date: Mon, 12 Aug 2002 13:31:00 -0500 Subject: [Tutor] two lists to keys and values in dictionary In-Reply-To: <3D57FC52.3010704@aon.at> Message-ID: On 8/12/02 1:20 PM, "Gregor Lingl" wrote: >>>> l1=['wicky', 'wacky', 'woo'] >>>> l2=['hip', 'hop', 'hoo'] >>>> zip(l1,l2) > [('wicky', 'hip'), ('wacky', 'hop'), ('woo', 'hoo')] >>>> pairs = zip(l1,l2) >>>> key,value = pairs[0] >>>> key,value > ('wicky', 'hip') >>>> d={} >>>> d[key]=value >>>> d > {'wicky': 'hip'} >>>> d={} >>>> for key,value in pairs: > d[key]=value > > >>>> d > {'woo': 'hoo', 'wacky': 'hop', 'wicky': 'hip'} > > > Or shortly: > >>>> d={} >>>> for key,value in zip(l1,l2): > d[key]=value > > >>>> d > {'woo': 'hoo', 'wacky': 'hop', 'wicky': 'hip'} >>>> Excellent! Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From mnavarre@anteon.com Mon Aug 12 19:35:22 2002 From: mnavarre@anteon.com (Matthew Navarre) Date: Mon, 12 Aug 2002 11:35:22 -0700 Subject: [Tutor] Python + editor In-Reply-To: <20020812153622.GA4692@marcolab.proconet> References: <20020812153622.GA4692@marcolab.proconet> Message-ID: <200208121135.22214.mnavarre@anteon.com> On Monday 12 August 2002 08:36 am, Marc wrote: > Andreas Daskalopoulos (daskalious@softhome.net) wrote: > > What are you guys using for editing your python files on Linux? > > Still use vim (syntax colors very beautiful!)but recently converted to > nedit ( http://www.nedit.org ): > There's a pretty nice vim script that puts a python menu in the menubar a= t: http://vim.sourceforge.net/script.php?script_id=3D30 lets you select blocks, indent, dedent and comment out blocks and has a m= enu=20 with all classes and functions in your script. > Here is some things I like. Certainly this is possible with others edit= ors > too, but nedit make it so easy for laz^H^H^Hbusy people like me that I = cant > live without it. > > Syntax colors almost as beautiful as vim; > Easy keyboard AND mouse navigation; > Ctrl+C,ctrl+V :-); Vim ain't that hard... > Show line numbers; :set nu > Show matching (), {},[]; :set showmatch (works with any vi) > Block selection (ctrl+mouse selection). > Useful for moving functions around without the indentation; The python script has a ]v shortcut to select a block. There's also Visua= l=20 mode in Vim which allows you to do things like :36 #move to line 36 V #visual block mode 10j #select 10 lines YY #yank the selection :75 #move to line 75 p #paste the selection > Grab shell output (alt-x -> date: Seg Ago 12 12:12:58 BRT 2002); :r !date > Can redefine the print command: > Install a2ps and gv; > Edit .Xdefaults: nedit.printCommand: a2ps -4 -Pdisplay ; > Voila: Can print up to four (-4) pages in one side of sheet!; > (great for reading Danny's code on a bus. Yup,I don't have a za= urus > yet.:) > I'm sure you can do this in vim, I'm just not sure how. > Of course this is all a matter of personal taste. > Just sharing mine here. Hope you don't mind. Yep, it really boils down to the fact that any decent programmers editor=20 should work for python. You like nedit, i like vi, some people like IDLEs= =20 editor. Heck, some people even like emacs. Just depends on what you need = and=20 are used to, I guess. --=20 mnavarre@anteon.com Matthew Navarre It was a hard sell, since he's a database person, and as far as I've seen= , once those database worms eat into your brain, it's hard to ever get anything practical done again. To a database person, every nail looks like a thumb. Or something like that. - jwz From Doug.Shawhan@gecits.ge.com Mon Aug 12 19:56:09 2002 From: Doug.Shawhan@gecits.ge.com (Doug.Shawhan@gecits.ge.com) Date: Mon, 12 Aug 2002 14:56:09 -0400 Subject: Subject: Re: [Tutor] two lists to keys and values in dictionary Message-ID: <47B6167F8E69D31194BA0008C7918D4205C54D68@msxcvg02itscge.gecits.ge.com> I have never seen zip before! Guess it's time to rearead my copy of "Python Standard Library". Any other sorting tips like this one? :-) d ------------------------------- Quoth Gregor: >>> zip(l1,l2) [('wicky', 'hip'), ('wacky', 'hop'), ('woo', 'hoo')] >>> pairs = zip(l1,l2) >>> key,value = pairs[0] >>> key,value ('wicky', 'hip') >>> d={} >>> d[key]=value >>> d {'wicky': 'hip'} >>> d={} >>> for key,value in pairs: d[key]=value >>> d {'woo': 'hoo', 'wacky': 'hop', 'wicky': 'hip'} Or shortly: >>> d={} >>> for key,value in zip(l1,l2): d[key]=value >>> d {'woo': 'hoo', 'wacky': 'hop', 'wicky': 'hip'} >>> hth, gl --__--__-- Message: 18 Date: Mon, 12 Aug 2002 13:22:19 -0500 Subject: Re: [Tutor] two lists to keys and values in dictionary From: SA To: , On 8/12/02 12:48 PM, "Doug.Shawhan@gecits.ge.com" wrote: > Okay, I have two lists: > > l1=['wicky', 'wacky', 'woo'] > l2=['hip', 'hop', 'hoo'] > > and a dictionary > > d={} > > I want to create entries in the dictionary with the contents of l1 as keys > and l2 as values. I can do it this way: > >>>> count = 0 >>>> for each in l1: > d[each]= l2[count] > count = count + 1 > > >>>> d > {'woo': 'hoo', 'wacky': 'hop', 'wicky': 'hip'} > > Since both lists have equal values, is there a way to combine both additions > to the dictionary in the same loop without the kludgey counter? > > Something along the lines of: > > for k, v in l1, l2: > d[k]=v > > It seems I have seen something similar done, but since I dont' have my books > today and lunch is short.... :-) > Here is another bit of a cludgeon: >>> d={} >>> for k in l1: ... for v in l2: ... d[k]=v ... >>> print d {'woo': 'hoo', 'wacky': 'hoo', 'wicky': 'hoo'} Hope this helps. (one good turn deserves another;)) SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me --__--__-- Message: 19 Date: Mon, 12 Aug 2002 13:28:42 -0500 Subject: Re: [Tutor] two lists to keys and values in dictionary From: SA To: SA , , On 8/12/02 1:22 PM, "SA" wrote: >> > Here is another bit of a cludgeon: > >>>> d={} >>>> for k in l1: > ... for v in l2: > ... d[k]=v > ... >>>> print d > {'woo': 'hoo', 'wacky': 'hoo', 'wicky': 'hoo'} > > > My bad. I just noticed that the output did not iterate properly over l2. Sorry. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me --__--__-- _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor End of Tutor Digest From dyoo@hkn.eecs.berkeley.edu Mon Aug 12 20:06:28 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 12 Aug 2002 12:06:28 -0700 (PDT) Subject: Subject: Re: [Tutor] two lists to keys and values in dictionary [using range()] In-Reply-To: <47B6167F8E69D31194BA0008C7918D4205C54D68@msxcvg02itscge.gecits.ge.com> Message-ID: > > I want to create entries in the dictionary with the contents of l1 as keys > > and l2 as values. I can do it this way: > > > >>>> count = 0 > >>>> for each in l1: > > d[each]= l2[count] > > count = count + 1 By the way, we can write this more cleanly by using a common index into l1 and l2 when we fill in our dictionary: ### for index in range(len(l1)): d[l1[index]] = l2[index] ### By using range(), we allow Python to handle the details of the indexing variable. The range() function is very useful when we want to iterate over a list of sequential numbers. Hope this helps! From Doug.Shawhan@gecits.ge.com Mon Aug 12 20:11:53 2002 From: Doug.Shawhan@gecits.ge.com (Doug.Shawhan@gecits.ge.com) Date: Mon, 12 Aug 2002 15:11:53 -0400 Subject: Subject: Re: [Tutor] two lists to keys and values in dictiona ry [using range()] Message-ID: <47B6167F8E69D31194BA0008C7918D4205C54D69@msxcvg02itscge.gecits.ge.com> _That's_ what I was trying to remember! I was just introduced to zip() as well. Wow! There really is more than one way to... Uhhh... d -----Original Message----- From: Danny Yoo [mailto:dyoo@hkn.eecs.berkeley.edu] Sent: Monday, August 12, 2002 2:06 PM To: Shawhan, Doug (CAP, ITS, US) Cc: tutor@python.org Subject: Re: Subject: Re: [Tutor] two lists to keys and values in dictionary [using range()] > > I want to create entries in the dictionary with the contents of l1 as keys > > and l2 as values. I can do it this way: > > > >>>> count = 0 > >>>> for each in l1: > > d[each]= l2[count] > > count = count + 1 By the way, we can write this more cleanly by using a common index into l1 and l2 when we fill in our dictionary: ### for index in range(len(l1)): d[l1[index]] = l2[index] ### By using range(), we allow Python to handle the details of the indexing variable. The range() function is very useful when we want to iterate over a list of sequential numbers. Hope this helps! From kb@mm.st Mon Aug 12 20:13:27 2002 From: kb@mm.st (Kyle Babich) Date: Mon, 12 Aug 2002 19:13:27 UT Subject: [Tutor] loop question Message-ID: <20020812191327.D165D937E3@server2.fastmail.fm> Is there any way I could get a for loop to remember what it did in the previous action of the loop? (I don't need to know this for a program or anything, I'm just asking.) For example I put all of the characters from the "Black holes are where God divided by zero" saying into a dictionary, but split the characters like ... "char1char3char5" ... "char2char4char6" and I am trying to make a for loop print them back out so it forms the sentence. The thing is the for loop won't remember the i =3D i + 1 from it's previous action. #################### sigs=3D{"sig11":"bakoeaeweeodvddyeo","sig12":"lchlsrhrgdiiebzr"} i =3D 0 for i in sigs: i =3D int(i) print sigs["sig11"][i] + sigs["sig12"][i] i =3D i + 1 #################### I know the problem is my loop and the i, I just don't know why it is a problem or how to fix it. Thank you, -- Kyle From glingl@aon.at Mon Aug 12 20:40:26 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 12 Aug 2002 21:40:26 +0200 Subject: [Tutor] loop question References: <20020812191327.D165D937E3@server2.fastmail.fm> Message-ID: <3D580F29.2000607@aon.at> Kyle Babich schrieb: >#################### >sigs={"sig11":"bakoeaeweeodvddyeo","sig12":"lchlsrhrgdiiebzr"} >i = 0 >for i in sigs: > i = int(i) > print sigs["sig11"][i] + sigs["sig12"][i] > i = i + 1 >#################### > >I know the problem is my loop and the i, I just don't know why it is a >problem or how to fix it. > >Thank you, >-- >Kyle > > We could try this: >>> sig1, sig2 = "bakoeaeweeodvddyeo","lchlsrhrgdiiebzr" >>> ''.join(map(''.join, zip(sig1,sig2))) 'blackholesarehwregedoidivedbdzyr' Oh! Something went wrong, and we don't know what it is ... You may hav a look at http://www.python.org/doc/current/lib/built-in-funcs.html for zip and at http://www.python.org/doc/current/lib/string-methods.html for join Sorry, that I haven't got the time to explain this at the moment, I'm already too much distracted from my work. Have fun! Gregor From aicolburn@yahoo.com Mon Aug 12 20:42:52 2002 From: aicolburn@yahoo.com (Alan Colburn) Date: Mon, 12 Aug 2002 12:42:52 -0700 (PDT) Subject: [Tutor] Understanding the OOP Worldview Message-ID: <20020812194252.73059.qmail@web20503.mail.yahoo.com> I recently posted a question about assigning keys for entries saved in a dictionary/database. I was writing a program for creating a log to save information about students visiting me for advising (in my post I used the example of patients visiting a medical office; same idea). Multiple people responded and, first, I'd like to thank you all! Probably 3 of 5 responses noted that this was something that might be better if written with objects. That's where my question today comes in ... Why might an OOP approach be better here? With the program as is, users can do things like * make a new entry (i.e., add information about a student who just visited you, their advisor, noting the student's name, date, and other info. Each entry is grouped into a list, which becomes a dictionary value.), * count the total number of visits (len(dict)), * get a list of all the entries (sorted by last name, with name and date printed), and * query the database (you can use first or last name) to see whether you've met the student before. If there's a name match, the whole record is printed out. I've also got a couple small functions, one to translate mmddyy date info into mmm dd yyyy format, and another to print an entry (translating list members into pretty output). In other words, it's pretty basic. With my limited knowledge of OOP, it seems like I'd end up with pretty much the same number of lines of code either way, and the same effort required on my part, if I wrote this program via OOP. Statements governing the stuff I put next to asterisks above would be encapsulated into functions, which in turn become part of a Class statement. It would be the same statements I wrote, though--just rearranged and ultimately accessed via fancy dot notation :-) I am sure there are advantages, even here, to having a class for database entries, and advising session 'objects.' ... I just don't know what the advantages are. Thoughts? Thanks, as always -- Al __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com From glingl@aon.at Mon Aug 12 20:43:19 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 12 Aug 2002 21:43:19 +0200 Subject: [Fwd: Re: Subject: Re: [Tutor] two lists to keys and values in dictionary] Message-ID: <3D580FD6.2050700@aon.at> Doug.Shawhan@gecits.ge.com schrieb: > I have never seen zip before! Guess it's time to rearead my copy of > "Python > Standard Library". > > Bad guess. Guess you won't find it there, coz (!) it's not part of a module but a built-in function. Have a look at: http://www.python.org/doc/current/lib/built-in-funcs.html btw: zip is an evergreen on this list. I think it's a good idea to read the postings here even if one is not in urgent need of their respective topic. (Some are too hard or too special, those do I skip) Somtimes one can even reply - this way proliferating one's growing knowledge and making life easier for those who do the biggest part of the work on this list - at least I hope so ... . Regards, Gregor From gus.tabares@verizon.net Mon Aug 12 21:25:41 2002 From: gus.tabares@verizon.net (Gus Tabares) Date: Mon, 12 Aug 2002 16:25:41 -0400 Subject: [Tutor] understanding classes Message-ID: Hello, I'm reading Learning Python (O'Reilly) and I'm trying to grasp the concept of classes. In the book it has the example: class FirstClass: def setdata(self, value): self.data = value def display(self): print self.data Now I kind of understand what's going on here. It's defining a new class object called FirstClass. But what I don't understand really is the "self" part. The book says: "Functions inside a class are usually called method functions; they're normal defs, but the first argument automatically receives an implied instance object when called." I guess I'm just looking for a more simplied explanation of 'receives an implied instance object'. I sort of understand that if you set "x = FirstClass()" in this example 'self' inside FirstClass "becomes" x. Either that or I just don't know;) Thanks in advance, Gus From dyoo@hkn.eecs.berkeley.edu Mon Aug 12 23:02:21 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 12 Aug 2002 15:02:21 -0700 (PDT) Subject: [Tutor] understanding classes [how does 'self' get set?] In-Reply-To: Message-ID: On Mon, 12 Aug 2002, Gus Tabares wrote: > I'm reading Learning Python (O'Reilly) and I'm trying to grasp the > concept of classes. In the book it has the example: > > class FirstClass: > def setdata(self, value): > self.data = value > def display(self): > print self.data > > > Now I kind of understand what's going on here. It's defining a new > class object called FirstClass. But what I don't understand really is > the "self" part. > > The book says: "Functions inside a class are usually called method > functions; they're normal defs, but the first argument automatically > receives an implied instance object when called." I guess I'm just > looking for a more simplied explanation of 'receives an implied instance > object'. > > I sort of understand that if you set "x = FirstClass()" in this example > 'self' inside FirstClass "becomes" x. Either that or I just don't know;) It might help if we make two instances of a FirstClass, because then we'll have two notions of 'self'. Let's cause an identity crisis. *grin* ### >>> class FirstClass: ... def setdata(self, value): self.data = value ... def display(self): print self.data ... >>> first_instance = FirstClass() >>> second_instance = FirstClass() ### Ok, we have two instances of our class now. At this point, it becomes ambiguous when we talk about the setdata() method and its parameters without mentioning the instance. What do we mean by 'self'? Do we mean 'first_instance', or 'second_instance'? Python actually will say something about this ambiguity if we try calling FirstClass.setdata(): ### >>> FirstClass.setdata(42) Traceback (most recent call last): File "", line 1, in ? TypeError: unbound method setdata() must be called with instance as first argument ### Notice that Python is complaining that it doesn't know what 'self' is either! In order to call a method of a function, we need to tell Python whose perspective we're using. If we want to call the setdata() method for our first_instance, we need to somehow tell Python to use first_instance. ### >>> first_instance.setdata(42) >>> second_instance.setdata(81) >>> first_instance.display() 42 >>> second_instance.display() 81 ### It's the syntax of calling a method of an instance that allows Python to understand what we mean by 'self'. What this syntax is trying to encourage is the thought "'first_instance' is calling it's setdata() method. 'second_instance' is calling its setdata() method..." This syntax ties together the instance with its method so that we know what 'self' will stand for. By the way, whenever we do something like: .(, , ...) Python actually will rotate things around like this: .(, , , ...) But all these fill-in-the-blanks make this too abstract. Let's look at our example again. When we say: first_instance.setdata(42) Python will translate this into a more conventional form: FirstClass.setdata(first_instance, 42) and that's another way of seeing how Python figures things out about self: we can imagine that Python flips things around so that all the parameters get filled in properly, including that 'self' parameter. ### >>> FirstClass.setdata(first_instance, 1.6) >>> FirstClass.display(first_instance) 1.6 >>> FirstClass.setdata(second_instance, "Go Bears") >>> second_instance <__main__.FirstClass instance at 0x811587c> >>> second_instance.display() Go Bears ### Please feel free to ask more questions about this. Good luck! From marcolinux@linuxbr.com.br Mon Aug 12 21:53:25 2002 From: marcolinux@linuxbr.com.br (Marc) Date: Mon, 12 Aug 2002 17:53:25 -0300 Subject: [Tutor] Python + editor In-Reply-To: <200208121135.22214.mnavarre@anteon.com> References: <20020812153622.GA4692@marcolab.proconet> <200208121135.22214.mnavarre@anteon.com> Message-ID: <20020812205325.GA5168@marcolab.proconet> Matthew Navarre (mnavarre@anteon.com) wrote: > On Monday 12 August 2002 08:36 am, Marc wrote: > > Andreas Daskalopoulos (daskalious@softhome.net) wrote: > > > What are you guys using for editing your python files on Linux? > > > > Still use vim (syntax colors very beautiful!)but recently converted to > > nedit ( http://www.nedit.org ): > > > > There's a pretty nice vim script that puts a python menu in the menubar at: > http://vim.sourceforge.net/script.php?script_id=30 > lets you select blocks, indent, dedent and comment out blocks and has a menu > with all classes and functions in your script. > Great! I'll check it out later at night... > > Ctrl+C,ctrl+V :-); > Vim ain't that hard... Indeed. Nothing beats yy p . But consider "selling" a python editor to some windows people. CTRL+CV rules for them. > > Show line numbers; > :set nu Sweet. Living and learning... Eats some precious 8 characters, though. With nedit it just a clickt-click: show line numbers. And they keep showing even when scrolling. Horizontally. > > Block selection (ctrl+mouse selection). > > Useful for moving functions around without the indentation; > The python script has a ]v shortcut to select a block. There's also Visual > mode in Vim which allows you to do things like > :36 #move to line 36 > V #visual block mode > 10j #select 10 lines > YY #yank the selection > :75 #move to line 75 > p #paste the selection Can't beat crtl+mouse selection. If this serves as a way to measure the ease of editing, try to explain the procedure over a fone line. To mom. :) > > Can redefine the print command: > > Install a2ps and gv; > > Edit .Xdefaults: nedit.printCommand: a2ps -4 -Pdisplay ; > > Voila: Can print up to four (-4) pages in one side of sheet!; > > (great for reading Danny's code on a bus. Yup,I don't have a zaurus > > yet.:) > > > > I'm sure you can do this in vim, I'm just not sure how. That's my problem with vim. And some others softwares out there.They have a lot of power, but hidden deep inside a dotfile. The lack of a easy gui, makes life hard for beginners. OK, we can use gvim but is still hard to do some things like the print command above.And it seems like a skin thing, not fully integrated. Same goes to emacs-X11. Sure vim can do a lot of things, but the learning curve is too steep. Most tricks I've learned, was looking in other peoples' dotfiles. Thats OK when we are young, full of energy for search the docs, but gets quite frustrating after some time and u need the work done.Quick. Think about a exhibition (Linux expo anyone?) and someone comes to your booth asking how to redefine the print command .Yup, u just lost a customer while you was looking at the docs.:) You know, life is short.That's why I'm slowly giving up from things like: - C/perl ; - vi/emacs; - windows (nightmare when comes down to license issues and security. Not to mention total lack of choice( from vendor that is. Cant get a gnu like system from Windos CDs. - mutt. Just kidding. It's worth every minute spent reading docs. Well, I'm not trolling. I just think that programming (and using) a computer should be a enjoyable experience, something I'm experimenting right now with GNU/linux and python.And nedit of course :) . See Ya. .:: MarcoLinux ::. -- There are 10 kinds of people in the world: Those who understand binary, and those who don't. - Slashdot From sarmstrong13@mac.com Mon Aug 12 22:23:59 2002 From: sarmstrong13@mac.com (SA) Date: Mon, 12 Aug 2002 16:23:59 -0500 Subject: [Tutor] Gadfly database location In-Reply-To: <006001c241a7$426ed9a0$ebe710ac@pc7345> Message-ID: > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3112014242_1915184 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit On 8/11/02 9:22 PM, "Paul Hartley" wrote: > > One, to open a database the second parameter is a directory name, and gadlfy > seems to look for the directory starting at the current directory. So if my > python module is in /python/test/gadfly and I start a database located at > 'testdb' then gadfly looks in /python/test/gadfly/testdb. How do I get gadfly > to look elsewhere for the database (i.e. in /server/data?) > >From what I can gather, you can specify where to start the directory in the beginning. So if server/data is located @ /, then /server/data should take you to the correct directory. If not just ../ out until you are at the root directory ( that is / not root) then add on server/data to the end of that. My understanding is that Gadfly just uses basic Unix traversing for this variable. Hope this helps. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me --B_3112014242_1915184 Content-type: text/html; charset="US-ASCII" Content-transfer-encoding: quoted-printable Re: [Tutor] Gadfly database location On 8/11/02 9:22 PM, "Paul Hartley" <p.har= tley@spitech.com> wrote:

One, to open a database the second= parameter is a directory name, and gadlfy seems to look for the directory s= tarting at the current directory. So if my python module is in /python/test/= gadfly and I start a database located at 'testdb' then gadfly looks in /pyth= on/test/gadfly/testdb. How do I get gadfly to look elsewhere for the databas= e (i.e. in /server/data?)

From what I can gathe= r, you can specify where to start the directory in the beginning. So if serv= er/data is located @ /, then /server/data should take you to the correct dir= ectory. If not just ../ out until you are at the root directory ( that is / = not root) then add on server/data to the end of that. My understanding is th= at Gadfly just uses basic Unix traversing for this variable.

Hope this helps.

SA


--
"I can do everything on my Mac I used to on my PC. Plus a lot more ...= "
-Me
--B_3112014242_1915184-- From fleet@teachout.org Mon Aug 12 19:57:49 2002 From: fleet@teachout.org (fleet@teachout.org) Date: Mon, 12 Aug 2002 14:57:49 -0400 (EDT) Subject: [Tutor] Parse Problem [2] In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C81B@mbtlipnt02.btlabs.bt.co.uk> Message-ID: I think I've got it licked. As I told Danny, I don't control the file that I'm parsing so splitting on the quotes or including commas etc. is not an option. Here's what I've done: import time import string curtime=time.localtime(time.time()) curdate=time.strftime("%y%m%d",curtime) log=open("log","r") for rline in log.readlines(): line=string.split(rline," ") if line[1]=="Matched": line1=rline[19:-2] <-- #slicing the "unsplit" line print "%s %s" % (line1, curdate) #that meets the criteria of the line=string.split(rline,":") #'if' statement. # note use of continuation below. if line[1][1:-1] =="Missing action" or \ line[1]=="Invalid regexp" or \ line[1]=="Incomplete recipe": line1=line[1][1:-1] print "%s %s" % (line1, curdate) - fleet - PS: Danny, two minutes after I posted to you with the grep|cut|sed shell command, I realized it was also including only the first word - and for exactly the same reason. On Mon, 12 Aug 2002 alan.gauld@bt.com wrote: > > Given the strings 'xxxxx: xxxxx "xxx xxx"' and 'xxxxx: xxxxx > > > need to get everything within the quotes as xx[2]. > > A quick guess - why not split on the quotes: > > string.split(str, '"') ?? Would that help? > > Alan g > From rob@uselesspython.com Mon Aug 12 23:10:17 2002 From: rob@uselesspython.com (Rob) Date: Mon, 12 Aug 2002 17:10:17 -0500 Subject: [Tutor] printing puzzlement In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C810@mbtlipnt02.btlabs.bt.co.uk> Message-ID: This has turned out to be a most interesting challenge to tackle so far. It's turning into one in which I take other-than-the-best C++ code written quickly by someone else, and transmuting it into something entirely different in another language, while achieving the same output. As much fun as this is to do, I think I'll wind up writing a few short C++ programs of my own that can be used as better examples. (Not that I'm the world's finest C++ hacker, of course.) I did some of this to demonstrate concepts (and plug Python) during this summer's C++ courses, and it seems to have gone over well. Rob > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > alan.gauld@bt.com > Sent: Monday, August 12, 2002 5:26 AM > To: rob@uselesspython.com; tutor@python.org > Subject: RE: [Tutor] printing puzzlement > > > > As seen in the C++ code snippet here, calculations are > > performed in the middle of the display of each line of > > output. Does anyone know of a good way to reproduce > > similar behavior in a Python program? > > The same way the C++ programmer would have done it if > [s]he'd had any sense - using a string buffer and then > writing the full string out! > > In Pythons case use a format string and some variables > to hold the intermediate values... > > > // Display the amortization schedule > > for (int index = 0; index < numPayments; index++) > > { > > cout << setw(5) << right << (index + 1); > > cout << setw(12) << right << fixed << > > setprecision(2) << principle; > > cout << setw(9) << right << fixed << amtPayment; > > buff = "%5d%12.2d%9d" % (index+1,principle, amtPayment) > > > float interest = (float (int (principle * > > monthRate * 100) ) ) / 100.0; > > cout << setw(11) << right << fixed << interest; > > principle = principle + interest - amtPayment; > > cout << setw(12) << right << fixed << principle; > > buff = buff + "%11d%12d" % (interest, principle) > > > cout << endl; > > print buff > > The types and precisions might need frigging but > you hopefully get the idea I'm suggesting. > > Alan g. > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From lumbricus@gmx.net Mon Aug 12 23:19:37 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Tue, 13 Aug 2002 00:19:37 +0200 (MEST) Subject: [Tutor] Generating sigs with Python for fun and education References: <200208121254.44192.scot@possum.in-berlin.de> Message-ID: <29836.1029190777@www5.gmx.net> > Hi there, Hello! > My mail program, kmail (part of KDE for Linux) has an option which lets > you > use the output of a program as a signature. So I got this idea to use > Python to dynamically generate signatures instead of having a boring, > static one. You know about fortune? man fortune [ snip ] > real_days = {'Mon' : 'Monday', > 'Tue' : 'Tuesday', > 'Wed' : 'Wednesday', > 'Thu' : 'Thursday', > 'Fri' : 'Friday', > 'Sat' : 'Saturday', > 'Sun' : 'Sunday'} > > now_list = time.asctime(time.localtime(time.time())).split() There is no need for that real_days-trick: $ python Python 1.5.1 (#1, Apr 7 1999, 08:54:31) [C] on osf1V4 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import time >>> time.strftime("%A", time.localtime(time.time())) 'Tuesday' >>> $ man 3 strftime [ snip ] HTH, HAND J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From sarmstrong13@mac.com Mon Aug 12 23:23:31 2002 From: sarmstrong13@mac.com (SA) Date: Mon, 12 Aug 2002 17:23:31 -0500 Subject: [Tutor] Regex help please. Message-ID: Hi Everyone- I am trying to match a string pattern like the following: ?1234.htm I would then like to extract the 1234 from the pattern and sub 1234.html for the pattern. Anyone know how to do this? Is there a simpler way than re? Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From glingl@aon.at Mon Aug 12 23:25:11 2002 From: glingl@aon.at (Gregor Lingl) Date: Tue, 13 Aug 2002 00:25:11 +0200 Subject: [Tutor] understanding classes References: Message-ID: <3D5835C7.2060506@aon.at> This is a multi-part message in MIME format. --------------010109070004060709070206 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Gus Tabares schrieb: >Hello, > > I'm reading Learning Python (O'Reilly) and I'm trying to grasp the concept >of classes. In the book it has the example: > > class FirstClass: > def setdata(self, value): > self.data = value > def display(self): > print self.data > > > Now I kind of understand what's going on here. It's defining a new class >object called FirstClass. But what I don't understand really is the "self" >part. The book says: "Functions inside a class are usually called method >functions; they're normal defs, but the first argument automatically >receives an implied instance object when called." I guess I'm just looking >for a more simplied explanation of 'receives an implied instance object'. I >sort of understand that if you set "x = FirstClass()" in this example 'self' >inside FirstClass "becomes" x. Either that or I just don't know;) > > >Thanks in advance, >Gus > WARNING! WARNING! lenghty WARNING! WARNING! but easy WARNING!! Tkinter needed WARNING!! at least in your head /* * I claim, that the following explanation * HELPS the students to develop a * correct - or at least useful and * usable mental model of the relationship * between classes, objects and the role * of the parameter self. * * I would ask you to show up any weak * points of this approach and especially * to check if there is some danger that the * students may develop a false and erroneous * or fundamentally incomplete view of the * topic? * Suggestions for improvement are equally * welcome! * * Many thanks in advance * Gregor */ I'll try to explain classes, objects and THE CASE OF THE UN-UNDERSTOOD SELF in four steps - as concisely as I can. I'll use a visible object in order to 'soften' the necessary abstractions. I'll use the turtle - module. The turtle is a commandable drawing-pen with a local coordinate-system. Thw turtle module contains a) functions to command an anonymous turtle b) a Class Pen to construct turtle-Objects, which posses exactly the functions from a) as methods, i.e. bound functions So we can decide, what to use. -------------------------------------- Step 1: We use ordinary Functions ------- We make a program, that defines a function jump(distance) which makes the turtle jump forward without drawing. Such a function is not provided in the module. Then we let the turtle draw 30 pixels, jump 30 pixels and go 30 pixels again. The code of this program is as follows: ####################################### # turtle01.py """ make THE (anonymous) turtle jump """ from turtle import * def jump(distance): up() forward(distance) down() # now we can draw a broken line forward(30) jump(30) forward(30) Tkinter.mainloop() ############# SIMPLE ! ################ --------------------------------------- Step 2: We want to make several concrete named turtles jump. So we have to modify our previous program: ------- ####################################### # turtle02.py """ make SEVERAL NAMED turtles (i. e. turtle-objects) jump """ from turtle import * # jump now has to make som animal jump, # so we have to deliver the information, # which one: def jump(turtle, distance): turtle.up() turtle.forward(distance) turtle.down() # Make three turtles - # they are objects, made from the class Pen turtles = [leonardo, michelangelo, donatello] = [Pen(),Pen(),Pen()] # let's turn two of them, so they march in # different directions - # so I've to call their methods, in this case method left(angle) michelangelo.left(90) donatello.left(180) # now each of them can draw a broken line for turtle in turtles: turtle.forward(30) jump(turtle,30) turtle.forward(30) Tkinter.mainloop() ####################################### We observe a lack of symmetry between forward and jump - so we think, if we can make this asymmetry vanish - lets make our own turtles: First inheritance comes to our mind! We use our best friend for an intermediate investigation: >>> from turtle import * >>> class MyPen(Pen): pass >>> leo = MyPen() >>> leo.forward(30) >>> .... and it works! Leo behaves exactly like leonardo in "Step 2", like a true Pen. But he can't jump. So let's teach him (and his brothers): -------------------------------------- Step 3: We want to make our own turtles, that can all turtles can + jump! So let's modify turtle02.py ------- ###################################### # turtle03.py from turtle import * # jump now has to make some animal jump, # so we have to deliver the information, # which one. This time we do this by defining # bound functions, i. e. methods: # First we make our own Pen - class, # inheriting from Pen class MyPen(Pen): # to 'bind' jump we have to put it into # this class, by indenting it - AND NOTHING ELSE!!! # ... and keep in mind, why the parameter turtle is there! def jump(turtle, distance): turtle.up() turtle.forward(distance) turtle.down() # Make three turtles - # they are objects, made from the class MyPen (!!!) turtles = [leo, michel, tello] = [MyPen(),MyPen(),MyPen()] # let's turn two of them, so they march in # different directions - # so I've to call their methods! # In this case method left(angle) michel.left(90) tello.left(180) # now each of them can draw a broken line for turtle in turtles: turtle.forward(30) turtle.jump(30) # now they know, how to do it! turtle.forward(30) Tkinter.mainloop() ######################################## And we see, this works fine and produces the same drawing as turtle02.py -------------------------------------- Step 4: Cosmetics ------- We know, we can choose parameter-names as we like - and we are used to choose them as meaningful as possible. So we don't call the first parameter of the jump - method zwrtlbrnft (which is 1. hard to remember for someone who is not from Munich and 2. in no ways tied to the concepts of turtle or class or object) but think about the role of this parameter: it references the animal, which has to jump. And as the method is bound to it, for this jumping animal the animal is simply (it)self! So in the following there are only changes in the method jump (only 4 lines!) ###### NEARLY NOTHING NEW ############### # turtle04.py from turtle import * # jump now has to make some animal jump, # so we have to deliver the information, # which one. This time we do this by defining # bound functions, i. e. methods: # First we make our own Pen - class, # inheriting from Pen class MyPen(Pen): # to 'bind' jump we have to put it into # this class, by indenting it - AND NOTHING ELSE!!! # ... and keep in mind, why the parameter turtle is there! # rename turtle-->self def jump(self, distance): self.up() self.forward(distance) self.down() # Make three turtles - # they are objects, made from the class MyPen (!!!) turtles = [leo, michel, tello] = [MyPen(),MyPen(),MyPen()] # let's turn two of them, so they march in # different directions - # so I've to call their methods! # In this case method left(angle) michel.left(90) tello.left(180) # now each of them can draw a broken line for turtle in turtles: turtle.forward(30) turtle.jump(30) # now they know, how to do it! turtle.forward(30) Tkinter.mainloop() ######################################## An this completes this demonstration of the origin and the meaning of self. =================== FINE =========================== --------------010109070004060709070206 Content-Type: text/plain; name="turtle01.py" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="turtle01.py" # Author: Gregor Lingl # email: glingl@aon.at # Datum: 12. 8. 2002 # turtle01.py """ make THE (anonymous) turtle jump """ from turtle import * def jump(distance): up() forward(distance) down() # now we can draw a broken line forward(30) jump(30) forward(30) Tkinter.mainloop() --------------010109070004060709070206 Content-Type: text/plain; name="turtle02.py" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="turtle02.py" # Author: Gregor Lingl # email: glingl@aon.at # Datum: 12. 8. 2002 # turtle02.py """ make SEVERAL NAMED turtles (i. e. turtle-objects) jump """ from turtle import * # jump now have to make som animal jump, # so we have to deliver the information, # which one: def jump(turtle, distance): turtle.up() turtle.forward(distance) turtle.down() # Make three turtles - # they are objects, made from the class Pen turtles = [leonardo, michelangelo, donatello] = [Pen(),Pen(),Pen()] # let's turn two of them, so they march in # different directions - # so I've to call their methods! # In this case method left(angle) michelangelo.left(90) donatello.left(180) # now each of them can draw a broken line for turtle in turtles: turtle.forward(30) jump(turtle,30) turtle.forward(30) Tkinter.mainloop() --------------010109070004060709070206 Content-Type: text/plain; name="turtle03.py" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="turtle03.py" # Author: Gregor Lingl # email: glingl@aon.at # Datum: 12. 8. 2002 # turtle03.py """ make SEVERAL NAMED better educated turtles (i. e. turtle-objects) that can jump """ from turtle import * # jump now have to make some animal jump, # so we have to deliver the information, # which one. This time we do this by defining # bound functions, i. e. methods: # First we make our own Pen - class, # inheriting from Pen class MyPen(Pen): # to 'bind' jump we have to put it into # this class, by indenting it - AND NOTHING ELSE!!! # ... and keep in mind, why the parameter turtle is there! # this binding allows a different syntax for calling the function def jump(turtle, distance): turtle.up() turtle.forward(distance) turtle.down() # Make three turtles - # they are objects, made from the class MyPen (!!!) turtles = [leo, michel, tello] = [MyPen(),MyPen(),MyPen()] # let's turn two of them, so they march in # different directions - # so I've to call their methods! # In this case method left(angle) michel.left(90) tello.left(180) # now each of them can draw a broken line for turtle in turtles: turtle.forward(30) turtle.jump(30) # now they know, how to do it! turtle.forward(30) Tkinter.mainloop() --------------010109070004060709070206 Content-Type: text/plain; name="turtle04.py" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="turtle04.py" # Author: Gregor Lingl # email: glingl@aon.at # Datum: 12. 8. 2002 # turtle04.py """ make SEVERAL NAMED better educated turtles (i. e. turtle-objects) that can jump """ from turtle import * # jump now have to make some animal jump, # so we have to deliver the information, # which one. This time we do this by defining # bound functions, i. e. methods: # First we make our own Pen - class, # inheriting from Pen class MyPen(Pen): # to 'bind' jump we have to put it into # this class, by indenting it - AND NOTHING ELSE!!! # ... and keep in mind, why the parameter turtle is there! # therefore change the NAME turtle to the NAME self def jump(self, distance): self.up() self.forward(distance) self.down() # Make three turtles - # they are objects, made from the class MyPen (!!!) turtles = [leo, michel, tello] = [MyPen(),MyPen(),MyPen()] # let's turn two of them, so they march in # different directions - # so I've to call their methods! # In this case method left(angle) michel.left(90) tello.left(180) # now each of them can draw a broken line for turtle in turtles: turtle.forward(30) turtle.jump(30) # now they know, how to do it! turtle.forward(30) Tkinter.mainloop() --------------010109070004060709070206-- From lumbricus@gmx.net Mon Aug 12 23:38:56 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Tue, 13 Aug 2002 00:38:56 +0200 (MEST) Subject: password [WAS: [Tutor] (no subject)] References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C819@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <14468.1029191936@www5.gmx.net> > I am completly new to either python or a world of > programing. Honestly I am a bit nervous using this > service first time. Hello! It would be easier if you had a Subject line To your question: There is a getpass module. >>> import getpass >>> dir(getpass) HTH, HAND and Greetings, J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From dyoo@hkn.eecs.berkeley.edu Tue Aug 13 00:19:39 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 12 Aug 2002 16:19:39 -0700 (PDT) Subject: password [WAS: [Tutor] (no subject)] In-Reply-To: <14468.1029191936@www5.gmx.net> Message-ID: On Tue, 13 Aug 2002 lumbricus@gmx.net wrote: > > I am completly new to either python or a world of programing. Honestly > > I am a bit nervous using this service first time. > > Hello! > > It would be easier if you had a Subject line > > To your question: > There is a getpass module. > >>> import getpass > >>> dir(getpass) 'getpass' would be the official module to use if we wanted a production-quality password reader. However, since Akira's is starting off with programming, I think it's still a good thing for him to "reinvent the wheel" here, because it will help him feel more comfortable with loops and conditionals. Otherwise, we might stunt his growth. *grin* From dman@dman.ddts.net Tue Aug 13 01:33:34 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Mon, 12 Aug 2002 20:33:34 -0400 Subject: [Tutor] Re: Python + editor In-Reply-To: References: Message-ID: <20020813003334.GB14636@dman.ddts.net> --z6Eq5LdranGa6ru8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 12, 2002 at 05:38:24AM +0300, Andreas Daskalopoulos wrote: | What are you guys using for editing your python files on Linux?=20 vim. I use vim for everything -- coding, mail, documentation, config files. You name it, if it is text editing I use vim. -D --=20 Reckless words pierce like a sword, but the tongue of the wise brings healing. Proverbs 12:18 =20 http://dman.ddts.net/~dman/ --z6Eq5LdranGa6ru8 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1YU94ACgkQO8l8XBKTpRTM4gCghQx8QRR6rZjGlqDSLOTGBqAQ SvUAnArSdSeuGFCJqm32Sk3JOBKLZc8Z =Oem4 -----END PGP SIGNATURE----- --z6Eq5LdranGa6ru8-- From kodokuchef@yahoo.com Tue Aug 13 03:04:30 2002 From: kodokuchef@yahoo.com (akira sugiura) Date: Mon, 12 Aug 2002 19:04:30 -0700 (PDT) Subject: [Tutor] password,while loops, Message-ID: <20020813020430.29759.qmail@web10302.mail.yahoo.com> Hi, Danny,Alan,Lumbricus Thank you very much for a quick and helpful suggestion. It took me about 20 minutes to write this program(I dare to call this a program)and it worked ok. ======================================================= password = "foobar" a=0 while password != "unicorn": print "You've guessed",a,"times." password = raw_input("Password?:") if password!="unicorn": a=a+1 elif password=="unicorn": print "Welcome in" ======================================================= PS, I am using the "A-Non Programmers Tutorial for Python"by Josh Cogaliati on web. I got there from python.org page. Sincerely, ===== ----------------------------------- Akira Sugiura kodokuchef@yahoo.com ----------------------------------- __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com From lumbricus@gmx.net Tue Aug 13 03:32:04 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Tue, 13 Aug 2002 04:32:04 +0200 (MEST) Subject: [Tutor] password,while loops, References: <20020813020430.29759.qmail@web10302.mail.yahoo.com> Message-ID: <27985.1029205924@www5.gmx.net> > Hi, Hello! > Danny,Alan,Lumbricus The name is Joerg - short J"o > Thank you very much for a quick and helpful > suggestion. > It took me about 20 minutes to write this program(I > dare to call this a program)and it worked ok. > ======================================================= > password = "foobar" > a=0 > > while password != "unicorn": > print "You've guessed",a,"times." > password = raw_input("Password?:") > if password!="unicorn": > a=a+1 > elif password=="unicorn": > print "Welcome in" You are testing for (password - "unicorn") three times. Once should be enough. ;-) > ======================================================= > PS, I am using the "A-Non Programmers Tutorial for > Python"by Josh Cogaliati on web. I got there from > python.org page. > > Sincerely, > > > > ===== > ----------------------------------- > Akira Sugiura > kodokuchef@yahoo.com > ----------------------------------- Greets, J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From mcfrench69@hotmail.com Mon Aug 12 19:25:41 2002 From: mcfrench69@hotmail.com (Marc French) Date: Mon, 12 Aug 2002 14:25:41 -0400 Subject: [Tutor] A simple question Message-ID: Hello, I am having problems importing modules from other parties, ie Scipy and Gnuplot.py. Is there a directory that python is looking in when you import a module? The modules are in C:\Python22\Lib\site-packages & a folder for their respective .py files. I am running python 2.2 with Pythonwin on Windows 2000. I am a Visual Basic programmer. Do you recommend any good python books for someone not use to the command line coming from a visual language? Thanks for your help ahead of time. Marc _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com From Mike Allen" This is a multi-part message in MIME format. ------=_NextPart_000_0005_01C24244.39AD1910 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, I want to learn Python so I can access and work with different file = media file types ( *.rib, *.tif, *.tga, *.mel, *.ma, *.mb ,*.ae, etc) = involved in=20 the "typical" digital effects production pipelines. Any info from = technical directors out there is much appreciated. For example, what tasks do you use Python for on a daily or weekly = basis. You see, I find that learning a programming language is quite ...boring and dry without a good reason as to what I = want to accomplish. I like learning from the outside and move inward. Or = put another way, grasping the "Big Picture" first, then diving into the = details or modules. Most programming books are just the opposite! Give me a compelling case (i.e., scenario) as to why I need to write a = script.=20 Example Scenario: Tom is a technical director at ILM and has a directory = full of RIB files. RIB files range in size from several megabytes to several hundreds of megabytes. RIB files are essentially very large = text files which describe how a single frame of animation should appear = once processed by Pixar's PRenderMan rendering application. Tom needs = to create a Python program that opens each .rib file and scans the file = for a specific line or phrase and removes it/changes it, then saves the = file and proceeds to the next file, all the while displaying the = program's status onto the screen.=20 ......catch my drift? I also like diagramming or flow charting the whole = process first. Then you just write the pieces of code next to the flowchart diagram, to get the outline of the program = started. Is this normal? Remember, I don't have a programmer's background. So far, after looking at Amazon.com I am most attracted to = "Core Python." The author also teaches classes at the=20 UofCalifornia Santa Cruz. I live in the bay area and so that is a plus. = He also mentioned about working with image files, which is the only book = that mentions that topic.=20 .....So, after a long email does anyone know of any good magazine = articles, websites, books, learning CDs out there on Python? Anything that talks about Python and its use in Digital Effects studios = also gets my attention. Sample scripts with break-downs also helpful.=20 On Tuesday I will head to Linux World in San Francisco and maybe find = some useful Python training material. Who knows?=20 Thanks for any tips! Cheers, Mike=20 http://www.allenagenda.com ------=_NextPart_000_0005_01C24244.39AD1910 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello,
 
I want to learn Python so I can access = and work=20 with different file media file types ( *.rib, *.tif, *.tga, *.mel, *.ma, = *.mb=20 ,*.ae, etc) involved in
the "typical" digital effects = production pipelines.=20 Any info from technical directors out there is much = appreciated.
For example, what tasks do you use = Python for on a=20 daily or weekly basis. You see, I find that learning a = programming
language is quite ...boring and dry = without a good=20 reason as to what I want to accomplish. I like learning from the outside = and=20 move inward. Or put another way, grasping the "Big Picture" first, then = diving=20 into the details or modules. Most programming books are just the=20 opposite!
Give me a compelling case (i.e., = scenario) as to=20 why I need to write a  script.
 
Example Scenario: Tom is a technical = director at=20 ILM and has a directory full of RIB files. RIB files range in size from = several=20 megabytes
to several hundreds of megabytes. RIB = files are=20 essentially very large text files which describe how a single frame of=20 animation  should appear once processed by Pixar's PRenderMan  = rendering application. Tom needs to create a Python program that opens = each .rib=20 file and scans the file for a specific line or=20 phrase and removes it/changes it, then saves the file and proceeds to = the next=20 file, all the while displaying the program's status onto the screen.=20
 
......catch my drift? I also like = diagramming or=20 flow charting the whole process first. Then you just write the pieces of = code
next to the flowchart diagram, to get = the outline=20 of the program started. Is this normal? Remember, I don't have a=20 programmer's
background. So far, after looking at = Amazon.com I=20 am most attracted to "Core Python." The author also teaches classes at = the=20
UofCalifornia Santa Cruz. I live in the = bay area=20 and so that is a plus. He also mentioned about working with image files, = which=20 is the only book that mentions that topic.
 
.....So, after a long email does anyone = know of any=20 good magazine articles, websites, books, learning CDs out there on=20 Python?
Anything that talks about Python and = its use in=20 Digital Effects studios also gets my attention. Sample scripts with = break-downs=20 also helpful.
On Tuesday I will head to Linux World = in San=20 Francisco and maybe find some useful Python training material. Who = knows?=20
 
 
Thanks for any tips!
Cheers,
Mike
http://www.allenagenda.com=
 
 
------=_NextPart_000_0005_01C24244.39AD1910-- From shalehperry@attbi.com Tue Aug 13 05:30:14 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Mon, 12 Aug 2002 21:30:14 -0700 (PDT) Subject: [Tutor] Regex help please. In-Reply-To: Message-ID: On 12-Aug-2002 SA wrote: > Hi Everyone- > > I am trying to match a string pattern like the following: > > ?1234.htm > > I would then like to extract the 1234 from the pattern and sub 1234.html for > the pattern. > > > Anyone know how to do this? Is there a simpler way than re? > so 1234.htm becomes 1234.html.htm? From dylan.belsey@baesystems.com Tue Aug 13 06:29:47 2002 From: dylan.belsey@baesystems.com (BELSEY, Dylan) Date: Tue, 13 Aug 2002 14:59:47 +0930 Subject: [Tutor] A simple question Message-ID: <86C3892A0C52D411AF5000A0C9EAA3B96320E3@wtntex1.baea.com.au> Hi Marc, I have been experimenting with this recently and although I don't have the definitive answer, I believe that you can set the PYTHONPATH system variable to the directory where these modules live or place these new modules into the lib directory (not sure if this last one works...may want to verify). These may not be the cleanest ways, so I'm open to criticism from the gurus :) Contrary to previous postings, and this is a personal preference, I found Ivan Van Laningham's SAMS Teach Yourself Python in 24 Hours, to be very helpful. This was actually a topic of discussion today and an O'Reilly book was mentioned (???) if memory serves me correctly. Unfortunately I have deleted the e-mail so you may want to search the archives of this list for today and yesterday. The archive is at: http://mail.python.org/pipermail/tutor/2002-August/date.html I found this relevant e-mail in the archive: http://mail.python.org/pipermail/tutor/2002-August/016309.html I'm sure someone else on the list will be able to give you the complete reference. Dylan -----Original Message----- From: Marc French [mailto:mcfrench69@hotmail.com] Sent: Tuesday, 13 August 2002 04:26 To: tutor@python.org Subject: [Tutor] A simple question Hello, I am having problems importing modules from other parties, ie Scipy and Gnuplot.py. Is there a directory that python is looking in when you import a module? The modules are in C:\Python22\Lib\site-packages & a folder for their respective .py files. I am running python 2.2 with Pythonwin on Windows 2000. I am a Visual Basic programmer. Do you recommend any good python books for someone not use to the command line coming from a visual language? Thanks for your help ahead of time. Marc _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From glingl@aon.at Tue Aug 13 06:55:12 2002 From: glingl@aon.at (Gregor Lingl) Date: Tue, 13 Aug 2002 07:55:12 +0200 Subject: [Tutor] Re: I'd like to learn Python Message-ID: <3D589F40.9040803@aon.at> --------------030208080206070609050301 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Kow Kuroda schrieb: > > Thanks for your info about *Practial Python*. > > The only thing I would complain about it is that I probably can't buy > it used (published in August 2002), can I? 1) If I bought it, I wouldn't sell it 2) We in Europe even can't buy it new at the moment, so new is it!! We can order it at amazon's - horribly expensive shipping fees! 3) Ask at your local bookseller. (Maybe there are some crazy people, who are used to buy books from some bestselling list - then beeing surprised that there is covered a programming language instead of Monty Python's something... so they sell it immediately ;-) Gregor --------------030208080206070609050301-- From dylan.belsey@baesystems.com Tue Aug 13 07:53:38 2002 From: dylan.belsey@baesystems.com (BELSEY, Dylan) Date: Tue, 13 Aug 2002 16:23:38 +0930 Subject: [Tutor] A simple question Message-ID: <86C3892A0C52D411AF5000A0C9EAA3B96320E4@wtntex1.baea.com.au> The O'Reilly reference: Learning Python -----Original Message----- From: BELSEY, Dylan [mailto:dylan.belsey@baesystems.com] Sent: Tuesday, 13 August 2002 15:30 To: 'Marc French'; tutor@python.org Subject: RE: [Tutor] A simple question Hi Marc, I have been experimenting with this recently and although I don't have the definitive answer, I believe that you can set the PYTHONPATH system variable to the directory where these modules live or place these new modules into the lib directory (not sure if this last one works...may want to verify). These may not be the cleanest ways, so I'm open to criticism from the gurus :) Contrary to previous postings, and this is a personal preference, I found Ivan Van Laningham's SAMS Teach Yourself Python in 24 Hours, to be very helpful. This was actually a topic of discussion today and an O'Reilly book was mentioned (???) if memory serves me correctly. Unfortunately I have deleted the e-mail so you may want to search the archives of this list for today and yesterday. The archive is at: http://mail.python.org/pipermail/tutor/2002-August/date.html I found this relevant e-mail in the archive: http://mail.python.org/pipermail/tutor/2002-August/016309.html I'm sure someone else on the list will be able to give you the complete reference. Dylan -----Original Message----- From: Marc French [mailto:mcfrench69@hotmail.com] Sent: Tuesday, 13 August 2002 04:26 To: tutor@python.org Subject: [Tutor] A simple question Hello, I am having problems importing modules from other parties, ie Scipy and Gnuplot.py. Is there a directory that python is looking in when you import a module? The modules are in C:\Python22\Lib\site-packages & a folder for their respective .py files. I am running python 2.2 with Pythonwin on Windows 2000. I am a Visual Basic programmer. Do you recommend any good python books for someone not use to the command line coming from a visual language? Thanks for your help ahead of time. Marc _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From thomi@thomi.imail.net.nz Tue Aug 13 08:15:33 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Tue, 13 Aug 2002 19:15:33 +1200 Subject: [Tutor] A simple question In-Reply-To: <86C3892A0C52D411AF5000A0C9EAA3B96320E4@wtntex1.baea.com.au> References: <86C3892A0C52D411AF5000A0C9EAA3B96320E4@wtntex1.baea.com.au> Message-ID: <20020813191533.71756729.thomi@thomi.imail.net.nz> this is the way i do it: ----------- #!/usr/bin/python #above line needed in unix like environs only! import sys sys.path[0] = '/home/thomi/custom_python_modules/' #set the above path to the dir where all my custom modules are import thomimodule1 ----------- this does work, ive tried it myself before... sys.path[0] is free, and can be used safely, otherwise you'd have to go: sys.path.append('/home/thomi/custom_python_modules') hope that helps.. On Tue, 13 Aug 2002 16:23:38 +0930 Thus said "BELSEY, Dylan" : > The O'Reilly reference: Learning Python > > > > -----Original Message----- > From: BELSEY, Dylan [mailto:dylan.belsey@baesystems.com] > Sent: Tuesday, 13 August 2002 15:30 > To: 'Marc French'; tutor@python.org > Subject: RE: [Tutor] A simple question > > > Hi Marc, > I have been experimenting with this recently and although I > don't > have the definitive answer, I believe that you can set the PYTHONPATH > system variable to the directory where these modules live or place > these new modules into the lib directory (not sure if this last one > works...may want to verify). These may not be the cleanest ways, so > I'm open to criticism from the gurus :) > Contrary to previous postings, and this is a personal > preference, I > found Ivan Van Laningham's SAMS Teach Yourself Python in 24 Hours, to > be very helpful. This was actually a topic of discussion today and an > O'Reilly book was mentioned (???) if memory serves me correctly. > Unfortunately I have deleted the e-mail so you may want to search the > archives of this list for today and yesterday. The archive is at: > http://mail.python.org/pipermail/tutor/2002-August/date.html > I found this relevant e-mail in the archive: > > http://mail.python.org/pipermail/tutor/2002-August/016309.html > > I'm sure someone else on the list will be able to give you the > complete reference. > > Dylan > > -----Original Message----- > From: Marc French [mailto:mcfrench69@hotmail.com] > Sent: Tuesday, 13 August 2002 04:26 > To: tutor@python.org > Subject: [Tutor] A simple question > > > Hello, > I am having problems importing modules from other parties, ie Scipy > and Gnuplot.py. Is there a directory that python is looking in when > you import a > > module? The modules are in C:\Python22\Lib\site-packages & a folder > for their respective .py files. > I am running python 2.2 with Pythonwin on Windows 2000. > I am a Visual Basic programmer. Do you recommend any good python books > for someone not use to the command line coming from a visual language? > Thanks for your help ahead of time. > Marc > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- "Avoid the Gates of Hell. Use Linux" Thomi Richards, thomi@imail.net.nz From lumbricus@gmx.net Tue Aug 13 08:33:53 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Tue, 13 Aug 2002 09:33:53 +0200 (MEST) Subject: [Tutor] A simple question References: <20020813191533.71756729.thomi@thomi.imail.net.nz> Message-ID: <931.1029224033@www58.gmx.net> Hi! > this is the way i do it: > > ----------- > #!/usr/bin/python > > #above line needed in unix like environs only! > > import sys > > sys.path[0] = '/home/thomi/custom_python_modules/' > > #set the above path to the dir where all my custom modules are > > import thomimodule1 > > ----------- > > this does work, ive tried it myself before... sys.path[0] is free, and Yes: >>> sys.path[0] '' >>> But _why_? Has anybody an explanation? > can be used safely, otherwise you'd have to go: > > sys.path.append('/home/thomi/custom_python_modules') > > hope that helps.. [ TOFU snipped ] puzzled greetings, J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From thomi@thomi.imail.net.nz Tue Aug 13 08:46:13 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Tue, 13 Aug 2002 19:46:13 +1200 Subject: [Tutor] A simple question In-Reply-To: <931.1029224033@www58.gmx.net> References: <20020813191533.71756729.thomi@thomi.imail.net.nz> <931.1029224033@www58.gmx.net> Message-ID: <20020813194613.2d5defb7.thomi@thomi.imail.net.nz> well, when python looks for modules to import, it scans through all the directories in the sys.path string.... more than that i cannot tell you... :-) On Tue, 13 Aug 2002 09:33:53 +0200 (MEST) Thus said lumbricus@gmx.net: > Hi! > > > this is the way i do it: > > > > ----------- > > #!/usr/bin/python > > > > #above line needed in unix like environs only! > > > > import sys > > > > sys.path[0] = '/home/thomi/custom_python_modules/' > > > > #set the above path to the dir where all my custom modules are > > > > import thomimodule1 > > > > ----------- > > > > this does work, ive tried it myself before... sys.path[0] is free, > > and > > Yes: > >>> sys.path[0] > '' > >>> > But _why_? > Has anybody an explanation? > > > can be used safely, otherwise you'd have to go: > > > > sys.path.append('/home/thomi/custom_python_modules') > > > > hope that helps.. > > [ TOFU snipped ] > > puzzled greetings, > J"o! > > -- > > -- > GMX - Die Kommunikationsplattform im Internet. > http://www.gmx.net > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- This message was brought to you by one bored guy, with nothing better to do, And the letter Q. Thomi Richards, thomi@imail.net.nz From scot@possum.in-berlin.de Tue Aug 13 09:51:43 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Tue, 13 Aug 2002 10:51:43 +0200 Subject: [Tutor] understanding classes In-Reply-To: <3D5835C7.2060506@aon.at> References: <3D5835C7.2060506@aon.at> Message-ID: <200208131051.43173.scot@possum.in-berlin.de> Hello Gregor, > So we don't call the first parameter of > the jump - method zwrtlbrnft (which is > 1. hard to remember for someone who is not > from Munich and I can't find "zwrtlbrnft" except in this paragraph, and tho I have been in Munich, I am completely baffled at what it could mean - no doubt some secret Bavarian code to get back at us Prussians for the Austrian War of Succession (1740 to 1748) before German general elections, with the aim to have Stoiber not only voted chancellor, but also crowned as the first Bavarian emperor since Karl Albert... Paranoia aside, I like the code and think it would have helped me understand 'self' a lot quicker. My only worry would be that you need quite a few packages - Tkinter and turtle - instead of being able to do it with "core" python. Y, Scot -- Scot W. Stevenson wrote this on Tuesday, 13. Aug 2002 in Berlin, Germany on his happy little Linux system that has been up for 1351 hours and has a CPU that is falling asleep at a system load of 0.40. From scot@possum.in-berlin.de Tue Aug 13 09:27:14 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Tue, 13 Aug 2002 10:27:14 +0200 Subject: [Tutor] Generating sigs with Python for fun and education In-Reply-To: <29836.1029190777@www5.gmx.net> References: <200208121254.44192.scot@possum.in-berlin.de> <29836.1029190777@www5.gmx.net> Message-ID: <200208131027.14304.scot@possum.in-berlin.de> Hello J"o, > You know about fortune? Yes, but the entries can be terribly long sometimes, everybody has it, and I don't feel like rewriting it in Python just yet =8). Somehow I like the idea of a signature that is generated new for every email better than one that is just stuff pulled out of a can... The frustrating part is that I don't have a permanent online connection, so I can't include the current weather or some other stuff I could grab from a webpage... > >>> time.strftime("%A", time.localtime(time.time())) Ah, thank you. That and Danny Yoo's line.center() hint clean the code up nicely... Y, Scot -- Scot W. Stevenson wrote this on Tuesday, 13. Aug 2002 in Berlin, Germany on his happy little Linux system that has been up for 1351 hours and has a CPU that is falling asleep at a system load of 0.15. From scot@possum.in-berlin.de Tue Aug 13 10:08:50 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Tue, 13 Aug 2002 11:08:50 +0200 Subject: [Tutor] The mailer software is blocking a post of mine Message-ID: <200208131108.50703.scot@possum.in-berlin.de> Hi there, I'm trying to post a message on the tutor@python.org list with the subject "High level file handling in the rain", and what I keep getting back is ============================================ ----- The following addresses had permanent fatal errors ----- (reason: 550-spam not wanted here) ----- Transcript of session follows ----- ... while talking to mail.python.org.: >>> DATA <<< 550-spam not wanted here <<< 550 (subject line includes "ADV" or "HGH") 554 5.0.0 Service unavailable ============================================= I don't see a "adv" in the subject line, and the only "hgh" has an "i" smack in the middle of it (does it block songs by The Doors, too?). I'll try to post it under a different subject line; if that doesn't work, could somebody tell me what the SMTP problem really is? Y, Scot -- Scot W. Stevenson wrote me on Tuesday, 13. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1352 hours and has a CPU that is underemployed at a system load of 1.08. From scot@possum.in-berlin.de Tue Aug 13 10:11:34 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Tue, 13 Aug 2002 11:11:34 +0200 Subject: [Tutor] I am a friendly inoffensive non-commercial subject line Message-ID: <200208130215.46296.scot@possum.in-berlin.de> [This did have the subject line "High level file handling in the rain" but the SMTP mail dragon at mail.python.org didn't like that] Hi there, While wading thru the rain that is slowly turning most of Central Europe into one big lake, my mind went from water ditches to water pipes to FIFO pipes to file handeling, and I finally realized why I have always felt that there is something fishy about the way Python handles files: It seems so low-level to me, so downright gutteresque compared with everything else. Let me explain while I'm waiting for my hair to dry (not to mention the cat). The current high-level file commands force you to deal with a class of questions that the Python Elves usually keep submerged: You have to /open/ the things, and you even have to tell the Elves is it is a file you only want to read from, or maybe write to, and if you think it is binary, which is sort of like having to decide beforehand if the variable 'lifejacket' is going to be an integer or a (groan) float. Even worse, this information is transfered by magic characters like 'r+', 'br', 'a+', which is not the way Python usually does stuff. Even worse, you seem to need different magic depending on which operating system you use, because Windows and Macs don't do files the same way that Unix does. Then you have a bunch of methods that only really make sense if you know how hard disks physically operate: /seek/ - A synonym for 'search'. So does "filename.seek(0)" search for the occurence of the number 0 in the file and return the position? (the user shouldn't be forced to know what a 'head seek' is to read stuff) /flush/ - But I always do! No, wait - the docs say this is for "buffers", so it probably is used by blond female teenagers to pound wooden stakes into vampires. (the user should not be forced to deal with buffers on the highest level) /tell/ - The docs say that this gives me "the file's position", which is strange, because it should be on the harddisk in '/home/scot/python/' (more 'head seek' hardware stuff) And so on. After you've done all of that, you are supposed to 'close' a file, which is sort of like asking me to call a destructor or run the garbage collector by hand. Look, let's face it: If we wanted to be forced to clean up after ourselves, we would a) still be living with our parents and b) would use C or some other low(er) level language, not Python. Note that 'open', 'seek', 'tell', 'flush', and 'close' are terribly general verbs and don't give you any hint that you are working with a file (though 'open' has been replaced by 'file' in Python 2.2). This is a whole different nomenclature compared with the usual Python objects: If a file is a sequence of characters or bytes or whatnot, why can't I splice files with [n:m] to get a bunch of lines or use the normal [n] to index a certain byte like I can with everything else? Of course it's good to have the choice of low-level, byte-by-byte control, but that is what the os module is for. The top level, inbuilt commands should protect the casual user from all of this - at least it does with everything else, including division. I realize that when Python was being invented, throwing a thin wrapper around the C functions that everybody involved knew was a good idea to just be able to move on to more important stuff, but it still is just a thin wrapper that exposes all of the squishy, wet, slimy C bits I don't really want to know about. (And to think a week ago I was worried about the grass not getting enough water.) Just for the entertainment value, and because the cat is still throwing her wet body against my leg, what would be wrong with the following file handling system: We recognize two different types of flies: 1) "Normal" files which consist of lines, in other words, of strings. This gives us strings that are sequences of characters and files that are sequences of strings, a nice pyramid. We'll use the 'file'-keyword for this type. 2) "Binary" files which consist of bytes. Note that every 'normal' file can be accessed as a binary file, but the reverse is not true. We'll use the 'binfile'-keyword for this type. Now when we want to access a file, we don't "open" it - that's the Elves' job - we just get right down to it: filehandle = file('/home/scot/python/wetcat.text') or binhandle = binfile('flooddata.dat') With this type of file, we can iterate, splice, or index the content without having to explicitly tell the Elves that we want to read or write or whatnot: >>>filehandle[2] 'drip drip drip' >>>filehandle[0:2] ['drip', 'drip drip'] >>>binhandle[2] 4 >>>binhandle[0:2] (1, 2) (Or maybe both should return lists, I'm not sure what would be better). Since we have direct (random) access with splices and indices, we don't need to 'seek' and 'tell' anymore, and we progress string by string or byte by byte with iteration. Stuff like 'flush' and 'close' is Elves' work. Still, you'd want to keep the following methods: one_string = file('damp.txt').read() all_strings_as_a_list = file('damp.txt').readall() one_byte = binfile('humidity.dat').read() all_bytes_as_a_list_or_tuple = binfile('humidity.dat').readall() You also probably want to keep '.readline()' and '.readlines()' around as synonyms. Reading is easy; writing gets you into trouble, because you don't want to go around casually overwriting files the way you do variables. There are four cases: 1) File exists: Overwrite anyway 2) File exists: Raise error 3) File doesn't exist: Make new file, write 4) File doesn't exist: Raise error For example, we could define filename.forcewrite(data): 1 + 3 filename.writenew(data): 2 + 3 filename.overwrite(data): 2 + 4 or whatever combination seems to make sense. Other useful methods we can just steal from the 'list' type: append, insert, replace, index, remove... The idea behind this is that newbies don't have to take a crash course in hard disk mechanics, don't have to memorize magic characters that look like ex commands, don't have to decide beforehand if they want to read and write, don't have to close stuff afterwards, and can just access files in the same way they would a list or any other sequence. So instead of outputfile = open('poldern.txt', 'w') inputfile = open('floodgates.txt', 'r+'): for line in inputfile: outputfile.write(line) outputfile.close() inputfile.close() you'd have for line in file('floodgates.txt'): file('poldern.txt').append(line) Now doesn't that look a lot cleaner? /Watered down/, so to speak... Okay, this is probably more than enough gushing from me today, and the cat has gone asleep. I'd be interested to hear what the people with more experience in design concepts and low-level file handling think of this - or if it is just me who thinks that the current way of doing things is not quite as high level as the rest of the language is. Dry feet to all, Y, Scot -- Scot W. Stevenson wrote this on Tuesday, 13. Aug 2002 in Berlin, Germany on his happy little Linux system that has been up for 1342 hours and has a CPU that is falling asleep at a system load of 0.76. From lumbricus@gmx.net Tue Aug 13 10:18:12 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Tue, 13 Aug 2002 11:18:12 +0200 (MEST) Subject: [Tutor] Generating sigs with Python for fun and education References: <200208131027.14304.scot@possum.in-berlin.de> Message-ID: <23677.1029230292@www9.gmx.net> > Hello J"o, > > > You know about fortune? > > Yes, but the entries can be terribly long sometimes, It also has an option (-c IIRC) to produce four(or so)-liners. > Y, Scot HTH,HAND J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From thomi@thomi.imail.net.nz Tue Aug 13 10:20:47 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Tue, 13 Aug 2002 21:20:47 +1200 Subject: [Tutor] Generating sigs with Python for fun and education In-Reply-To: <23677.1029230292@www9.gmx.net> References: <200208131027.14304.scot@possum.in-berlin.de> <23677.1029230292@www9.gmx.net> Message-ID: <20020813212047.70c68776.thomi@thomi.imail.net.nz> or what about signify?? it's easy to set up, and uses a FIFO, so its a different signature on each email, and you make the signatures up yourself... tons of features, i'd recommend it to anyone :-) (its what im using) On Tue, 13 Aug 2002 11:18:12 +0200 (MEST) Thus said lumbricus@gmx.net: > > Hello J"o, > > > > > You know about fortune? > > > > Yes, but the entries can be terribly long sometimes, > > It also has an option (-c IIRC) to produce four(or so)-liners. > > > Y, Scot > > HTH,HAND > J"o! > > -- > > -- > GMX - Die Kommunikationsplattform im Internet. > http://www.gmx.net > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- Thomi Richards thomi@imail.net.nz http://ddmodd.sourceforge.net/ Thomi Richards, thomi@imail.net.nz From glingl@aon.at Tue Aug 13 11:12:07 2002 From: glingl@aon.at (Gregor Lingl) Date: Tue, 13 Aug 2002 12:12:07 +0200 Subject: [Tutor] local variables Message-ID: <3D58DB77.3010900@aon.at> Hi! Please look at the following interactive session: >>> x = 5 >>> def test(): print x >>> test() 5 >>> def test(): print x x = x + 1 >>> test() Traceback (most recent call last): File "", line 1, in ? test() File "", line 2, in test print x UnboundLocalError: local variable 'x' referenced before assignment ##### So the python interpreter has some knowledge about the existence of x ##### This seems to be established with the execution of the def-statement (?) >>> def test(): print vars() x = 1 print x x = x + 1 print vars() >>> test() {} 1 {'x': 2} >>> ##### But this knowledge apparently doesn't show up in vars(). My question: is there a function, an attribute, or whatever, that delivers the fact, that x is a local variable at a point of execution where the assignment still hasn't taken place? Or - in other words - that delivers a list of all local variables - including those which still haven't got assigned a value? Gregor From glingl@aon.at Tue Aug 13 11:50:49 2002 From: glingl@aon.at (Gregor Lingl) Date: Tue, 13 Aug 2002 12:50:49 +0200 Subject: [Tutor] understanding classes References: <3D5835C7.2060506@aon.at> <200208131051.43173.scot@possum.in-berlin.de> Message-ID: <3D58E489.9000807@aon.at> Scot W. Stevenson schrieb: >Hello Gregor, > > > >>So we don't call the first parameter of >>the jump - method zwrtlbrnft (which is >>1. hard to remember for someone who is not >>from Munich and >> >> > >I can't find "zwrtlbrnft" except in this paragraph, and tho I have been in >Munich, I am completely baffled at what it could mean - > Oh - you bad one! You certainly know that this was a bug! Here the correct version: SCHUTZMANN: Warum haben sie die schweren Steine an ihr Rad gebunden? VALENTIN: Damit ich bei Gegenwind leichter fahre ... SCHUTZMANN: Wie heißen Sie denn? VALENTIN: Wrdlbrmpfd SCHUTZMANN: Wie? VALENTIN: Wrdlbrmpfd SCHUTZMANN: Wadlstrumpf? VALENTIN: Wr - dl - brmpfd What a mess! I'll have to correct a big bunch of code ... By the way, this is well known not only in Germany: http://www.theaterwuerzburg.de/aktuell.htm (this one fits to your "paranoia") but even in Portugal: http://www1.terravista.pt/Baiagatas/9186/prjcts_rlzds.html >no doubt some >secret Bavarian code to get back at us Prussians for the Austrian War of >Succession (1740 to 1748) before German general elections, with the aim to >have Stoiber not only voted chancellor, but also crowned as the first >Bavarian emperor since Karl Albert... > >Paranoia aside, I like the code and think it would have helped me >understand 'self' a lot quicker. My only worry would be that you need >quite a few packages - Tkinter and turtle - instead of being able to do it >with "core" python. > > For me that doesn't matter, as I thought it out for kids who already are experienced turtle-users. And - as I tried to point out - there is the advantage of really seeing the objects at work. Have a nice day Gregor >Y, Scot > > > From kent@springfed.com Tue Aug 13 13:09:01 2002 From: kent@springfed.com (kent@springfed.com) Date: Tue, 13 Aug 2002 07:09:01 -0500 Subject: [Tutor] Re: Python + editor In-Reply-To: <20020813003334.GB14636@dman.ddts.net> Message-ID: <20020813121001.76D1E13914@bucky.airstreamcomm.net> >| What are you guys using for editing your python files on= Linux? Leo .. Literate Editor with Outlines . On Sourceforge, written in pure Python. Leo home; http://personalpages.tds.net/~edream/front.html Leo User's guide;= http://personalpages.tds.net/~edream/leo_TOC.html#anchor964914 Support forum on Sourceforge;= http://sourceforge.net/forum/forum.php?forum_id=3D10226 From sarmstrong13@mac.com Tue Aug 13 13:59:48 2002 From: sarmstrong13@mac.com (SA) Date: Tue, 13 Aug 2002 07:59:48 -0500 Subject: [Tutor] Regex help please. In-Reply-To: Message-ID: On 8/12/02 11:30 PM, "Sean 'Shaleh' Perry" wrote: > > On 12-Aug-2002 SA wrote: >> Hi Everyone- >> >> I am trying to match a string pattern like the following: >> >> ?1234.htm >> >> I would then like to extract the 1234 from the pattern and sub 1234.html for >> the pattern. >> >> >> Anyone know how to do this? Is there a simpler way than re? >> > > so 1234.htm becomes 1234.html.htm? > I'm sorry. That is not what I meant. Let's say I have an html document. In this document is a bunch of links. Each of these links is comprised of similar but variable patterns: ?1234.htm ?56.htm ?0154398.htm Notice the only difference in these characters is the number and length of the number. If you have already guessed, these links were generated dynamically with a ? Search pattern. (Hence the ? In each) What I would like to do is search the whole html document for any link that begins with ?, has a variable number in the middle, followed by a .htm. I would then like to substitute the whole string (ie. ?1234.htm) for the number and a .html (ie. 1234.html). For example: ?1234.htm would become 1234.html ?56.htm would become 56.html ?0154398.htm would become 0154398.html And so on ... So what I have done so far is the following: import re import os list = os.listdir('.') #lists all html documents in this directory input = open(list[0], "rb") #this will be changed to iterate over the list text = input.read() p = re.compile("\?(\d+).htm", re.M) result = p.match(text) Now the last two line were written to test the search pattern "\?(\d+).htm". This will be changed to something like re.sub("\?(\d+).htm","\\1.html",text) later to do onestep swapping. But my problem is that I get the following output: >>>print result None So it seems like it is not traversing the file text and matching the pattern. So with this said, any ideas what I'm doing wrong? Thanks in advance. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From Nicole.Seitz@urz.uni-hd.de Tue Aug 13 17:14:44 2002 From: Nicole.Seitz@urz.uni-hd.de (Nicole Seitz) Date: Tue, 13 Aug 2002 16:14:44 +0000 Subject: [Tutor] Regex help please. In-Reply-To: References: Message-ID: <200208131614.44357.Nicole.Seitz@urz.uni-hd.de> > > import re > import os > > list =3D os.listdir('.') #lists all html documents in this directory > input =3D open(list[0], "rb") #this will be changed to iterate over the= list > text =3D input.read() > p =3D re.compile("\?(\d+).htm", re.M) > result =3D p.match(text) > > > Now the last two line were written to test the search pattern > "\?(\d+).htm". This will be changed to something like > re.sub("\?(\d+).htm","\\1.html",text) later to do onestep swapping. > > But my problem is that I get the following output: > >>>print result > > None > > > So it seems like it is not traversing the file text and matching the > pattern. The 'match' function tries to match a pattern against the BEGINNING of a = given=20 string. So, you have to use 'search' or 'findall'. See http://py-howto.sourceforge.net/regex/node22.html Hope this helps! Nicole From rickp@telocity.com Tue Aug 13 14:40:04 2002 From: rickp@telocity.com (rickp@telocity.com) Date: Tue, 13 Aug 2002 09:40:04 -0400 Subject: [Tutor] python classes and mysql Message-ID: <20020813134004.GJ8720@tc.niof.net> If I create multiple classes in python to deal with different aspects of a program and each of those classes needs to access mysql what is the best way of handling connections/cursors? 1) Each class opens a connection and creates a cursor. 2) The toplevel opens a connection which is passed to the class which then creates a cursor. 3) The toplevel opens a connection and creates a cursor which is passed to the class. -- "Cream rises to the top. So does fat." -- Kelvin Throop III Rick Pasotto rickp@telocity.com http://www.niof.net From rob@uselesspython.com Tue Aug 13 15:00:44 2002 From: rob@uselesspython.com (Rob) Date: Tue, 13 Aug 2002 09:00:44 -0500 Subject: low-level file handling implementation considered non-pyhonic WAS RE: [Tutor] I am a friendly inoffensive non-commercial subject line In-Reply-To: <200208130215.46296.scot@possum.in-berlin.de> Message-ID: I find your perspective on this subject generally agreeable, since file handling in Python has seemed less Pythonic to me than a good amount of other material. I'd rather use statements that *feel* more like other Python statements I use to do other general-purpose tasks. I think handling files at a reasonably low level is a virtue, though, as long as the implementation makes sense. Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > Scot W. Stevenson > Sent: Tuesday, August 13, 2002 4:12 AM > To: tutor@python.org > Cc: postmaster@python.org > Subject: [Tutor] I am a friendly inoffensive non-commercial subject line > > > [This did have the subject line "High level file handling in the > rain" but > the SMTP mail dragon at mail.python.org didn't like that] > > Hi there, > > While wading thru the rain that is slowly turning most of Central Europe > into one big lake, my mind went from water ditches to water pipes to FIFO > pipes to file handeling, and I finally realized why I have always felt > that there is something fishy about the way Python handles files: > It seems > so low-level to me, so downright gutteresque compared with everything > else. Let me explain while I'm waiting for my hair to dry (not to mention > the cat). > > The current high-level file commands force you to deal with a class of > questions that the Python Elves usually keep submerged: You have > to /open/ > the things, and you even have to tell the Elves is it is a file you only > want to read from, or maybe write to, and if you think it is > binary, which > is sort of like having to decide beforehand if the variable 'lifejacket' > is going to be an integer or a (groan) float. Even worse, this > information > is transfered by magic characters like 'r+', 'br', 'a+', which is not the > way Python usually does stuff. Even worse, you seem to need different > magic depending on which operating system you use, because Windows and > Macs don't do files the same way that Unix does. > > Then you have a bunch of methods that only really make sense if you know > how hard disks physically operate: > > /seek/ - A synonym for 'search'. So does "filename.seek(0)" > search for the > occurence of the number 0 in the file and return the position? (the user > shouldn't be forced to know what a 'head seek' is to read stuff) > > /flush/ - But I always do! No, wait - the docs say this is for "buffers", > so it probably is used by blond female teenagers to pound wooden stakes > into vampires. (the user should not be forced to deal with buffers on the > highest level) > > /tell/ - The docs say that this gives me "the file's position", which is > strange, because it should be on the harddisk in '/home/scot/python/' > (more 'head seek' hardware stuff) > > And so on. After you've done all of that, you are supposed to 'close' a > file, which is sort of like asking me to call a destructor or run the > garbage collector by hand. Look, let's face it: If we wanted to be forced > to clean up after ourselves, we would a) still be living with our parents > and b) would use C or some other low(er) level language, not Python. > > Note that 'open', 'seek', 'tell', 'flush', and 'close' are > terribly general > verbs and don't give you any hint that you are working with a > file (though > 'open' has been replaced by 'file' in Python 2.2). This is a whole > different nomenclature compared with the usual Python objects: If a file > is a sequence of characters or bytes or whatnot, why can't I splice files > with [n:m] to get a bunch of lines or use the normal [n] to index a > certain byte like I can with everything else? > > Of course it's good to have the choice of low-level, byte-by-byte > control, > but that is what the os module is for. The top level, inbuilt commands > should protect the casual user from all of this - at least it does with > everything else, including division. I realize that when Python was being > invented, throwing a thin wrapper around the C functions that everybody > involved knew was a good idea to just be able to move on to more > important > stuff, but it still is just a thin wrapper that exposes all of the > squishy, wet, slimy C bits I don't really want to know about. > > (And to think a week ago I was worried about the grass not getting enough > water.) > > Just for the entertainment value, and because the cat is still > throwing her > wet body against my leg, what would be wrong with the following file > handling system: > > We recognize two different types of flies: > > 1) "Normal" files which consist of lines, in other words, of > strings. This > gives us strings that are sequences of characters and files that are > sequences of strings, a nice pyramid. We'll use the 'file'-keyword for > this type. > > 2) "Binary" files which consist of bytes. Note that every > 'normal' file can > be accessed as a binary file, but the reverse is not true. We'll use the > 'binfile'-keyword for this type. > > Now when we want to access a file, we don't "open" it - that's the Elves' > job - we just get right down to it: > > filehandle = file('/home/scot/python/wetcat.text') or > binhandle = binfile('flooddata.dat') > > With this type of file, we can iterate, splice, or index the content > without having to explicitly tell the Elves that we want to read or write > or whatnot: > > >>>filehandle[2] > 'drip drip drip' > >>>filehandle[0:2] > ['drip', 'drip drip'] > > >>>binhandle[2] > 4 > >>>binhandle[0:2] > (1, 2) > > (Or maybe both should return lists, I'm not sure what would be better). > > Since we have direct (random) access with splices and indices, we don't > need to 'seek' and 'tell' anymore, and we progress string by string or > byte by byte with iteration. Stuff like 'flush' and 'close' is Elves' > work. Still, you'd want to keep the following methods: > > one_string = file('damp.txt').read() > all_strings_as_a_list = file('damp.txt').readall() > > one_byte = binfile('humidity.dat').read() > all_bytes_as_a_list_or_tuple = binfile('humidity.dat').readall() > > You also probably want to keep '.readline()' and '.readlines()' around as > synonyms. Reading is easy; writing gets you into trouble, because you > don't want to go around casually overwriting files the way you do > variables. There are four cases: > > 1) File exists: Overwrite anyway > 2) File exists: Raise error > 3) File doesn't exist: Make new file, write > 4) File doesn't exist: Raise error > > For example, we could define > > filename.forcewrite(data): 1 + 3 > filename.writenew(data): 2 + 3 > filename.overwrite(data): 2 + 4 > > or whatever combination seems to make sense. Other useful methods we can > just steal from the 'list' type: append, insert, replace, index, > remove... > > The idea behind this is that newbies don't have to take a crash course in > hard disk mechanics, don't have to memorize magic characters that look > like ex commands, don't have to decide beforehand if they want to > read and > write, don't have to close stuff afterwards, and can just access files in > the same way they would a list or any other sequence. > > So instead of > > outputfile = open('poldern.txt', 'w') > inputfile = open('floodgates.txt', 'r+'): > for line in inputfile: > outputfile.write(line) > outputfile.close() > inputfile.close() > > you'd have > > for line in file('floodgates.txt'): > file('poldern.txt').append(line) > > Now doesn't that look a lot cleaner? /Watered down/, so to speak... > > Okay, this is probably more than enough gushing from me today, > and the cat > has gone asleep. I'd be interested to hear what the people with more > experience in design concepts and low-level file handling think of this - > or if it is just me who thinks that the current way of doing > things is not > quite as high level as the rest of the language is. > > Dry feet to all, > Y, Scot > > -- > Scot W. Stevenson wrote this on Tuesday, 13. Aug 2002 in > Berlin, Germany > on his happy little Linux system that has been up for 1342 hours > and has a CPU that is falling asleep at a system load of 0.76. > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From sarmstrong13@mac.com Tue Aug 13 16:23:48 2002 From: sarmstrong13@mac.com (SA) Date: Tue, 13 Aug 2002 10:23:48 -0500 Subject: [Tutor] python classes and mysql In-Reply-To: <20020813134004.GJ8720@tc.niof.net> Message-ID: On 8/13/02 8:40 AM, "rickp@telocity.com" wrote: > If I create multiple classes in python to deal with different aspects of > a program and each of those classes needs to access mysql what is the > best way of handling connections/cursors? > > 1) Each class opens a connection and creates a cursor. > 2) The toplevel opens a connection which is passed to the class which > then creates a cursor. > 3) The toplevel opens a connection and creates a cursor which is passed > to the class. How different? >From my 'limited'OOP knowledge, classes should be a collection of similar functions. So you would create an instance and then apply this instance to some 'variable' (mind you I'm using a mathematical sense of the word variable here), or rather the variable is passed to the instance of the class and then worked upon by the class functions (attributes) and out pops your desired result. Think of it as a big machine that your 'variable' enters at one end and out pops your result at the other end and inside the machine is a bunch of 'thingies' (hee, hee....) that manipulate the original 'variable' to produce the final result. So now that I probably mucked that explanation up quite a bit ... The question you must ask yourself, are these classes truly different from each other, or can some of these functions be combined into one class? So if each class is truly different, can you trhow them all together in a module and access them through that on module ( ie. Variable.Classes.class()) ? This would probably fall under category 3). Yet if you combined all the attributes under on class, you would still run the meat of your program at the toplevel. So right away, I would think #1 is incorrect for both. So then the debate comes down to #2 or #3. #2 seems to be more of the threaded route, while #3 seems like there might be a bottleneck waiting for each class to it's bit on the cursor before passing it off. Therefore, I would say that #2 would be the quickest of #2 and #3. Just my $0.02 worth. Good Luck. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From sarmstrong13@mac.com Tue Aug 13 16:52:20 2002 From: sarmstrong13@mac.com (SA) Date: Tue, 13 Aug 2002 10:52:20 -0500 Subject: [Tutor] A simple question In-Reply-To: <20020813194613.2d5defb7.thomi@thomi.imail.net.nz> Message-ID: On 8/13/02 2:46 AM, "Thomi Richards" wrote: I may be wrong on this. But it seems like when I was reading "Learning Python", there was a section on setting up python with a shell script. And I remember one of the directories it said Python looks into is '.'. So I ran this quick script: Import sys for i in range(len(sys.path): sys.path[I] I got the correct libraries where python modules are stored, including ''. So I'm thinking and I can be wrong here, '' is left empty so that Python can load the current directory dynamically. Of course, I'm probably way off base here. Anyone else? Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me > > > well, when python looks for modules to import, it scans through all the > directories in the sys.path string.... more than that i cannot tell > you... > > :-) > > On Tue, 13 Aug 2002 09:33:53 +0200 (MEST) Thus said lumbricus@gmx.net: > >> Hi! >> >>> this is the way i do it: >>> >>> ----------- >>> #!/usr/bin/python >>> >>> #above line needed in unix like environs only! >>> >>> import sys >>> >>> sys.path[0] = '/home/thomi/custom_python_modules/' >>> >>> #set the above path to the dir where all my custom modules are >>> >>> import thomimodule1 >>> >>> ----------- >>> >>> this does work, ive tried it myself before... sys.path[0] is free, >>> and >> >> Yes: >>>>> sys.path[0] >> '' >>>>> >> But _why_? >> Has anybody an explanation? >> >>> can be used safely, otherwise you'd have to go: >>> >>> sys.path.append('/home/thomi/custom_python_modules') >>> >>> hope that helps.. >> >> [ TOFU snipped ] >> >> puzzled greetings, >> J"o! >> >> -- >> >> -- >> GMX - Die Kommunikationsplattform im Internet. >> http://www.gmx.net >> >> >> _______________________________________________ >> Tutor maillist - Tutor@python.org >> http://mail.python.org/mailman/listinfo/tutor > From sarmstrong13@mac.com Tue Aug 13 16:58:16 2002 From: sarmstrong13@mac.com (SA) Date: Tue, 13 Aug 2002 10:58:16 -0500 Subject: [Tutor] A simple question In-Reply-To: Message-ID: On 8/12/02 1:25 PM, "Marc French" wrote: > I am running python 2.2 with Pythonwin on Windows 2000. > I am a Visual Basic programmer. Do you recommend any good python books for > someone not use to the command line coming from a visual language? My first suggestion is Learning Python published by O'Reilly. That book was weel thought out and organized so that even a newbie like myself could understand. It also has the best example of Classes I've seen yet. Then, there is a plethora of tutorials on the net that can take you farther. Good Luck. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From ATrautman@perryjudds.com Tue Aug 13 17:06:21 2002 From: ATrautman@perryjudds.com (Alan Trautman) Date: Tue, 13 Aug 2002 11:06:21 -0500 Subject: [Tutor] python classes and mysql Message-ID: <0BA95581EDA7D611841B00A0C9AD25DD2B580F@mail.pjinet.com> Ok another .02USD worth. The DB handling functions are usually better left in one class object and are a good thing to put in a class IMO. This allows easy changes to the DB connections and structure, i.e. if the location or password changes the same connection string is used. In addition by putting insert and creation info in one location changes are much easier than trying to remember which classes contain what. The final benefit being that if you decide to support more than one database type you can simply insert the new database connection class to handle all of the differences without losing the original functionality. This also works well for simple test environments where a simple copy is made only the DB name constant needs to be changed to support testing. Just my thoughts Alan -----Original Message----- From: SA [mailto:sarmstrong13@mac.com] Sent: Tuesday, August 13, 2002 10:24 AM To: rickp@telocity.com; tutor@python.org Subject: Re: [Tutor] python classes and mysql On 8/13/02 8:40 AM, "rickp@telocity.com" wrote: > If I create multiple classes in python to deal with different aspects of > a program and each of those classes needs to access mysql what is the > best way of handling connections/cursors? > > 1) Each class opens a connection and creates a cursor. > 2) The toplevel opens a connection which is passed to the class which > then creates a cursor. > 3) The toplevel opens a connection and creates a cursor which is passed > to the class. How different? >From my 'limited'OOP knowledge, classes should be a collection of similar functions. So you would create an instance and then apply this instance to some 'variable' (mind you I'm using a mathematical sense of the word variable here), or rather the variable is passed to the instance of the class and then worked upon by the class functions (attributes) and out pops your desired result. Think of it as a big machine that your 'variable' enters at one end and out pops your result at the other end and inside the machine is a bunch of 'thingies' (hee, hee....) that manipulate the original 'variable' to produce the final result. So now that I probably mucked that explanation up quite a bit ... The question you must ask yourself, are these classes truly different from each other, or can some of these functions be combined into one class? So if each class is truly different, can you trhow them all together in a module and access them through that on module ( ie. Variable.Classes.class()) ? This would probably fall under category 3). Yet if you combined all the attributes under on class, you would still run the meat of your program at the toplevel. So right away, I would think #1 is incorrect for both. So then the debate comes down to #2 or #3. #2 seems to be more of the threaded route, while #3 seems like there might be a bottleneck waiting for each class to it's bit on the cursor before passing it off. Therefore, I would say that #2 would be the quickest of #2 and #3. Just my $0.02 worth. Good Luck. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From l.oluyede@virgilio.it Tue Aug 13 17:21:16 2002 From: l.oluyede@virgilio.it (Lawrence Oluyede) Date: Tue, 13 Aug 2002 18:21:16 +0200 Subject: [Tutor] python classes and mysql In-Reply-To: <20020813134004.GJ8720@tc.niof.net> Message-ID: <5.1.1.6.0.20020813182059.00a73d10@in.virgilio.it> At 15.40 13/08/2002, rickp@telocity.com wrote: >If I create multiple classes in python to deal with different aspects of >a program and each of those classes needs to access mysql what is the >best way of handling connections/cursors? I think you can use multiple threads and handling the locking of mysql by them. Create a daemon and pass the data along your classes (use the 2 or 3). >1) Each class opens a connection and creates a cursor. >2) The toplevel opens a connection which is passed to the class which > then creates a cursor. >3) The toplevel opens a connection and creates a cursor which is passed > to the class. -- Lawrence Oluyede http://www26.brinkster.com/rhymes From sarmstrong13@mac.com Tue Aug 13 17:31:07 2002 From: sarmstrong13@mac.com (SA) Date: Tue, 13 Aug 2002 11:31:07 -0500 Subject: [Tutor] python classes and mysql In-Reply-To: <0BA95581EDA7D611841B00A0C9AD25DD2B580F@mail.pjinet.com> Message-ID: On 8/13/02 11:06 AM, "Alan Trautman" wrote: > Ok another .02USD worth. > > The DB handling functions are usually better left in one class object and > are a good thing to put in a class IMO. This allows easy changes to the DB > connections and structure, i.e. if the location or password changes the same > connection string is used. In addition by putting insert and creation info > in one location changes are much easier than trying to remember which > classes contain what. The final benefit being that if you decide to support > more than one database type you can simply insert the new database > connection class to handle all of the differences without losing the > original functionality. This also works well for simple test environments > where a simple copy is made only the DB name constant needs to be changed to > support testing. > This would work even better. Thanks Alan. So instead of having the connections at the toplevel. You wish to make a class specifically for handling connections(generic so diff. Dbs can be used). And the other class will handle all of the db calls? Is this correct? This is why I like OOP. It makes it easier to build different little 'engines' to perform complex tasks on different input. Thanks Again. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From runsun@bilbo.bio.purdue.edu Tue Aug 13 17:37:43 2002 From: runsun@bilbo.bio.purdue.edu (runsun) Date: Tue, 13 Aug 2002 11:37:43 -0500 Subject: [Tutor] Need bsddb/recno examples In-Reply-To: <20020813135626.18628.39580.Mailman@mail.python.org> Message-ID: Hi all, I've been trying hard to search for the information of using the recno-type database in the bsddb module without any luck. Could someone help on this ??? First of all I have never used any sort of database before. I want to use this as an eazy way to learn and practice ("eazy" means I don't need to install any package). I learned how to use the "b+tree" and "hash" types in the bsddb but couldn't find any instruction or example on the "recno" type. pan ============================================ ~~ Be like water, be shapeless ~~ Runsun Pan, PhD, 773-834-3965 Ecology & Evolution, U of Chicago ============================================ From alan.gauld@bt.com Tue Aug 13 17:55:07 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 13 Aug 2002 17:55:07 +0100 Subject: [Tutor] Python + editor Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C828@mbtlipnt02.btlabs.bt.co.uk> > > > Ctrl+C,ctrl+V :-); > > Vim ain't that hard... > Indeed. Nothing beats yy p . But consider "selling" a python > editor to > some windows people. CTRL+CV rules for them. vim does have a tool bar that has the usual cut n paste buttons. They even work with the windows clipboard... > > > Block selection (ctrl+mouse selection). > There's also Visual mode in Vim > > Can't beat crtl+mouse selection. You can use the mouse to select in vim and the cut n' paste etc all work as expected... After dragging with the mouse select the mode: v = Visual(default) V = Visual Line(whole lines always selected) CTRL [vV] = Visual block > > > Can redefine the print command: > > I'm sure you can do this in vim, I'm just not sure how. Just filter the file or region to any external command using :}! > They have a lot of power, but hidden deep inside a dotfile. Absolutely. Like any powerful tool they aren't really intended for casual amateur use. > OK, we can use gvim but is still hard to do some things like > the print command above. The basic print command is easy redirecting does require memorizing a three character string but you could easily map it to a hot key! > And it seems like a skin thing, not fully integrated. Au contraire, vim is fully integrated with the operating system, its the PC stylec editors that aren't integrated, they are monoliths containing everything internally! > Same goes to emacs-X11. It is a hybrid, it has a lot internally but has access to the OS too. > Sure vim can do a lot of things, but the learning > curve is too steep. Too steep depends on whether the learner expects to be using it much. If they are only learning for occasional use or a one off course then I'd agree and let them use IDLE or Pythonwin. But if they expect to become professionals someday learning vim will repay the effort many many times over! > after some time and u need the work done.Quick. vim does most of the work out of the box (unlike emacs!) My vimrc file is only about 10 lines long, my emacsrc is over 200... > asking how to redefine the print command .Yup, u just lost a > customer while you was looking at the docs.:) But surely redefining the print command is a nonsense, the print command prints. WEhat they really want to do is output to some other output device/format. Thats a Unix philospohy issue not an editor thing... OTOH map ain't so hard to do :-) > You know, life is short.That's why I'm slowly giving up from > things like: > - C/perl ; > - vi/emacs; Life is short thats why I stick to those things, I don't have time to waste on extra keystrokes! > experience, something I'm experimenting right now with > GNU/linux and python.And nedit of course :) . Get a modern Mac. My iBook with Mac OS X has convinced me that Linux has so far to go I can't be bothered waiting! Alan g From alan.gauld@bt.com Tue Aug 13 17:56:36 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 13 Aug 2002 17:56:36 +0100 Subject: [Tutor] duplicate message? Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C829@mbtlipnt02.btlabs.bt.co.uk> I tried to send this but Outlook refused - now you might get multiple copies, in which cae apologies! But just in case here is what it said... -------------------- > Does it recognise when Python is the code being entered? It recognises the .py file extension. Thus if you open a new file it won't know its python code till you save it. But you can switch on the syntax colors manually (by menu) in that case Another good python editor is Scite - it uses the same editing widget as the Pythonwin IDE. I *think* it is available in Linux too. Alan g. Alan Gauld Solutions Designer BT Computing Partners Tel : 0141 220 8795 Fax : 0141 248 1284 Mob : 0771 249 2129 From alan.gauld@bt.com Tue Aug 13 18:05:24 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 13 Aug 2002 18:05:24 +0100 Subject: [Tutor] password,while loops, Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C82A@mbtlipnt02.btlabs.bt.co.uk> > It took me about 20 minutes to write this program(I > dare to call this a program)and it worked ok. Well done! In the interests of good practice you could modify it very slightly as I've shown below. > ======================================================= > password = "foobar" > a=0 > > while password != "unicorn": > print "You've guessed",a,"times." > password = raw_input("Password?:") a=a+1 We don';t need to test if passwd == unicorn coz the while does that for us. Just increment the counter secure that the loop will stop when it needs to. if password=="unicorn": print "Welcome in, you took ", a, "attempts." ################# Now when you come to tackle the second part of the challenge(testing if there were >3 attempts its a little easier because you've separated the getting the count part(inside the lopop) from the display part. In programming its nearly always a good idea to separate displaying results from the calculation part of the program. But your version was perfectly fine since it did do what you wanted. Alan G. From pydan@danshafer.com Tue Aug 13 18:30:17 2002 From: pydan@danshafer.com (Dan Shafer) Date: Tue, 13 Aug 2002 10:30:17 -0700 Subject: [Tutor] Re: A Simple Question Message-ID: <5.1.0.14.0.20020813102824.00b0d740@mail.hurrah.com> Marc French wrote in part: >I am a Visual Basic programmer. Do you recommend any good python books for >someone not use to the command line coming from a visual language? While I wouldn't necessarily reocmmend it for a complete Python newbie, you *might* want to check out PythonCard, a graphical development environment for Python which is under development at the moment. It aspires to bring the ease of programming of VB and HyperCard (thence its name) to the world of Python. Home page for the project is at http://www.pythoncard.org Dan Shafer, Chief Scribe and Tablet Keeper PythonCard Open Source Project http://pythoncard.sourceforge.net From lsloan@umich.edu Tue Aug 13 18:23:58 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Tue, 13 Aug 2002 13:23:58 -0400 Subject: [Tutor] understanding classes In-Reply-To: <3D5835C7.2060506@aon.at> References: <3D5835C7.2060506@aon.at> Message-ID: <6905983.1029245038@[10.0.1.18]> --On Tuesday, August 13, 2002 12:25 AM +0200 Gregor Lingl wrote: > * I claim, that the following explanation > * HELPS the students to develop a > * correct - or at least useful and > * usable mental model of the relationship > * between classes, objects and the role > * of the parameter self. Gregor, That was a nice explanation. I was trying to explain "self" to somebody the other day. I understand it myself, but I wasn't great at articulating it. Your examples are great, especially when Tkinter is available. I have one question: As far as you know, is "self" in Python basically the same as "this" in Java? -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From sarmstrong13@mac.com Tue Aug 13 18:27:09 2002 From: sarmstrong13@mac.com (SA) Date: Tue, 13 Aug 2002 12:27:09 -0500 Subject: [Tutor] Need bsddb/recno examples In-Reply-To: Message-ID: On 8/13/02 11:37 AM, "runsun" wrote: > > Hi all, > > I've been trying hard to search for the information of using > the recno-type database in the bsddb module without any luck. > Could someone help on this ??? > > First of all I have never used any sort of database before. I > want to use this as an eazy way to learn and practice ("eazy" > means I don't need to install any package). > > I learned how to use the "b+tree" and "hash" types in the > bsddb but couldn't find any instruction or example on the > "recno" type. > I'm no expert either, but it would seem to me that recno stands for "record number"? But the only classes I saw in bsddb were (btopen, hashopen, and rnopen, oh yeah and error) So I'm assuming, going out on a long limb here, btopen opens b+tree files, hashopen opens hash files, and rnopen opens DB record file? Ah yes, that is it: http://www.python.org/doc/current/lib/module-bsddb.html So I'm assuming you wish to open DB files? bsddb.rnopen(filename[, flag[, mode[, rnflags[, cachesize[, psize[, lorder[, reclen[, bval[, bfname]]]]]]]]]) should do the trick. Another option you may want to check out is Gadfly. It is totally in Python and makes DB's basesd upon the SQL language. Does not take as much space as MySQL and seems less cryptic. Just my $0.02 worth. Good Luck. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From alan.gauld@bt.com Tue Aug 13 18:25:51 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 13 Aug 2002 18:25:51 +0100 Subject: [Tutor] I am a friendly inoffensive non-commercial subject li ne Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C82B@mbtlipnt02.btlabs.bt.co.uk> > The current high-level file commands force you to deal with a > class of questions that the Python Elves usually keep > submerged: Yep, so maybe there's a reason... > Of course it's good to have the choice of low-level, > byte-by-byte control, but that is what the os module is for. > Python was being invented, throwing a thin wrapper around > the C functions that everybody involved knew was a good idea Actually altho' Python does wrap the C stuff the file methods are very similar to every mainstream programming language around from ADA to Lisp, to Smalltalk... > We recognize two different types of flies: > > 1) "Normal" files which consist of lines, ...text > 2) "Binary" files which consist of bytes. Pascal kind of makes that distinction by having text files as a special category. But binary files are broken into myriad types... FILE OF > Now when we want to access a file, we don't "open" it - > that's the Elves' job - we just get right down to it: > > filehandle = file('/home/scot/python/wetcat.text') or > binhandle = binfile('flooddata.dat') > > With this type of file, we can iterate, splice, or index the content > without having to explicitly tell the Elves that we want to > read or write or whatnot: Thats actually quite tricky to do. Why not try implememting the interface in Python to see whats involved.... I had to build a "generic" file class in C++ once - it grew to well over 1000 lines! One problem is that under the covers you have to figure out predictively what mode to open the raw file in - what does the user want to do with it. Otherwise you have to open/close the file after each operation and keep track of where the last access was etc etc... > >>>filehandle[2] > 'drip drip drip' > >>>filehandle[0:2] > ['drip', 'drip drip'] Not too hard if its text and you assume line by line access rather than characters, binary presumably returns bytes? > Since we have direct (random) access with splices and > indices, we don't need to 'seek' and 'tell' anymore, Ah, but now try implementing that on a binary file. But I guess you could just seek(0) after each operation... or could you? It might depend on the current mode... > Reading is easy; writing gets you into trouble, Yes, especially with indexing type access. BTW Have you looked at the fileinput module which does a little bit of what you want I think.... Alan g. From lsloan@umich.edu Tue Aug 13 19:26:08 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Tue, 13 Aug 2002 14:26:08 -0400 Subject: [Tutor] perl to python translation "phrase book"? Message-ID: <7129756.1029248768@[10.0.1.18]> Anybody know of a nice Perl to Python translation document, preferrably in the form of a "phrase book"? For example, a side-by-side comparison of snippets of Perl code and the Python equivalent. Like this: Perl Python ---- ------ $x = 'abc' x = 'abc' for ($i = 1; $i < 4; $i++) for i in range(1,4): I'm trying to help some programmers used to Perl get started with Python. -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From sarmstrong13@mac.com Tue Aug 13 19:46:46 2002 From: sarmstrong13@mac.com (SA) Date: Tue, 13 Aug 2002 13:46:46 -0500 Subject: [Tutor] perl to python translation "phrase book"? In-Reply-To: <7129756.1029248768@[10.0.1.18]> Message-ID: On 8/13/02 1:26 PM, "Lance E Sloan" wrote: > Anybody know of a nice Perl to Python translation document, preferrably in > the form of a "phrase book"? With a quick google search, the only thing I could find that was close was the following book: # Perl to Python Migration Addison Wesley, by Martin Brown, November 2001 I have know clue if this will help or not. Good Luck. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From glingl@aon.at Tue Aug 13 22:15:40 2002 From: glingl@aon.at (Gregor Lingl) Date: Tue, 13 Aug 2002 23:15:40 +0200 Subject: [Tutor] understanding classes References: <3D5835C7.2060506@aon.at> <6905983.1029245038@[10.0.1.18]> Message-ID: <3D5976FC.2040505@aon.at> Lance E Sloan schrieb: > > I have one question: As far as you know, is "self" in Python > basically the same as "this" in Java? > As far as I understand it, YES. But there is one important difference: "this" is a token, or name, with this special meaning, (you write this. in Java) whereas self inPython is characterized as a positional argument - in the first position of the agument-list - which could equally well be named wrtlbrmpfd :::-) Maybe someone else can explain this mor accurately Gregor From sarmstrong13@mac.com Tue Aug 13 22:22:47 2002 From: sarmstrong13@mac.com (SA) Date: Tue, 13 Aug 2002 16:22:47 -0500 Subject: [Tutor] Functions and lists. Message-ID: Hi Everyone- Ok. I'm doing something wrong here and need a little nudge in the right direction. I have a script that begins as follows: #!/usr/bin/env python import re import os import sys import string print "Enter Directory: " value = string.strip(sys.stdin.readline()) list = os.listdir("%s" % value) l = len(list) I then have the following function: def input(insource): infile = open(value + insource, "rb") text = infile.read() infile.close() return text In the main namespace I have a iteration that goes like so: for i in range(l): input(list[i]) substr(text) Sorry, substr is another function that does some re on text. The problem lies in the function input. Does return not return 'text' to the top-level namespace so that it can be worked on by the function substr? Because I get the following 'not defined' error: Traceback (most recent call last): File "./remodpyqt.py", line 29, in ? substr(text) NameError: name 'text' is not defined I know this is probably a simple mistake on my end, I would be appreciative of a push in the right direction. Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From scot@possum.in-berlin.de Tue Aug 13 22:28:51 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Tue, 13 Aug 2002 23:28:51 +0200 Subject: [Tutor] New file stuff (formerly inoffensive non-commercial mail) In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C82B@mbtlipnt02.btlabs.bt.co.uk> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C82B@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <200208132328.51572.scot@possum.in-berlin.de> Hello Alan, > Yep, so maybe there's a reason... There usually is. You know, back when I was 17, I knew it all, and ever since then, I seem to have become progressively more stupid =X)... > Actually altho' Python does wrap the C stuff the file > methods are very similar to every mainstream programming > language around from ADA to Lisp, to Smalltalk... Well, yes, but just because it is the way that it has always been done by computer scientists doesn't mean that a different way might not be easier for people who don't tend to start counting with 0. Look at indentation and (new) division, two places where Python is now marching to its own drummer. Asking somebody to remember "br+" or whatever it is to open a file just is not the way things are usually done in the language. > Pascal kind of makes that distinction by having text > files as a special category. But binary files are > broken into myriad types... FILE OF If anybody wanted to do that (deal with a file as a collection of 64-bit words instead of bytes, for example) they could persumably subclass the binfile object. Or something like that. I'm guessing that people use text or text-like files (HTML, XML, whatnot) so much that having a set of commands for text files is worth the effort. > > With this type of file, we can iterate, splice, or index the content > > without having to explicitly tell the Elves that we want to > > read or write or whatnot: > Thats actually quite tricky to do. Why not try implememting > the interface in Python to see whats involved.... Yes, that would be the next logical step in my argument, wouldn't it...argh. I'll have to see what I can come up with (did I mention I'm just learning Python ) next week when I have some time on my hands... > One problem is that under the covers you have to figure out predictively > what mode to open the raw file in - what > does the user want to do with it. Otherwise you have to > open/close the file after each operation and keep track > of where the last access was etc etc... This is where I run up against my lack of background knowledge on operating system basics - why can't you just read the whole file into a buffer and manipulate that, which occasional flushes to a backup version? If I understand Linux correctly, this is what the operating system does anyway, or at least that is the excuse everybody keeps giving me when I ask why "free" shows me that all my nice RAM is being used for buffers and caches and stuff like that.. The trick (I guess) would be to make sure at all times that the file is not corrupted when the system crashes (this seems to be more a constant worry with Windows and (old) Mac users, but I also remember being told that Murphy was a computer scientist at heart). Include a buffer flush command after every write? Once you have everything in a buffer, you can do everything you want rather quickly (the end version has to be in C anyway for speed). If you do decide to do everything directly, yes, you might have to reopen and close the file a few times. But if speed is the problem, you can always go to the os module and do it the hard way. I'm assuming here that the lowest level you can get to are the POSIX calls (was that the name?) to the operating system, and that they force you to decide if you want to read or write? So you couldn't just write a new C library for opening and closing files? > Not too hard if its text and you assume line by line > access rather than characters, binary presumably > returns bytes? Yes - with maybe an option for multiples of bytes, but that would be for somebody to decide who knows more about the uses of binary files. I don't think I have ever accessed one in Python, but then I've heard that they are more common with Windows and (old) Macs than with Linux. [splices and indices] > Ah, but now try implementing that on a binary file. > But I guess you could just seek(0) after each > operation... or could you? It might depend on the > current mode... Worse case would probably be close file, open file, seek(0). That certainly would not be fast in relative terms; the question is, how fast is this going to be in human terms? I'm assuming the heavy-lifting people will want to use the old version with the os module anyway, because staying close to C (or Java in the case of Jython) is always going to be faster than anything one level up. > BTW Have you looked at the fileinput module which > does a little bit of what you want I think.... No, I hadn't, thank you for the reference. Will read it. I'll see about throwing together an interface for the new versions as a first step; tho I should warn everybody right away that I'll need a bit of help here... Y, Scot -- Scot W. Stevenson wrote me on Tuesday, 13. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1363 hours and has a CPU that is falling asleep at a system load of 0.00. From dyoo@hkn.eecs.berkeley.edu Tue Aug 13 23:18:35 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Tue, 13 Aug 2002 15:18:35 -0700 (PDT) Subject: [Tutor] Functions and lists. In-Reply-To: Message-ID: On Tue, 13 Aug 2002, SA wrote: > Hi Everyone- > > Ok. I'm doing something wrong here and need a little nudge in the right > direction. I have a script that begins as follows: > > #!/usr/bin/env python > import re > import os > import sys > import string > > print "Enter Directory: " > value = string.strip(sys.stdin.readline()) > list = os.listdir("%s" % value) > l = len(list) > > > I then have the following function: > > def input(insource): > infile = open(value + insource, "rb") > text = infile.read() > infile.close() > return text > > In the main namespace I have a iteration that goes like so: > > > for i in range(l): > input(list[i]) > substr(text) > > > Sorry, substr is another function that does some re on text. > > The problem lies in the function input. Does return not return 'text' to > the top-level namespace so that it can be worked on by the function > substr? Hi SA, The 'return' keywrod does return a value back to its caller, but never forces it to go under a particular name. So when we do: input(list[i]) this does return back the contents of your file, but, without making a variable name assignment, that value will just be tossed aside. We should either use the value in a larger expression, like: substr(input(list[i])) ... or we can capture it with a name, so that we can use that value later on. We can catch the result value by using an assignment: text = input(list[i]) and that should fix the problem! Let's look at a slightly simpler situation, just to reinforce this idea: ### >>> def add(x, y): return x + y ... >>> def add(x, y): return x + y ... >>> y Traceback (most recent call last): File "", line 1, in ? NameError: name 'y' is not defined ### When a function is called, it grabs a clean sheet of scratch paper to work on --- this scratch paper is often called its "namespace". It can do all the work it wants on scratch paper, but once it's finished, it can return its polished result as a nice 'return' value, but toss the scratch paper into the wastebasket. Functions isolate themselves this way --- they hide the scratch paper --- because it gives them freedom to use as much scratch paper as it wants, without worrying about stomping on anyone else's scratch paper. We could be nutty and reimplement add() like this: ### >>> def add(x, y): ... if y == 0: return x ... some_sum = add(x+1, y-1) ... return some_sum ... >>> add(3, 4) 7 ### (Don't worry if the definition here looks weird: it's an example of a 'recursive' definition of addition.) As silly as this is, it works, and as far as the outside world is concerned, should work very similarly to our original add() function. Except when y is negative. But let's not worry about that for now. *grin* This isolation allows us to implement functions as weirdly as we want, without worrying about variable name repercussions. From scot@possum.in-berlin.de Tue Aug 13 23:49:28 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Wed, 14 Aug 2002 00:49:28 +0200 Subject: [Tutor] An interface draft for hi-level file handling In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C82B@mbtlipnt02.btlabs.bt.co.uk> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C82B@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <200208140049.28600.scot@possum.in-berlin.de> Hello Alan, > Thats actually quite tricky to do. Why not try implememting > the interface in Python to see whats involved.... Okay, how's this for a first draft - tho I'm sure I missed some method somewhere... Y, Scot ========================================================= #!/usr/bin/env python # # New-style file commands (Interface draft) # Scot W. Stevenson scot@possum.in-berlin.de 13. August 2002 # Assumes Python 2.2 # -------------------------------------------------------- class StringFile: """ File type consisting of strings. The list of supported methods is taken from the Python Reference Manual section '3.3.4 Emulating container types' for mutable sequences. """ def __init__(self, name): """Create new instance of the StringFile class""" pass # ------------------------------------------------------------- # General methods as recommended by the Python Reference Manual # ------------------------------------------------------------- # Print file def __str__(self): """Print file to standard output""" pass # Addition def __add__(self): pass def __radd__(self): pass def __iadd__(self): pass # Multiplication # (Uh, do we really want to do this with files?) def __mul__(self): pass def __rmul__(self): pass def __imul__(self): pass # Index and slices # We're ignoring support for < 2.0 here def __getitem__(self, key): pass def __setitem__(self, key, value): pass def __delitem__(self, key): pass # Other stuff def __iter__(self, key): pass def __contains__(self, item): pass def __len__(self): pass # Normal methods def append(self, item): pass def count(self, item): pass def extend(self, list): pass def index(self, item): pass def insert(self, item, pos): pass def pop(self, item): pass def remove(self, index): pass def reverse(self): pass def sort(self): pass # ------------------------------------------------------------- # Special methods for the StringFile type # ------------------------------------------------------------- # Reading from a StringFile def read(self): """Read one line of text, return as string""" pass def readall(self): """Read all of file, return a list of strings""" pass # Writing to a StringFile def write_over(self, strings): """Overwrite an existing file; if no file exists, raise NoSuchFile error""" pass def write_new(self, strings): """Write to a new file; if file already exists, raise FileAlreadyExists error""" pass def write_always(self, strings): """Overwrite existing files, create new file if none exists""" pass def write(self, strings): """Synonym for write_always()""" pass #################################################################### # -------------------------------------------------------- class BinaryFile: """ File type consisting of bytes. The list of supported methods is taken from the Python Reference Manual section '3.3.4 Emulating container types' for mutable sequences. """ def __init__(self, name): """Create new instance of the BinaryFile class""" pass # ------------------------------------------------------------- # General methods as recommended by the Python Reference Manual # ------------------------------------------------------------- # Print file def __str__(self, base=10): """Print file to standard output. Suggestion: Print each byte as a number in the base given, e.g. '102 32 34 30', or 'FF AO 12' """ pass # Addition def __add__(self): pass def __radd__(self): pass def __iadd__(self): pass # Multiplication # (Uh, do we really want to do this with files?) def __mul__(self): pass def __rmul__(self): pass def __imul__(self): pass # Index and slices # We're ignoring support for < 2.0 here def __getitem__(self, key): pass def __setitem__(self, key, value): pass def __delitem__(self, key): pass # Other stuff def __iter__(self, key): pass def __contains__(self, item): pass def __len__(self): pass # Normal methods def append(self, item): pass def count(self, item): pass def extend(self, list): pass def index(self, item): pass def insert(self, item, pos): pass def pop(self, item): pass def remove(self, index): pass def reverse(self): pass def sort(self): pass # ------------------------------------------------------------- # Special methods for the BinaryFile type # ------------------------------------------------------------- # Reading from a BinaryFile def read(self): """Read one byte, return as integer""" pass def readall(self): """Read all of file, return a list of integers""" pass # Writing to a BinaryFile def write_over(self, bytes): """Overwrite an existing file; if no file exists, raise NoSuchFile error""" pass def write_new(self, bytes): """Write to a new file; if file already exists, raise FileAlreadyExists error""" pass def write_always(self, bytes): """Overwrite existing files, create new file if none exists""" pass def write(self, bytes): """Synonym for write_always()""" pass ############################################################ def file(name): """Create a string file object. If file exists, open it, if there is no such file, create it.""" # Do we want to create a temporary file if no name is given? # This would call the tempfile module pass def binfile(name): """Create a string file object. If file exists, open it, if there is no such file, create it.""" # Do we want to create a temporary file if no name is given? # This would call the tempfile module pass ############################################################ def _test(): print 'Testing Stringfile' teststringfile = StringFile('testfiledat.txt') teststringfile.write('One line written and read') print teststringfile.read() print 'Testing BinaryFile - write and read one byte' testbinfile = BinaryFile('testbinfile.dat') testbinfile.write(123) print testbinfile.read() ############################################################ if __name__ == '__main__': _test() From magnus@thinkware.se Wed Aug 14 01:48:46 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 14 Aug 2002 02:48:46 +0200 Subject: [Tutor] local variables In-Reply-To: <3D58DB77.3010900@aon.at> Message-ID: <5.1.0.14.0.20020814023123.02b09838@www.thinkware.se> At 12:12 2002-08-13 +0200, Gregor Lingl wrote: >My question: is there a function, an attribute, or whatever, that delivers= the >fact, that x is a local variable at a point of execution where the >assignment still hasn't taken place? Or - in other words - that delivers a= =20 >list >of all local variables - including those which still haven't got assigned= =20 >a value? >>> y =3D 1 >>> import inspect >>> def test(): ... print inspect.currentframe().f_code.co_varnames ... x =3D y ... >>> test() ('x',) But I think good unit tests is the way to find that kind of bugs in a program. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From magnus@thinkware.se Wed Aug 14 02:11:00 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 14 Aug 2002 03:11:00 +0200 Subject: [Tutor] python classes and mysql In-Reply-To: <20020813134004.GJ8720@tc.niof.net> Message-ID: <5.1.0.14.0.20020814025538.02a77ca8@www.thinkware.se> At 09:40 2002-08-13 -0400, rickp@telocity.com wrote: >If I create multiple classes in python to deal with different aspects of >a program and each of those classes needs to access mysql what is the >best way of handling connections/cursors? > >1) Each class opens a connection and creates a cursor. >2) The toplevel opens a connection which is passed to the class which > then creates a cursor. >3) The toplevel opens a connection and creates a cursor which is passed > to the class. I don't think there is a universal answer to this. There are several issues involved. Here are a few: Opening and closing connections to databases is typically rather slow. Reuse connections if you can. Transactions follow connections in the DB-API. If you have several simultaneous cursors for a connection, you can't commit and rollback the cursors independently. In other words, at any one time, a connection can only be involved in one transaction! It's usually a good idea to honour the KISS principle. (Keep It Simple, Stupid.) Object and Class structures can look different. I'm not sure what you mean by "toplevel" above. Inheritence or aggregation? An object than encapsulates the connection can be passed as a parameter or accessed as a singleton etc. One could imagine a connection wrapper which is used to get cursors from. (A cursor factory in other words). Maybe it will make a connection the first time someone requests a cursor? Maybe the application keeps tracks of some kind of transaction ids and the cursor factory can figure out when it needs to make a new connection and when it can reuse an old one. If a program is to use several different database modules, the connection parameters (as well as some other stuff) might vary, and those varying things should be encapsulated in a single place in the code. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From ckasso@sprynet.com Wed Aug 14 02:33:29 2002 From: ckasso@sprynet.com (Chris Kassopulo) Date: Tue, 13 Aug 2002 21:33:29 -0400 Subject: [Tutor] reverse a number (was no subject) In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C811@mbtlipnt02.btlabs.bt.co.uk> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C811@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <20020813213329.57fcb06a.ckasso@sprynet.com> On Mon, 12 Aug 2002 11:29:41 +0100 alan.gauld@bt.com wrote: > > To do this without using a string I had to loop through > > the number twice. The first time to see how many digits, > > the second to actually compute the number. > > > > It's mighty ugly, but it works. There must be a better > > way. > > length = len(str(number)) # beware of '.' in floats tho'! > > That OK??? > > Alan G. That got rid of the loop to figure the number of digits. Thanks. Here's what it looks like now: print 'This program accepts a number and then reverses it' userInput = int(raw_input("Enter a number = ")) number = userInput # initialize variables tempVar = 0 # determine number of digits i = len(str(number)) - 1 # compute each digit while number >= 10: tempVar = tempVar + (number%10)*10**i print (number%10)*10**i, "plus", number = number/10 i -= 1 else: print (number%10)*10**i reversedNumber = tempVar + number print 'The reversed number is', reversedNumber -- Chris Kassopulo _/\_ Linux User #199893 _/\_ Slackware From magnus@thinkware.se Wed Aug 14 02:40:59 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 14 Aug 2002 03:40:59 +0200 Subject: [Tutor] understanding classes In-Reply-To: <3D5976FC.2040505@aon.at> References: <3D5835C7.2060506@aon.at> <6905983.1029245038@[10.0.1.18]> Message-ID: <5.1.0.14.0.20020814031409.02a8adb0@www.thinkware.se> At 23:15 2002-08-13 +0200, Gregor Lingl wrote: >Lance E Sloan schrieb: >>I have one question: As far as you know, is "self" in Python basically=20 >>the same as "this" in Java? >As far as I understand it, YES. The main difference is the Python principle that "Explicit is better than Implicit". Thus there is no implied use of members in classes. You always need to state "self.x" explicitly. In C++ (and I guess in Java) you only need to type "this.x" if there is a local variable "x" which "hides" this.x. In python an unqualified "x" will always be a local or global variable, never an instance or class member. Imagine: class X: def y(self, value): print value x =3D X() x.y(5) is basically a compact way of writing X.y(x, 5). There is a slight ambiguity with self and class attributes though. >>> class X: ... x =3D 5 ... def show(self): ... print self.x ... >>> a =3D X() >>> a.show() 5 >>> a.x =3D 7 >>> a.show() 7 >>> X.x 5 >>> X.x =3D 4 >>> a.show() 7 >>> b =3D X() >>> b.show() 4 >>> X.x =3D 5 >>> b.show() 5 >>> b.x =3D 'Hello' >>> b.show() Hello In other words, self.x inside a method (or a direct attribute access like "a.x") will show the value of a class attribute with the same name if there is no instance attribute, but if there is an instance attribute, the class attribute is hidden, because self.x will now refer to something else. This is a little similar to local x hiding this.x in C++/Java. It can be accessed if you explicitly look for it with "X.x", but if you use inheritance, it might not be clear in what context the variable is defined. No problem if the class attribute is considered read-only, but if you communicate between instances belonging to different classes in a class hierarchy by changing class attributes, you might certainly mess things up. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From magnus@thinkware.se Wed Aug 14 02:46:23 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 14 Aug 2002 03:46:23 +0200 Subject: [Tutor] Functions and lists. In-Reply-To: Message-ID: <5.1.0.14.0.20020814034243.02b04ba8@www.thinkware.se> At 16:22 2002-08-13 -0500, SA wrote: >import string ... >value =3D string.strip(sys.stdin.readline()) Just a detail: As of Python 2.0 (or 1.6?) we have string methods, and can type value =3D sys.stdin.readline().strip() instead of import string value =3D string.strip(sys.stdin.readline()) Unfortunately, most books are still covering 1.5.2... --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From kodokuchef@yahoo.com Wed Aug 14 03:10:48 2002 From: kodokuchef@yahoo.com (akira sugiura) Date: Tue, 13 Aug 2002 19:10:48 -0700 (PDT) Subject: [Tutor] (no subject) Message-ID: <20020814021048.13937.qmail@web10308.mail.yahoo.com> Thank you Alan, ======================================================= password = "foobar" a=0 while password != "unicorn": print "You've guessed",a,"times." password = raw_input("Password?:") a=a+1 if password=="unicorn": print "Welcome in, you took ", a, "attempts." #I added if a>3: print "That must've been complicated" ======================================================= So, this "while loop" ends only when I enter unicorn.(right?) How can I make it ends either when I enter "unicorn" (right password) or wrong password more than three times? Probably I will learn it after I advanced more practices not now. Thanks anyway. I am enjoying learning python.(I guess) ===== ----------------------------------- Akira Sugiura kodokuchef@yahoo.com ----------------------------------- __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com From magnus@thinkware.se Wed Aug 14 02:58:14 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 14 Aug 2002 03:58:14 +0200 Subject: [Tutor] perl to python translation "phrase book"? In-Reply-To: <7129756.1029248768@[10.0.1.18]> Message-ID: <5.1.0.14.0.20020814035241.02abc140@www.thinkware.se> At 14:26 2002-08-13 -0400, Lance E Sloan wrote: >To: tutor@python.org >Subject: [Tutor] perl to python translation "phrase book"? > >Anybody know of a nice Perl to Python translation document, preferrably in= =20 >the form of a "phrase book"? For example, a side-by-side comparison of=20 >snippets of Perl code and the Python equivalent. http://starship.python.net/~da/jak/cookbook.html http://www.perl.com/pub/a/language/versus/python.html --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From runsun@bilbo.bio.purdue.edu Wed Aug 14 03:55:42 2002 From: runsun@bilbo.bio.purdue.edu (runsun) Date: Tue, 13 Aug 2002 21:55:42 -0500 Subject: [Tutor] Need bsddb/recno examples In-Reply-To: <20020813212201.27102.98132.Mailman@mail.python.org> Message-ID: Thx for the reply but what I need is an example code. The info regarding bsddb.rnopen you provided can be easily found but it doesn't help at all. ] Ah yes, that is it: ] http://www.python.org/doc/current/lib/module-bsddb.html ] ] So I'm assuming you wish to open DB files? bsddb.rnopen(filename[, flag[, ] mode[, rnflags[, cachesize[, psize[, lorder[, reclen[, bval[, ] bfname]]]]]]]]]) should do the trick. ] ] Another option you may want to check out is Gadfly. It is totally ] in Python ] and makes DB's basesd upon the SQL language. Does not take as ] much space as ] MySQL and seems less cryptic. ] ] Just my $0.02 worth. ] ] Good Luck. ] SA From slime@vsnl.net Wed Aug 14 05:30:35 2002 From: slime@vsnl.net (Prahlad Vaidyanathan) Date: Wed, 14 Aug 2002 10:00:35 +0530 Subject: [Tutor] Generating sigs with Python for fun and education In-Reply-To: <200208131027.14304.scot@possum.in-berlin.de> References: <200208121254.44192.scot@possum.in-berlin.de> <29836.1029190777@www5.gmx.net> <200208131027.14304.scot@possum.in-berlin.de> Message-ID: <20020814043035.GA8847@localhost.localdomain> Hi, On Tue, 13 Aug 2002 Scot W. Stevenson spewed into the ether: > Hello J"o, > > > You know about fortune? > > Yes, but the entries can be terribly long sometimes, everybody has it, and There is an option "-s", to allow only short fortunes. > I don't feel like rewriting it in Python just yet =8). Somehow I like the Well, you don't have to. There is a python version of fortune, and strfile lying around somewhere. I downloaded it recently, but I don't remember the exact link. Google around if your are interested. While we are on the topic, there is also a very nice project, called "Linux One-Stanza Tip" (LOST). It is quite cool, and *very* educative for newbies and old hats alike. http://lost.sourceforge.net/ HTH, pv. -- Prahlad Vaidyanathan Imbalance of power corrupts and monopoly of power corrupts absolutely. -- Genji From sarmstrong13@mac.com Wed Aug 14 05:51:36 2002 From: sarmstrong13@mac.com (SA) Date: Tue, 13 Aug 2002 23:51:36 -0500 Subject: [Tutor] List and Indexing error. Message-ID: I'm getting a persistent indexing error whenever I run the following script: #!/usr/bin/env python import re import os import string list = os.listdir('.') l = len(list) print "The number of items in this dir is: ", l for i in range(l): input = open(list[i], "rb") text = input.read() input.close() text2 = re.findall(r".*", text) if text2[78] == "
": text3 = string.join(text2[79:]) output = open(list[i], "wb") output.write(text3) output.close() else: print list[i] + " does not have the correct begin length ..." Basically, I have a folder full of html files. I need to get rid of the first part of each file. I figured the correct index. But when I run it I get the following: The number of items in this dir is: 148 Traceback (most recent call last): File "./repy2.py", line 20, in ? if text2[78] == "
": IndexError: list index out of range Anyone know why? Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From thomi@thomi.imail.net.nz Wed Aug 14 06:36:11 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Wed, 14 Aug 2002 17:36:11 +1200 Subject: [Tutor] (no subject) In-Reply-To: <20020814021048.13937.qmail@web10308.mail.yahoo.com> References: <20020814021048.13937.qmail@web10308.mail.yahoo.com> Message-ID: <20020814173611.316a99e7.thomi@thomi.imail.net.nz> another thing you could do is this: instead of going: print "You've guessed",a,"times." try this: print 'You've guessed %d times!" % (a) you can also do "things" within the brackets at the end. if you dont understand, just ignore this message :-) On Tue, 13 Aug 2002 19:10:48 -0700 (PDT) Thus said akira sugiura : > Thank you Alan, > ======================================================= > password = "foobar" > a=0 > > while password != "unicorn": > print "You've guessed",a,"times." > password = raw_input("Password?:") > a=a+1 > > if password=="unicorn": > print "Welcome in, you took ", a, "attempts." > > #I added > if a>3: > print "That must've been complicated" > ======================================================= > So, this "while loop" ends only when I enter > unicorn.(right?) > How can I make it ends either when I enter "unicorn" > (right password) or wrong password more than three > times? > Probably I will learn it after I advanced more > practices not now. > > Thanks anyway. I am enjoying learning python.(I guess) > > > ===== > ----------------------------------- > Akira Sugiura > kodokuchef@yahoo.com > ----------------------------------- > > __________________________________________________ > Do You Yahoo!? > HotJobs - Search Thousands of New Jobs > http://www.hotjobs.com > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- Thomi Richards thomi@imail.net.nz http://thomi.imail.net.nz/ Thomi Richards, thomi@imail.net.nz From slime@vsnl.net Wed Aug 14 06:48:24 2002 From: slime@vsnl.net (Prahlad Vaidyanathan) Date: Wed, 14 Aug 2002 11:18:24 +0530 Subject: [Tutor] Re: I am a friendly inoffensive non-commercial subject line In-Reply-To: <200208130215.46296.scot@possum.in-berlin.de> References: <200208130215.46296.scot@possum.in-berlin.de> Message-ID: <20020814054824.GA10048@localhost.localdomain> Hi, On Tue, 13 Aug 2002 Scot W. Stevenson spewed into the ether: > [This did have the subject line "High level file handling in the rain" but > the SMTP mail dragon at mail.python.org didn't like that] [-- snippity --] Looks to me like you are thinking of writing the exact *opposite* of the StringIO module. ie. Trying to make a file-handle look like a string (allow splicing, etc.). I remembered something that Danny Yoo posted sometime back. Hmm .. a quick search provides this : http://mail.python.org/pipermail/tutor/2002-April/013366.html I wonder if Danny has progressed on this one since. It might be a really interesting project to take up. HTH, pv. -- Prahlad Vaidyanathan The cost of living hasn't affected its popularity. From glingl@aon.at Wed Aug 14 07:26:36 2002 From: glingl@aon.at (Gregor Lingl) Date: Wed, 14 Aug 2002 08:26:36 +0200 Subject: [Tutor] List and Indexing error. References: Message-ID: <3D59F81C.4040008@aon.at> SA schrieb: >I'm getting a persistent indexing error whenever I run the following script: > >#!/usr/bin/env python > >import re >import os >import string > >list = os.listdir('.') >l = len(list) >print "The number of items in this dir is: ", l >for i in range(l): > input = open(list[i], "rb") > text = input.read() > input.close() > text2 = re.findall(r".*", text) > if text2[78] == "
": > text3 = string.join(text2[79:]) > output = open(list[i], "wb") > output.write(text3) > output.close() > else: > print list[i] + " does not have the correct begin length ..." > >Basically, I have a folder full of html files. I need to get rid of the >first part of each file. I figured the correct index. But when I run it I >get the following: >The number of items in this dir is: 148 >Traceback (most recent call last): > File "./repy2.py", line 20, in ? > if text2[78] == "
": >IndexError: list index out of range > >Anyone know why? > > Looks as if text2 didn't have 78 items. Put a print text2 after the line text2 = re.findall(r".*", text) print text2 to have a look at it. Possibly (if working in IDLE for instance) you may write >>> text2 # or >>> len(text2) to get smoe information Gregor after the error-message to see what's the case >Thanks. >SA > > > From shalehperry@attbi.com Wed Aug 14 08:25:16 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Wed, 14 Aug 2002 00:25:16 -0700 (PDT) Subject: [Tutor] Regex help please. In-Reply-To: <200208131614.44357.Nicole.Seitz@urz.uni-hd.de> Message-ID: On 13-Aug-2002 Nicole Seitz wrote: > >> >> import re >> import os >> >> list = os.listdir('.') #lists all html documents in this directory >> input = open(list[0], "rb") #this will be changed to iterate over the list >> text = input.read() >> p = re.compile("\?(\d+).htm", re.M) >> result = p.match(text) >> >> >> Now the last two line were written to test the search pattern >> "\?(\d+).htm". This will be changed to something like >> re.sub("\?(\d+).htm","\\1.html",text) later to do onestep swapping. >> to nit pick the regex, it should be '\.htm'. A period in a regex means "any character". From scot@possum.in-berlin.de Wed Aug 14 09:35:57 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Wed, 14 Aug 2002 10:35:57 +0200 Subject: [Tutor] Files as Strings In-Reply-To: <20020814054824.GA10048@localhost.localdomain> References: <200208130215.46296.scot@possum.in-berlin.de> <20020814054824.GA10048@localhost.localdomain> Message-ID: <200208141035.57703.scot@possum.in-berlin.de> Hi Prahlad, > I remembered something that Danny Yoo posted sometime back. > Hmm .. a quick search provides this : > http://mail.python.org/pipermail/tutor/2002-April/013366.html Ah, I had missed that, thank you. If I understand the mail correctly, the idea was to use C to make files look like strings...which would be the second step after making a Python version to figure to test the idea... Y, Scot -- Scot W. Stevenson wrote me on Wednesday, 14. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1375 hours and has a CPU that is falling asleep at a system load of 0.12. From scot@possum.in-berlin.de Wed Aug 14 09:48:09 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Wed, 14 Aug 2002 10:48:09 +0200 Subject: [Tutor] List and Indexing error. In-Reply-To: References: Message-ID: <200208141048.09329.scot@possum.in-berlin.de> Hi SA, > for i in range(l): > input = open(list[i], "rb") > text = input.read() > input.close() > text2 = re.findall(r".*", text) > if text2[78] == "
": If I understand this correctly, text is the content of a single file, and text2 is the result of some search. To me, it looks like one of your files in the directory is so short that after you have fed it thru the re.findall, there isn't anything at index 78 anymore. How about wrapping the if part in a try construct to catch IndexErrors and then print the i (or even better, the name of the file itself with list[i]) and then see what is wrong with file 78? Something like (this is untested): try: if text2[78] == "
": <...> except IndexError: print "IndexError occurred in %s file (index %s)" % (list[i], i) That should give you the file that is causing the problem. Y, Scot -- Scot W. Stevenson wrote me on Wednesday, 14. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1376 hours and has a CPU that is falling asleep at a system load of 0.02. From kodokuchef@yahoo.com Wed Aug 14 12:14:27 2002 From: kodokuchef@yahoo.com (akira sugiura) Date: Wed, 14 Aug 2002 04:14:27 -0700 (PDT) Subject: [Tutor] while loops,password Message-ID: <20020814111427.92581.qmail@web10301.mail.yahoo.com> Thank you Alan, ======================================================= password = "foobar" a=0 while password != "unicorn": print "You've guessed",a,"times." password = raw_input("Password?:") a=a+1 if password=="unicorn": print "Welcome in, you took ", a, "attempts." #I added if a>3: print "That must've been complicated" ======================================================= So, this "while loop" ends only when I enter unicorn.(right?) How can I make it ends either when I enter "unicorn" (right password) or wrong password more than three times? Probably I will learn it after I advanced more practices not now. Thanks anyway. I am enjoying learning python.(I guess) ===== ----------------------------------- Akira Sugiura kodokuchef@yahoo.com ----------------------------------- __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com From millsl@cofc.edu" I'm running Python 2.2 on a Windows 98se system. I just downloaded the pil thing (what is it called, a library?), but, of course, the Python2.2 couldn't find it. The install program put it in C:\py22. My python installation is in c:\my programs\python22. I drug the three files in the distribution: pil, dlls, and samples into my python22 directory under the filename pil: ex: C:\program files\python22\pil\{dlls, pil, samples} Still the python couldn't find it. I checked vis sys sys.path and the pil stuff isn't there, so of course, I need to put it there somehow. Incidentally, I had no difficulty like this at all with the visual library. I installer found the python22 directory and put the visual stuff in a subdirectory and python found it with no trouble. This experience is surely one that everyone using pil on a windows system would run into, yet as far as I can tell, the entire python documentation system takes the point of view that there is no such problem. frustration Thanks in advance. Laney Mills From rob@uselesspython.com Wed Aug 14 13:08:28 2002 From: rob@uselesspython.com (Rob) Date: Wed, 14 Aug 2002 07:08:28 -0500 Subject: [Tutor] while loops,password In-Reply-To: <20020814111427.92581.qmail@web10301.mail.yahoo.com> Message-ID: password = "foobar" a=0 while password != "unicorn": print "You've guessed",a,"times." password = raw_input("Password?:") a=a+1 if password=="unicorn": print "Welcome in, you took ", a, "attempts." #I added elif a>3: break The *break* breaks out of the while loop. You *guess* you're enjoying learning Python? hehe. If there's anything we can do to make it more enjoyable, let us know. This *should* be kinda fun, IMO. Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > akira sugiura > Sent: Wednesday, August 14, 2002 6:14 AM > To: Tutor@python.org > Subject: [Tutor] while loops,password > > > Thank you Alan, > ======================================================= > password = "foobar" > a=0 > > while password != "unicorn": > print "You've guessed",a,"times." > password = raw_input("Password?:") > a=a+1 > > if password=="unicorn": > print "Welcome in, you took ", a, "attempts." > > #I added > if a>3: > print "That must've been complicated" > ======================================================= > So, this "while loop" ends only when I enter > unicorn.(right?) > How can I make it ends either when I enter "unicorn" > (right password) or wrong password more than three > times? > Probably I will learn it after I advanced more > practices not now. > > Thanks anyway. I am enjoying learning python.(I guess) > > > ===== > ----------------------------------- > Akira Sugiura > kodokuchef@yahoo.com > ----------------------------------- > > __________________________________________________ > Do You Yahoo!? > HotJobs - Search Thousands of New Jobs > http://www.hotjobs.com > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From sarmstrong13@mac.com Wed Aug 14 13:05:48 2002 From: sarmstrong13@mac.com (SA) Date: Wed, 14 Aug 2002 07:05:48 -0500 Subject: [Tutor] List and Indexing error. In-Reply-To: <3D59F81C.4040008@aon.at> Message-ID: On 8/14/02 1:26 AM, "Gregor Lingl" wrote: > SA schrieb: > >> I'm getting a persistent indexing error whenever I run the following script: >> >> #!/usr/bin/env python >> >> import re >> import os >> import string >> >> list = os.listdir('.') >> l = len(list) >> print "The number of items in this dir is: ", l >> for i in range(l): >> input = open(list[i], "rb") >> text = input.read() >> input.close() >> text2 = re.findall(r".*", text) >> if text2[78] == "
": >> text3 = string.join(text2[79:]) >> output = open(list[i], "wb") >> output.write(text3) >> output.close() >> else: >> print list[i] + " does not have the correct begin length ..." >> >> Basically, I have a folder full of html files. I need to get rid of the >> first part of each file. I figured the correct index. But when I run it I >> get the following: >> The number of items in this dir is: 148 >> Traceback (most recent call last): >> File "./repy2.py", line 20, in ? >> if text2[78] == "
": >> IndexError: list index out of range >> >> Anyone know why? >> >> > Looks as if text2 didn't have 78 items. > Put a print text2 after the line > > text2 = re.findall(r".*", text) > print text2 > > to have a look at it. > Possibly (if working in IDLE for instance) you > may write > >>>> text2 # or >>>> len(text2) > > to get smoe information > > Gregor > > after the error-message to see what's the case Sorry, I should have mentioned this before. I already tried that and there is ~1300 items in text2 for all of the html files. This script actually works without the indexing error if I get rid of the if section and rewrite within the for section so that there is not another iteration call: for i in range(l): input = open(list[i], "rb") text = input.read() input.close() text2 = re.findall(r".*", text) text3 = string.join(text2[79:]) output = open("../Q/"+list[i], "wb") output.write(text3) output.close() This works without a hitch and removed the proper material from each file (over 140 files). The only reason why I wanted the if statement was so that I could do an if:else test in case a file did not have the proper file size. Any ideas? Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From rob@uselesspython.com Wed Aug 14 13:39:22 2002 From: rob@uselesspython.com (Rob) Date: Wed, 14 Aug 2002 07:39:22 -0500 Subject: FW: [Tutor] while loops,password Message-ID: -----Original Message----- From: thomi@thomi.imail.net.nz [mailto:thomi@thomi.imail.net.nz] Sent: Wednesday, August 14, 2002 7:15 AM To: Rob Subject: Re: [Tutor] while loops,password On Wed, Aug 14, 2002 at 07:08:28AM -0500, Rob wrote: umm.. > password = "foobar" what is this bit for?? seems to do nothing to me :-) also.. (scroll down) > a=0 > > while password != "unicorn": > print "You've guessed",a,"times." > password = raw_input("Password?:") > a=a+1 > > if password=="unicorn": > print "Welcome in, you took ", a, "attempts." > > #I added > elif a>3: > break > > The *break* breaks out of the while loop. > surely you want it to break if you got the answer right aswell?? the way i see it, and this is probably wrong, it should go something like this: password='hithere23' tries=0 instring = '' while instring != password: print 'You've guessed %d times!' % (tries) instring = raw_input('Password: ') tries=tries+1 if instring == password: print 'Welcome! you took %d tries!' % (tries) break elif tries > 3: print 'maximum number of tries exceeded!' break so yeah, what do you think?? does that look better?? i dunno....hmmmmm -- The software required Win95 or better, so I installed Linux. Thomi Richards, thomi@imail.net.nz From kodokuchef@yahoo.com Wed Aug 14 13:34:05 2002 From: kodokuchef@yahoo.com (akira sugiura) Date: Wed, 14 Aug 2002 05:34:05 -0700 (PDT) Subject: [Tutor] From newbie. Defining Functions Message-ID: <20020814123405.70081.qmail@web10302.mail.yahoo.com> Hi, I tried to figure out why the "print "in a_func a_var=",a_var"line outputs "15", Instead of "10" but I still can't figure it out. Could anyone explain this to me? Thank you very much. ====================================================== a_var = 10 b_var = 15 e_var = 25 def a_func(a_var): print "in a_func a_var = ",a_var b_var = 100 + a_var d_var = 2*a_var print "in a_func b_var = ",b_var print "in a_func d_var = ",d_var print "in a_func e_var = ",e_var return b_var + 10 c_var = a_func(b_var) print "a_var = ",a_var print "b_var = ",b_var print "c_var = ",c_var print "d_var = ",d_var The output is: in a_func a_var = 15 in a_func b_var = 115 in a_func d_var = 30 in a_func e_var = 25 a_var = 10 b_var = 15 c_var = 125 d_var = Traceback (innermost last): File "separate.py", line 20, in ? print "d_var = ",d_var NameError: d_var ======================================================= ===== ----------------------------------- Akira Sugiura kodokuchef@yahoo.com ----------------------------------- __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com From lumbricus@gmx.net Wed Aug 14 13:34:38 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Wed, 14 Aug 2002 14:34:38 +0200 (MEST) Subject: [Tutor] Functions and lists. References: <5.1.0.14.0.20020814034243.02b04ba8@www.thinkware.se> Message-ID: <17144.1029328478@www14.gmx.net> > At 16:22 2002-08-13 -0500, SA wrote: Hello! > >import string > ... > >value = string.strip(sys.stdin.readline()) This is usually done with value=string.strip(raw_input("prompt> ")) IMHO > Just a detail: As of Python 2.0 (or 1.6?) we > have string methods, and can type > > value = sys.stdin.readline().strip() value=raw_input("prompt> ").strip() > instead of > > import string > value = string.strip(sys.stdin.readline()) > > Unfortunately, most books are still covering 1.5.2... Thats not so unfortunately, because many people still get 1.5.x with the distribution. It would kill their python ambitions when none of the example codes worked. > -- > Magnus Lyckå, Thinkware AB > Älvans väg 99, SE-907 50 UMEÅ > tel: 070-582 80 65, fax: 070-612 80 65 > http://www.thinkware.se/ mailto:magnus@thinkware.se Greetings, J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From lumbricus@gmx.net Wed Aug 14 13:46:05 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Wed, 14 Aug 2002 14:46:05 +0200 (MEST) Subject: [Tutor] Regex help please. References: Message-ID: <17446.1029329165@www14.gmx.net> Hi! > On 13-Aug-2002 Nicole Seitz wrote: > > > >> > >> import re > >> import os > >> > >> list = os.listdir('.') #lists all html documents in this directory > >> input = open(list[0], "rb") #this will be changed to iterate over the > list > >> text = input.read() > >> p = re.compile("\?(\d+).htm", re.M) > >> result = p.match(text) > >> > >> > >> Now the last two line were written to test the search pattern > >> "\?(\d+).htm". This will be changed to something like > >> re.sub("\?(\d+).htm","\\1.html",text) later to do onestep swapping. > >> > > to nit pick the regex, it should be '\.htm'. A period in a regex means > "any > character". But Res are overkill anyway for this task. new_name=old_name[1:]+'l' should be enough. Untested. HTH, HAND J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From lumbricus@gmx.net Wed Aug 14 13:56:10 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Wed, 14 Aug 2002 14:56:10 +0200 (MEST) Subject: [Tutor] pixel plotting References: <01C24044.5F04D060.millsl@cofc.edu> Message-ID: <14785.1029329770@www14.gmx.net> Hello! Since nobody seems to know: > The vpython library has wonderful plotting routines. One of them is > gdots. > Gdots plots points on a graph. Although one can control the color of the > > dots, one apparently cannot control the size of the dots. > > Suppose I wanted to write Python program to create the Mandelbrot set, > which has hundreds of thousands of dots. One needs to plot individual > pixels. > > Here are my two questions then: > > Is there a formal description of the various vpython routines? There is a > > wonderful tutor, but no formal description with list all the attributes > ascribable to gdots. If there is none and you find out how it works, write one and make it available to the public. Thats how OSS works. This module sounds interesting. > If gdots can't be made to plot individuals at a given (x,y) point, is > there > some other way to do it? ? > Thanks > > Laney Mills Sorry, J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From sarmstrong13@mac.com Wed Aug 14 14:16:25 2002 From: sarmstrong13@mac.com (SA) Date: Wed, 14 Aug 2002 08:16:25 -0500 Subject: [Tutor] How do I get text from an HTML document. Message-ID: Hi Everyone- I have HTML docs that have text between the comment tags: Some text here What would be the simplest way to get this text. The text will also have some common html tags mixed in like

. So I want to strip all the html tags from the text I get also. Any ideas? Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From sarmstrong13@mac.com Wed Aug 14 14:27:46 2002 From: sarmstrong13@mac.com (SA) Date: Wed, 14 Aug 2002 08:27:46 -0500 Subject: [Tutor] From newbie. Defining Functions In-Reply-To: <20020814123405.70081.qmail@web10302.mail.yahoo.com> Message-ID: On 8/14/02 7:34 AM, "akira sugiura" wrote: > Hi, > > I tried to figure out why the "print "in a_func > a_var=",a_var"line outputs "15", Instead of "10" but I > still can't figure it out. Could anyone explain this > to me? Thank you very much. > ====================================================== > > > a_var = 10 > b_var = 15 > e_var = 25 > > def a_func(a_var): > print "in a_func a_var = ",a_var > b_var = 100 + a_var > d_var = 2*a_var > print "in a_func b_var = ",b_var > print "in a_func d_var = ",d_var > print "in a_func e_var = ",e_var > return b_var + 10 > > c_var = a_func(b_var) > Python reads everything from top to bottom. So when you say: c_var = a_func(b_var) You have now just switched b_var with a_var in your function. That is kind of a generic explanation. And c_var is now been assigned the output from bvar + 10 inside a_func. You have done nothing to clear the a_var in your function. What I think you may have intended to do for this function is: def a_func(): print "in a_func a_var = ",a_var b_var = 100 + a_var d_var = 2*a_var print "in a_func b_var = ",b_var print "in a_func d_var = ",d_var print "in a_func e_var = ",e_var return b_var + 10 This will now pass the correct values from all of your first assigned variables. And when you say c_var = a_func(b_var), b_var will be passed to b_var instead of a_var within your function. Basically, the a_var in the line "def a_func(a_var):" is nothing more than a place holder to pass in a variable. And since it has the same name as the a_var in the function, all a_var inside the function namespace will have the same value as the variable you passed to the function. Does that make since? Think of it as similar to the math term f(x). I think that is a close enough analogy. Hope this helps. SA P.S. Man this stuuf is starting to get scary now that it is beginning to make sense to me. -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From alan.gauld@bt.com Wed Aug 14 14:31:12 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 14 Aug 2002 14:31:12 +0100 Subject: [Tutor] RE: New file stuff Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C82D@mbtlipnt02.btlabs.bt.co.uk> > Well, yes, but just because it is the way that it has always > been done by computer scientists doesn't mean that a > different way might not be easier Oh I agree, the point I was making is that lots of language designers have tried and they keep coming back to variations on a theme... > > Pascal kind of makes that distinction by having text > > files as a special category. But binary files are > > broken into myriad types... FILE OF > > If anybody wanted to do that (deal with a file as a > collection of 64-bit words instead of bytes, for example I didn't explain that properly. Pascal has the rather nice feature of defining binary files in terms of the high level dta types you want to store. Thus if we define a class Foo we can declare a FILE OF FOO Then we can read/write foo objects to the file as binary chunks. This is a very nice feature although still not perfect since it can't handle polymorphic collections etc. But a lot better than writing sizeof(foo) bytes each time... > > Thats actually quite tricky to do. Why not try implememting > > the interface in Python to see whats involved.... I don't mean define the interface I mean actually write a prototype of the basic open/read/write/slice operations as a class. See how ,any special cases you have to deal with etc. > system basics - why can't you just read the whole file into a > buffer and manipulate that, which occasional flushes to a > backup version? Usually thats what the programmer will do but for big files (several hundred megabytes) thats not really an option. Its coping with these special cases that, makes file handling difficult, becayse at the end of the day you come up against the hardware which is essentiually a long sequence of bytes on a disk or tape! > understand Linux correctly, this is what the operating system > does anyway, or at least that is the excuse everybody keeps Nope, Linux is smarter than that. It reads in a bit of the file(a page) and then as you read thru the data it 'pages in' the next segment ready for you to move onto. Once you leave the first page it gets deleted and the space used for the next page and so on... But this is still basically a sequential read of the disk/tape. > "free" shows me that all my nice RAM is being used for > buffers and caches and stuff like that.. Yes the pages are stored in buffers and the output is written to a page buffer before eventually being flushed to disk - that's why files need a flush operation... To compound matters the underlying limitations tend to be as you say the Posix level read/write calls, but even they are sdhaped largely by the hardware device driver I/O routines which also operate in the same way(the BIOS on a PC). To radically change how we use files we need to change how we design the hardware! After all even our applications(word etc) use the same metaphor - Open a file, read it in, modify it, write it out... Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From pretiest80@yahoo.com Wed Aug 14 02:38:10 2002 From: pretiest80@yahoo.com (preety zinta) Date: Tue, 13 Aug 2002 18:38:10 -0700 (PDT) Subject: [Tutor] Please! Message-ID: <20020814013810.18542.qmail@web14802.mail.yahoo.com> --0-757791092-1029289090=:18026 Content-Type: text/plain; charset=us-ascii Dear Sir/Madam, Kindly please do not send any questions of python members to me. My mail ox storage is exceeding the maximum storage. So, please kind ly please stop sending those questions from python members to me. Thanks you for your kind support. --------------------------------- Do You Yahoo!? HotJobs, a Yahoo! service - Search Thousands of New Jobs --0-757791092-1029289090=:18026 Content-Type: text/html; charset=us-ascii

Dear Sir/Madam,

                           Kindly please do not send any questions of python members to me. My mail ox storage is exceeding the maximum storage. So, please kind ly please stop sending those questions from python members to me.

Thanks you for your kind support.



Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs --0-757791092-1029289090=:18026-- From alan.gauld@bt.com Wed Aug 14 15:07:13 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 14 Aug 2002 15:07:13 +0100 Subject: [Tutor] understanding classes Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C831@mbtlipnt02.btlabs.bt.co.uk> > I have one question: As far as you know, is "self" in Python > basically the same as "this" in Java? Exactly so and if it helps you can even call it 'this': class Foo: baz = "Class Foo" def bar(this): return this.baz Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From ATrautman@perryjudds.com Wed Aug 14 15:10:17 2002 From: ATrautman@perryjudds.com (Alan Trautman) Date: Wed, 14 Aug 2002 09:10:17 -0500 Subject: [Tutor] pixel plotting Message-ID: <0BA95581EDA7D611841B00A0C9AD25DD2B5815@mail.pjinet.com> Hi all, vpython is actually quite impressive as a total project if you have plotting needs. I have just went through several of there packages and it looks like quite mature code at least for what little I have looked at. To specifically document dot attributes they are constants in in the graph.py library at the top of the file. They are well documented and not hard to change to suit different needs or a function could easily be added to set them. The code is quite easy to read in this module (no GUI bits they are hidden in another library) and could be modified easily. They do require the use of Open GL but that is becoming quite common so it should be useful. Peace Alan -----Original Message----- From: lumbricus@gmx.net [mailto:lumbricus@gmx.net] Sent: Wednesday, August 14, 2002 7:56 AM To: tutor@python.org Subject: Re: [Tutor] pixel plotting Hello! Since nobody seems to know: > The vpython library has wonderful plotting routines. One of them is > gdots. > Gdots plots points on a graph. Although one can control the color of the > > dots, one apparently cannot control the size of the dots. > > Suppose I wanted to write Python program to create the Mandelbrot set, > which has hundreds of thousands of dots. One needs to plot individual > pixels. > > Here are my two questions then: > > Is there a formal description of the various vpython routines? There is a > > wonderful tutor, but no formal description with list all the attributes > ascribable to gdots. If there is none and you find out how it works, write one and make it available to the public. Thats how OSS works. This module sounds interesting. > If gdots can't be made to plot individuals at a given (x,y) point, is > there > some other way to do it? ? > Thanks > > Laney Mills Sorry, J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From shalehperry@attbi.com Wed Aug 14 15:16:39 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Wed, 14 Aug 2002 07:16:39 -0700 (PDT) Subject: [Tutor] Regex help please. In-Reply-To: <17446.1029329165@www14.gmx.net> Message-ID: >> >> to nit pick the regex, it should be '\.htm'. A period in a regex means >> "any >> character". > > But Res are overkill anyway for this task. > > new_name=old_name[1:]+'l' > > should be enough. > Untested. > no because you have to find the string first (-: From alan.gauld@bt.com Wed Aug 14 15:15:05 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 14 Aug 2002 15:15:05 +0100 Subject: [Tutor] Functions and lists. Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C832@mbtlipnt02.btlabs.bt.co.uk> > list = os.listdir("%s" % value) list = os.listdir(value) # seems less cumbersome... > def input(insource): > infile = open(value + insource, "rb") > text = infile.read() > infile.close() > return text redefining the builtin input() function probably isn't a good idea...but it should work... > In the main namespace I have a iteration that goes like so: > for i in range(l): > input(list[i]) But you don't assign the return value of input() to anbythiong, you just throw it waay. You eed: txt = input(list[i]) substr(txt) > Sorry, substr is another function that does some re on text. You might need to catch the output of that too if you want to display it say... > The problem lies in the function input. Does return not > return 'text' to the top-level namespace I think it does, its just that you aren't assigning it to anything! Its the *value* of text thats returned not the name. > Traceback (most recent call last): > File "./remodpyqt.py", line 29, in ? > substr(text) > NameError: name 'text' is not defined Just so. text is a name that is only known inside input(). Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Wed Aug 14 15:23:47 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 14 Aug 2002 15:23:47 +0100 Subject: [Tutor] (no subject) Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C833@mbtlipnt02.btlabs.bt.co.uk> > while password != "unicorn": > print "You've guessed",a,"times." > password = raw_input("Password?:") > a=a+1 > > if password=="unicorn": > print "Welcome in, you took ", a, "attempts." > > #I added > if a>3: > print "That must've been complicated" > ======================================================= Thats exactly right, well done. ( Actually since I think you started with a=0 you might want to change the test to if a >=3 but thats nitpicking :-) > So, this "while loop" ends only when I enter > unicorn.(right?) > How can I make it ends either when I enter "unicorn" > (right password) or wrong password more than three > times? The wrong password will cause 'a' to be incremented thus you can exit when a >= 3 or, to reverse the logic, keep the loop going while a < 3. So just combine the tests using the 'and' operator: while (passwd != "unicorn") and (a < 3): # do your thing here.... HTH, Alan g. From alan.gauld@bt.com Wed Aug 14 15:36:04 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 14 Aug 2002 15:36:04 +0100 Subject: [Tutor] Files as Strings Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C834@mbtlipnt02.btlabs.bt.co.uk> > Ah, I had missed that, thank you. If I understand the mail > correctly, the idea was to use C to make files look > like strings...which would be the second step > after making a Python version to figure to test > the idea... Strings are only half your solution tho' since they are read only. To modify a string you have to create a new one. Again, all things are possible, but with files that could be a tad trickier than it sounds... Alan g. From marcolinux@linuxbr.com.br Wed Aug 14 15:40:23 2002 From: marcolinux@linuxbr.com.br (Marc) Date: Wed, 14 Aug 2002 11:40:23 -0300 Subject: [Tutor] Python + editor In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C828@mbtlipnt02.btlabs.bt.co.uk> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C828@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <20020814144023.GA1300@marcolab.proconet> Hi Alan! alan.gauld@bt.com (alan.gauld@bt.com) wrote: > > > > Block selection (ctrl+mouse selection). > > There's also Visual mode in Vim > > > > Can't beat crtl+mouse selection. > > You can use the mouse to select in vim and the > cut n' paste etc all work as expected... > > After dragging with the mouse select the mode: > v = Visual(default) > V = Visual Line(whole lines always selected) > CTRL [vV] = Visual block Still can't beat crtl+mouse selection, over a phone line :) > > > > > Can redefine the print command: > > > I'm sure you can do this in vim, I'm just not sure how. > > Just filter the file or region to any external > command using :}! > Didn't worked here... But I'm sure it will after reading lots of docs, searching google, etc. > > They have a lot of power, but hidden deep inside a dotfile. > > Absolutely. Like any powerful tool they aren't really > intended for casual amateur use. Hey ! :-). OK, I'll bite. Some times being powerful does not necessarily translate to being difficult to use. Heck, python is powerful! Yet used by a lot of "casual amateur". Are u saying we just should pack our things, our hopes, our enthusiasm and go? That we should forget about using this wonderful tool just because of its power? I don't think so. Python is a nice example of a powerful tool that can be used by simple mortals, you know the "casual amateur", with the aid of the great tutors of this list, people that believe on "casual amateur", helping us to aim a little higher, away from our own foot. > > > OK, we can use gvim but is still hard to do some things like > > the print command above. > > The basic print command is easy redirecting does require > memorizing a three character string but you could easily > map it to a hot key! Again, try the explain-over-a-phone-line method. Besides, there is a usability factor. Can u guarantee that the hot key will be the same on every vim out there? No! because the user can redefine it to whatever (s)he wants! Sometimes too many options is not an option. Have u ever tried to use others people vim? Or out of the box? What a nightmare! nothing seems to work as u, advanced user , expect. But nedit seems the same anywhere I try to use it.Only minor tweaks are needed. > > Same goes to emacs-X11. > > It is a hybrid, it has a lot internally but has access > to the OS too. Old joke: emacs is a complete OS. Only lacks a descent text editor. :) > > > after some time and u need the work done.Quick. > > vim does most of the work out of the box > (unlike emacs!) My vimrc file is only about > 10 lines long, my emacsrc is over 200... My .neditrc is.... Gee I just don't know.No kidding! I'll tell u why: Because I don't need to edit the resource file directly! There's a menu item just for this: Preferences -> default settings. It allows me to play with the options _without_ reading a lot of docs/other people dotfiles.A time saver, no doubt. > > asking how to redefine the print command .Yup, u just lost a > > customer while you was looking at the docs.:) > > But surely redefining the print command is a nonsense, > the print command prints. WEhat they really want to > do is output to some other output device/format. C'mon man! This is nit-picking... :) > > You know, life is short.That's why I'm slowly giving up from > > things like: > > - C/perl ; > > - vi/emacs; > > Life is short thats why I stick to those things, > I don't have time to waste on extra keystrokes! Like :}! or :wq! . Man, I thought u really liked lots of keystrokes. > > experience, something I'm experimenting right now with > > GNU/linux and python.And nedit of course :) . > > Get a modern Mac. My iBook with Mac OS X has convinced me > that Linux has so far to go I can't be bothered waiting! Gee... Life is not _that_ short... :) Man u just solved all the micro$ft problems! They should just buy a mac to every linux, gnome, kde, apache, perl, mozilla, python,open-source developers out there! Why bother develop something new when we have word, VB, aqua, quartz, IE, outlook already made, ready for use? Jokes aside, we are talking about different enjoyable experiences here... I'm talking about the feeling of freedom , the good sensation of not depending on vendors that hide thinks from you(API anyone?), don't show the code, keep their secrets using obscure licenses that take away all your rights in exchange for a pretty interface. No thanks, I'll keep playing with my bloated gnome, my slow kde, my ugly-font mozilla because I know they won't be that way forever thanks to a community that believe we can have a better software, a better world, without giving up our freedoms. > > Alan g Thanks for replying. .:: MarcoLinux ::. -- There are 10 kinds of people in the world: Those who understand binary, and those who don't. - Slashdot From lsloan@umich.edu Wed Aug 14 15:42:56 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Wed, 14 Aug 2002 10:42:56 -0400 Subject: [Tutor] understanding classes In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C831@mbtlipnt02.btlabs.bt.co.uk> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C831@mbtlipnt02.btlabs.bt.c o.uk> Message-ID: <979853.1029321776@[10.0.1.25]> --On Wednesday, August 14, 2002 3:07 PM +0100 alan.gauld@bt.com wrote: >> I have one question: As far as you know, is "self" in Python >> basically the same as "this" in Java? > > Exactly so and if it helps you can even call it 'this': > > class Foo: > baz = "Class Foo" > def bar(this): > return this.baz Thanks for the confirmation. Gregor and others confirmed that for me, too, also pointing out that it's a keyword in Java, but an explicitly defined variable in Python. Is there a special term to refer to that variable, like "instance variable"? My next question was going to be, why is the Python convention to name that variable "self" rather than "this"? I suspect it's just Guido's choice. Was Java not so well known when this was done? Or is this an intentional choice to distance Python from Java? -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From alan.gauld@bt.com Wed Aug 14 15:42:47 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 14 Aug 2002 15:42:47 +0100 Subject: [Tutor] while loops,password Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C835@mbtlipnt02.btlabs.bt.co.uk> > > while password != "unicorn": > > print "You've guessed",a,"times." > > password = raw_input("Password?:") > > a=a+1 > > > > if password=="unicorn": > > print "Welcome in, you took ", a, "attempts." > > > > #I added > > elif a>3: > > break > > > > The *break* breaks out of the while loop. > > > > surely you want it to break if you got the answer right > aswell?? It will breakj naturally coz thats the terminating condition of the loop. But really the whole if/else bit should be outside the loop. The loop is supposed to get the input and count the attempts. Once we've done that we can display the findings. As ever, separate display from processing. > so yeah, what do you think?? does that look better?? I don't think so, I prefer to use a boolean combined condition in the while. break within a while loop is an oftenseen Python idiom, but its easy to overdo it! The loop condition itself should be the normal exit, break is for the occasional abnormal case.. IM(NS)HO :-) Alan g From alan.gauld@bt.com Wed Aug 14 15:48:14 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 14 Aug 2002 15:48:14 +0100 Subject: [Tutor] understanding classes Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C836@mbtlipnt02.btlabs.bt.co.uk> > My next question was going to be, why is the Python > convention to name that variable "self" rather than "this"? Guido's choice I guess. self is used in Smalltalk and Delphi. this is used in C++ and Java. Another language (which I can't recall!) uses 'my' in the same way. > Was Java not so well known when this was done? It wasn't even invented! Python was started in 1989 whereas Java wasn't unveiled till 1994(?) However C++ was around at the time and using 'this'. OTOH Smalltalk has used 'self' since 1973.... Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Wed Aug 14 15:59:48 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 14 Aug 2002 15:59:48 +0100 Subject: [Tutor] From newbie. Defining Functions Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C837@mbtlipnt02.btlabs.bt.co.uk> > I tried to figure out why the "print "in a_func > a_var=",a_var"line outputs "15", Instead of "10" First you define some names(vaiables) and give them some values > a_var = 10 > b_var = 15 Now you define a function that takes a parameter which coincidentally has the same name as one of the previously defined ones, although they are in no way related. It also creates a new name b_var which is only seen inside the function and is not related to the previously created variable. > def a_func(a_var): > print "in a_func a_var = ",a_var > b_var = 100 + a_var > .... > return b_var + 10 So b_var always retirns (a_var+100+10) The function is now defined but hasn't been executed yet. Now we call the function we defined passing b_var into the function so that the parameter (a_var) takes the value of variable b_var(15) > c_var = a_func(b_var) So c_var has been assigned the value returned by the function, namely a_var+110 = 125 Now we print out some values... None have changed except c_var which was reassigned by the function call. > print "a_var = ",a_var > print "b_var = ",b_var > print "c_var = ",c_var And try to print a name that has not been defined at this level. > print "d_var = ",d_var > > The output is: > a_var = 10 > b_var = 15 > c_var = 125 > d_var = > Traceback (innermost last): > File "separate.py", line 20, in ? > print "d_var = ",d_var > NameError: d_var Just as expected... You might like to read the "What's in a name" topic on my tutor... Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Wed Aug 14 16:06:25 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 14 Aug 2002 16:06:25 +0100 Subject: [Tutor] How do I get text from an HTML document. Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C838@mbtlipnt02.btlabs.bt.co.uk> > I have HTML docs that have text between the comment tags: > > Some text here > > > What would be the simplest way to get this text. Pseudo code: while 1: # find opening tag line = file.readline if line == "": break while 1: # collect lines up to closing tag line = file.readline if line == "": break lines.append(line) Now use the HTML parser module to eliminate HTML tags leaving just the text.... HTH, Alan G. From ATrautman@perryjudds.com Wed Aug 14 16:32:59 2002 From: ATrautman@perryjudds.com (Alan Trautman) Date: Wed, 14 Aug 2002 10:32:59 -0500 Subject: [Tutor] pixel plotting Message-ID: <0BA95581EDA7D611841B00A0C9AD25DD2B5816@mail.pjinet.com> More from me. I've played around a little more. Here is a simple example of what can be done to plot dots. Program: from visual.graph import * # import graphing features a = [1,3,2,5,3,6,7,4,2,1,3,4,5,6] x = 1.72 funct1 = gdots(color=color.yellow) # a collection of plotted dots for each in a: # x goes from 0 to 8 funct1.plot(pos=(cos(each),each)) # plot You will first need to get vpython from www.vpython.org and check out their tutorial everything worked as cut and paste. This is copied heavily from the graph.py main test() function. I unfortunately cannot verify functionality on anything but a Mac and Win 98/NT since I'm at work. Peace Alan -----Original Message----- From: Alan Trautman Sent: Wednesday, August 14, 2002 9:10 AM To: 'tutor@python.org' Subject: RE: [Tutor] pixel plotting Hi all, vpython is actually quite impressive as a total project if you have plotting needs. I have just went through several of there packages and it looks like quite mature code at least for what little I have looked at. To specifically document dot attributes they are constants in in the graph.py library at the top of the file. They are well documented and not hard to change to suit different needs or a function could easily be added to set them. The code is quite easy to read in this module (no GUI bits they are hidden in another library) and could be modified easily. They do require the use of Open GL but that is becoming quite common so it should be useful. Peace Alan -----Original Message----- From: lumbricus@gmx.net [mailto:lumbricus@gmx.net] Sent: Wednesday, August 14, 2002 7:56 AM To: tutor@python.org Subject: Re: [Tutor] pixel plotting Hello! Since nobody seems to know: > The vpython library has wonderful plotting routines. One of them is > gdots. > Gdots plots points on a graph. Although one can control the color of the > > dots, one apparently cannot control the size of the dots. > > Suppose I wanted to write Python program to create the Mandelbrot set, > which has hundreds of thousands of dots. One needs to plot individual > pixels. > > Here are my two questions then: > > Is there a formal description of the various vpython routines? There is a > > wonderful tutor, but no formal description with list all the attributes > ascribable to gdots. If there is none and you find out how it works, write one and make it available to the public. Thats how OSS works. This module sounds interesting. > If gdots can't be made to plot individuals at a given (x,y) point, is > there > some other way to do it? ? > Thanks > > Laney Mills Sorry, J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From alan.gauld@bt.com Wed Aug 14 16:34:48 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 14 Aug 2002 16:34:48 +0100 Subject: [Tutor] Python + editor Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C839@mbtlipnt02.btlabs.bt.co.uk> > > Absolutely. Like any powerful tool they aren't really > > intended for casual amateur use. > > Hey ! :-). > OK, I'll bite. :-) > Heck, python is powerful! Yet used by a lot of "casual amateur". Python is surprisingly powerful for a general purpose easy to learn language but the real power programming tools are C/C++/Assembler etc. Python is like nedit or IDLE or Scite. Nice to use, powerful enough most of the time but ultimately there are limits. nedit is a fine editor BTW, I use it on our unix boxes quite often (but then I also use ed quite often!) but its not in the same league for speed of coding that vim (or emacs) is. The former because it has been designed for programmers and is optimised for that task, the latter because it has every shortcut and tool you can ask for ready available, and when not available you can write your own... > That we should forget about using this wonderful tool just > because of its power? Not at all. Just use the appropriate tool for the job. Because I give the hard core programming jobs to other folks nowadays I use python for most things and let the 'young turks' convert it to C++ at their leisure... > > The basic print command is easy redirecting does require > > memorizing a three character string but you could easily > > map it to a hot key! > > Again, try the explain-over-a-phone-line method. Actually telling somebody to type three characters is pretty easy over the phone! If they don't already have nedit configured to the new settying trying to guide them thru that process before printing is much harder! > Can u guarantee that the hot key will be the same on > every vim out there? No more than you can guarantyee your remapped print will be the same. If I put my mapping in the global .exrc file I can be fairly sure its available unless the user remapped it - in which case they don't need me to tell them how to fix it!. > Have u ever tried to use others people vim? > Or out of the box? Sure, itsone reason I don't cusytomise it much. Most of our operational servers have vanilla vi never mind vim, with no customisation of any kind. > But nedit seems the same anywhere I try to use it. Only if its not been configured. There are 3 hard core nedit users here and they all have different configurations. I will grant the extent of the configuration is much less than in emacs tho'! > emacs is a complete OS. Only lacks a descent text editor. :) Never understood that, it has viper mode(vi emulation)! :-) > a menu item just for this: > Preferences -> default settings. It allows me to play with > the options _without_ reading a lot of docs I set my vim options without reading lots of docs! But I grant its done via editing a file - its the unix way... > > But surely redefining the print command is a nonsense, > > the print command prints. WEhat they really want to > > do is output to some other output device/format. > > C'mon man! This is nit-picking... :) It was supposed to be a (bad) joke! :-) > > Life is short thats why I stick to those things, > > I don't have time to waste on extra keystrokes! > > Like :}! or :wq! . Exactly, If I'm typing I don't want to have to remove my hands from the keyboard to find a mouse. > > Get a modern Mac. My iBook with Mac OS X has convinced me > > that Linux has so far to go I can't be bothered waiting! > > Gee... Life is not _that_ short... :) When you get to my age it is! I want the power and usability and reliability of Unix. I also want things to just work. The iBook gives me that. Linux is still a constant learning excercise. While that can be fun, I don't get much work done! > out there! Why bother develop something new when we have > word, VB, aqua, quartz, IE, outlook already made, ready for use? Because there are new things to be invented. The real question surely is why ewaste time reinventing the wheel when there are genuinely new things to invent!? > Jokes aside, we are talking about different enjoyable > experiences here... I agree. I still run a Mac, XP box and Linux server at home. At work I use IBM mainframe, Solaris and Win2K. They all have their moments. Its why I work in computing! :-) > on vendors that hide thinks from you(API anyone?) The Mac OS X API is fully exposed. The Windows guys are a wee bit more naughty revealing only some of theirs. The implementation of both is closed although the Darwin kernel is of course open source. > No thanks, I'll keep playing with my bloated gnome, my slow > kde, my ugly-font mozilla because I know they won't be > that way forever I dunno. All the items you mention have gotten more bloated, slower and only slightly prettier in the 8 or so years I've been using Linux! But I'm still hopeful. I like Linux, I'd like it to succeed but while it remains a hobbyist OS I'm not sure they will ever get there. Too many folks enjoy the tinkering IMHO. Have fun, whatever you use! :-) Alan g. From magnus@thinkware.se Wed Aug 14 18:04:43 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 14 Aug 2002 19:04:43 +0200 Subject: [Tutor] How do I get text from an HTML document. In-Reply-To: Message-ID: <5.1.0.14.0.20020814175530.02aeab38@www.thinkware.se> At 08:16 2002-08-14 -0500, SA wrote: >Hi Everyone- > >I have HTML docs that have text between the comment tags: > >Some text here > > >What would be the simplest way to get this text. The text will also have >some common html tags mixed in like

. So I want to strip all the html >tags from the text I get also. import htmllib, formatter, StringIO def getTextFromHTML(html, startPattern, endPattern): # make a file-like string object (data) to which # we'll write the output from HTML parsing. data =3D StringIO.StringIO() # Find where the relevant text starts and ends. # As used below, the starting tag will be included # in the data which is fed to the HTML parser, # while the ending tag won't, but that hardly # matters since tags are to be removed anyway. # If a tag isn't found, -1 will be returned. This # means that if the start tag isn't found, nothing # will come out of the function. "html[-1:stop]" # If no end tag is found, all text after the # start tag will be extracted "html[start:-1]" # since index "-1" means "just after the end". start =3D html.find(startPattern) # Start searching for end tag _after_ the start tag # in case they look the same. stop =3D html.find(endPattern, start + 1) # Parsers like HTMLParser sends its parsed data # to a Formatter, which in turn sends data to a # Writer. Very flexible, but a big difficult to # learn... DumbWriter is just smart enough to do # word-wrapping after 72 columns. fmt =3D formatter.AbstractFormatter(formatter.DumbWriter(data)) parser =3D htmllib.HTMLParser(fmt) # Feed the relevant part of the HTML through the parser. parser.feed(html[start:stop]) # Return the entire string in "data" return data.getvalue() html =3D """This should be left out This should be found But not this""" tag =3D '' print getTextFromHTML(html, tag, tag) This won't look so horrible if you just remove all those comments! :-) Unfortuantely it's far from trivial to understand the htmllib and formatter modules from the standard library manual. Examples would be good. Steve Holden describes this and plenty of other internet related stuff in "Python Web Programming". If you feel that the htmllib and formatter stuff is to voodoo like, you can use the approach in http://www.faqts.com/knowledge_base/view.phtml/aid/3680/fid/199 instead. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From lumbricus@gmx.net Wed Aug 14 18:50:13 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Wed, 14 Aug 2002 19:50:13 +0200 (MEST) Subject: [Tutor] Regex help please. References: Message-ID: <4945.1029347413@www14.gmx.net> > >> > >> to nit pick the regex, it should be '\.htm'. A period in a regex means > >> "any > >> character". > > > > But Res are overkill anyway for this task. > > > > new_name=old_name[1:]+'l' > > > > should be enough. > > Untested. > > > > no because you have to find the string first (-: ROTFL *patsch* of course. But -- Does somebody know: If these filenames are separated by whitespace, you could split() the line, test each item for the '?' (if item[0]=='?') and then replace as above. Is this faster than using re? I read sometimes, res are not so performant, when aplied to simple patterns and should be avoided if possible. Greetings, J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From gwatt3@backbonesecurity.com Wed Aug 14 19:53:50 2002 From: gwatt3@backbonesecurity.com (Watt III, Glenn) Date: Wed, 14 Aug 2002 14:53:50 -0400 Subject: [Tutor] need to use # sign Message-ID: <94FD5825A793194CBF039E6673E9AFE034D61E@bbserver1.backbonesecurity.com> ok im writing a cgi and i need to use the # sign in a url. i tried putting one of these guys down \# but that didnt seem to help like it does with quotes. is there any way to keep it from reading as comment? From dman@dman.ddts.net Wed Aug 14 20:16:47 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Wed, 14 Aug 2002 15:16:47 -0400 Subject: [Tutor] Re: need to use # sign In-Reply-To: <94FD5825A793194CBF039E6673E9AFE034D61E@bbserver1.backbonesecurity.com> References: <94FD5825A793194CBF039E6673E9AFE034D61E@bbserver1.backbonesecurity.com> Message-ID: <20020814191647.GA10924@dman.ddts.net> --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 14, 2002 at 02:53:50PM -0400, Watt III, Glenn wrote: | ok im writing a cgi and i need to use the # sign in a url. i tried | putting one of these guys down \# but that didnt seem to help like it | does with quotes. is there any way to keep it from reading as comment? >>> print "#" # >>> How about showing us the (erroneous) code you have? -D --=20 Be sure of this: The wicked will not go unpunished, but those who are righteous will go free. Proverbs 11:21 =20 http://dman.ddts.net/~dman/ --2fHTh5uZTiUOsy+g Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1arJ8ACgkQO8l8XBKTpRRqLQCgg4pqkd3nDalB5MXhkEnKoEeE Mi0AnRD9+Slp1itnEAn2t9mzLIa7fNgT =O5+X -----END PGP SIGNATURE----- --2fHTh5uZTiUOsy+g-- From sarmstrong13@mac.com Wed Aug 14 20:18:58 2002 From: sarmstrong13@mac.com (SA) Date: Wed, 14 Aug 2002 14:18:58 -0500 Subject: [Tutor] How do I get text from an HTML document. In-Reply-To: <5.1.0.14.0.20020814175530.02aeab38@www.thinkware.se> Message-ID: On 8/14/02 12:04 PM, "Magnus Lycka" wrote: > At 08:16 2002-08-14 -0500, SA wrote: >> Hi Everyone- >> >> I have HTML docs that have text between the comment tags: >> >> Some text here >> >> >> What would be the simplest way to get this text. The text will also have >> some common html tags mixed in like

. So I want to strip all the html >> tags from the text I get also. > > import htmllib, formatter, StringIO > > def getTextFromHTML(html, startPattern, endPattern): > # make a file-like string object (data) to which > # we'll write the output from HTML parsing. > data = StringIO.StringIO() > > # Find where the relevant text starts and ends. > # As used below, the starting tag will be included > # in the data which is fed to the HTML parser, > # while the ending tag won't, but that hardly > # matters since tags are to be removed anyway. > # If a tag isn't found, -1 will be returned. This > # means that if the start tag isn't found, nothing > # will come out of the function. "html[-1:stop]" > # If no end tag is found, all text after the > # start tag will be extracted "html[start:-1]" > # since index "-1" means "just after the end". > start = html.find(startPattern) > # Start searching for end tag _after_ the start tag > # in case they look the same. > stop = html.find(endPattern, start + 1) > > # Parsers like HTMLParser sends its parsed data > # to a Formatter, which in turn sends data to a > # Writer. Very flexible, but a big difficult to > # learn... DumbWriter is just smart enough to do > # word-wrapping after 72 columns. > fmt = formatter.AbstractFormatter(formatter.DumbWriter(data)) > parser = htmllib.HTMLParser(fmt) > > # Feed the relevant part of the HTML through the parser. > parser.feed(html[start:stop]) > > # Return the entire string in "data" > return data.getvalue() > > html = """This should be left out > > This should be found > > But not this""" > > tag = '' > > print getTextFromHTML(html, tag, tag) > This almost works. It does a great job of extracting the text between the two tags. But for some reason I have a lot of extraneous material after the text that was not between the two tags and looks like it may have come from the html code after the end tag. Did I miss something? >>> def getTextFromHTML(html, startPattern, endPattern): ... data = StringIO.StringIO() ... start = html.find(startPattern) ... stop = html.find(endPattern, start + 1) ... fmt = formatter.AbstractFormatter(formatter.DumbWriter(data)) ... parser = htmllib.HTMLParser(fmt) ... parser.feed(html[start:stop]) ... return data Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From sarmstrong13@mac.com Wed Aug 14 20:42:17 2002 From: sarmstrong13@mac.com (SA) Date: Wed, 14 Aug 2002 14:42:17 -0500 Subject: [Tutor] How do I get text from an HTML document. In-Reply-To: <5.1.0.14.0.20020814175530.02aeab38@www.thinkware.se> Message-ID: I reworked your code with some re stuff I saw elsewhere and got the following to work(this is the code that is used to manipulate html in a file called html): def getTextFromHTML(html): data = StringIO.StringIO() story = r'''(?sx).+''' text = re.findall(story, html) text2 = string.join(text) fmt = formatter.AbstractFormatter(formatter.DumbWriter(data)) parser = htmllib.HTMLParser(fmt) parser.feed(text2) return data.getvalue() final = getTextFromHTML(html) This works perfect. Thanks for your help. If anyone sees any way to optimize this code, please let me know. Thanks Again. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From Doug.Shawhan@gecits.ge.com Wed Aug 14 21:08:53 2002 From: Doug.Shawhan@gecits.ge.com (Doug.Shawhan@gecits.ge.com) Date: Wed, 14 Aug 2002 16:08:53 -0400 Subject: [Tutor] pom for py Message-ID: <47B6167F8E69D31194BA0008C7918D4205C54D79@msxcvg02itscge.gecits.ge.com> Hey Folks, Has anyone ever written (or conceived of) an algorithm that can calculate the phases of the moon? I am interested in doing a program in python that will do just that, and I need a starting point! Thanks From arosado@softhome.net Wed Aug 14 21:21:52 2002 From: arosado@softhome.net (Andres Rosado) Date: Wed, 14 Aug 2002 16:21:52 -0400 Subject: [Tutor] Re: Generating sigs with Python for fun and education Message-ID: <5.1.0.14.0.20020814162148.00bb1630@mail.softhome.net> At 04:56 AM 8/13/2002 -0400, you wrote: > > You know about fortune? > >Yes, but the entries can be terribly long sometimes, everybody has it, and >I don't feel like rewriting it in Python just yet =8). Somehow I like the >idea of a signature that is generated new for every email better than one >that is just stuff pulled out of a can... Fortune has a way to limit the words lenght. It's on the man page. ----------------------------------- Andres Rosado Email: andresr@despammed.com ICQ: 66750646 Homepage: http://andres980.tripod.com/ Equal bytes for women. From magnus@thinkware.se Wed Aug 14 21:28:19 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 14 Aug 2002 22:28:19 +0200 Subject: [Tutor] Functions and lists. In-Reply-To: <17144.1029328478@www14.gmx.net> References: <5.1.0.14.0.20020814034243.02b04ba8@www.thinkware.se> Message-ID: <5.1.0.14.0.20020814213624.029f4b30@www.thinkware.se> At 14:34 2002-08-14 +0200, lumbricus@gmx.net wrote: > > >value =3D string.strip(sys.stdin.readline()) > >This is usually done with >value=3Dstring.strip(raw_input("prompt> ")) >IMHO Yep, for interactive programs it usually is. They don't behave _exactly_ the same though. If you redirect or pipe a file to the python program, raw_input will give an EOFError if there is no data available, but sys.stdin.readline will silently return an empty string. One could say that print, input and raw_input are higher level interfaces to sys.stdout and sys.stdin. I usually use them. There are compact and IMO more easy to read and write. If you manipulate stdin or stdout, I'd suggest that you use their read- and write-functions rather than input/raw_input and print though. To me it's much clearer in sys.stdin.seek(0) x =3D sys.stdin.readline() than in sys.stdin.seek(0) x =3D raw_input() that the second line is affected by the first. [Books covering 1.5.2.] >Thats not so unfortunately, because many people still >get 1.5.x with the distribution. It would kill >their python ambitions when none of the example codes worked. With the distribution? By that you mean Red Hat I gather. I do think that Red Hat ought to update the version of Python that they ship by default. In case someone failed to notice, a large part of the Red Hat Linux system relies on /usr/bin/python being the old 1.5.2 version. Their more recent Python RPM install the interpreter as /usr/bin/python2. This is a big hazzle, since a lot of code these days require Python 2.0 or even newer versions, and often the programs expect the interpreter to be called python, not python2! I guess this upgrade won't happen until the next major release. When is RH 8.0 expected??? Anyway, I think there are many more people learning Python 2.2 with books covering Python 1.5.2 than vice versa... Oh well, I still run MS Visual Studio 6, and Windows 98 on my laptop, so maybe Python 1.5.2 isn't so ancient after all... Only three years old... 2.0 is slightly less than 2 years. But a lot of nice new features have appeared in Python in the last years... --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From scot@possum.in-berlin.de Wed Aug 14 09:50:43 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Wed, 14 Aug 2002 10:50:43 +0200 Subject: [Tutor] Generating sigs with Python for fun and education In-Reply-To: <20020814043035.GA8847@localhost.localdomain> References: <200208121254.44192.scot@possum.in-berlin.de> <200208131027.14304.scot@possum.in-berlin.de> <20020814043035.GA8847@localhost.localdomain> Message-ID: <200208141050.43093.scot@possum.in-berlin.de> Hello Prahlad, > Well, you don't have to. There is a python version of > fortune, and strfile lying around somewhere. I downloaded it > recently, but I don't remember the exact link. Google around if > your are interested. Oh, that would be fun. I'll take a look, thank you for the reference. > While we are on the topic, there is also a very nice project, > called "Linux One-Stanza Tip" (LOST). It is quite cool, and > *very* educative for newbies and old hats alike. Now that I've read about. A "POST" (Python One-Stanza Tip) could have Monty Python quotes mixed in every second mail to make things more interesting - this is on a fortune basis, I assume? Y, Scot -- Scot W. Stevenson wrote me on Wednesday, 14. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1376 hours and has a CPU that is falling asleep at a system load of 0.05. From magnus@thinkware.se Wed Aug 14 21:39:45 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 14 Aug 2002 22:39:45 +0200 Subject: [Tutor] How do I get text from an HTML document. In-Reply-To: References: <5.1.0.14.0.20020814175530.02aeab38@www.thinkware.se> Message-ID: <5.1.0.14.0.20020814223312.029e01e0@www.thinkware.se> At 14:18 2002-08-14 -0500, SA wrote: >It does a great job of extracting the text between the two tags. But for >some reason I have a lot of extraneous material after the text that was not >between the two tags and looks like it may have come from the html code >after the end tag. Did I miss something? > > >>> def getTextFromHTML(html, startPattern, endPattern): >... data =3D StringIO.StringIO() >... start =3D html.find(startPattern) >... stop =3D html.find(endPattern, start + 1) >... fmt =3D formatter.AbstractFormatter(formatter.DumbWriter(data)) >... parser =3D htmllib.HTMLParser(fmt) >... parser.feed(html[start:stop]) >... return data That suggests that "stop =3D html.find(endPattern, start + 1)" didn't work as intended? Does stop come out as -1? >>> def getTextFromHTML(html, startPattern, endPattern): ... data =3D StringIO.StringIO() ... start =3D html.find(startPattern) ... stop =3D html.find(endPattern, start + 1) Here we could put in print stop print html[start:stop] to see what that looks like... ... fmt =3D formatter.AbstractFormatter(formatter.DumbWriter(data)) ... parser =3D htmllib.HTMLParser(fmt) ... parser.feed(html[start:stop]) ... return data Hm, I think I see what it was: Did you supply "" as the "endPattern", not "". In your question you had "" both before and after, so I called the function as "getTextFromHTML(html, tag, tag)" With the same tag for before and after. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From Lindsay@pobox.com Wed Aug 14 21:43:27 2002 From: Lindsay@pobox.com (Lindsay Davies) Date: Wed, 14 Aug 2002 21:43:27 +0100 Subject: [Tutor] pom for py In-Reply-To: <47B6167F8E69D31194BA0008C7918D4205C54D79@msxcvg02itscge.gecits.ge.com> References: <47B6167F8E69D31194BA0008C7918D4205C54D79@msxcvg02itscge.gecits.ge.com> Message-ID: Just plug 'moon phase algorithm' into google and you will quickly find what you're looking for. An interesting one is... http://www.moonstick.com/moon_phase_emergency.htm Best wishes, Lindsay >Has anyone ever written (or conceived of) an algorithm that can calculate >the phases of the moon? I am interested in doing a program in python that >will do just that, and I need a starting point! > >Thanks > >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor -- From magnus@thinkware.se Wed Aug 14 21:54:06 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 14 Aug 2002 22:54:06 +0200 Subject: [Tutor] How do I get text from an HTML document. In-Reply-To: References: <5.1.0.14.0.20020814175530.02aeab38@www.thinkware.se> Message-ID: <5.1.0.14.0.20020814223959.02a46888@www.thinkware.se> At 14:42 2002-08-14 -0500, SA wrote: >I reworked your code with some re stuff I saw elsewhere and got the >following to work(this is the code that is used to manipulate html in a= file >called html): > >def getTextFromHTML(html): > data =3D StringIO.StringIO() > story =3D r'''(?sx).+''' > text =3D re.findall(story, html) > text2 =3D string.join(text) > fmt =3D formatter.AbstractFormatter(formatter.DumbWriter(data)) > parser =3D htmllib.HTMLParser(fmt) > parser.feed(text2) > return data.getvalue() > >final =3D getTextFromHTML(html) > >This works perfect. Thanks for your help. If anyone sees any way to= optimize >this code, please let me know. Well, the following change would make your code a bit more general. Perhaps you should even skip the default parameter value and always supply start and end patterns. def getTextFromHTML(html, start=3D"",= end=3D""): ... story =3D '(?sx)%s.+%s' % (start, end) # You don't need a raw string do= you? ... Some day you want to extract text in the or in the etc. Another option could be to write it as a class with some methods.= (Untested.) class Html: def __init__(self, html): self.html =3D html def crop(self, start, end): story =3D '(?sx)%s.+%s' % (start, end) self.html =3D re.findall(story, self.html) def text(self): data =3D StringIO.StringIO() fmt =3D formatter.AbstractFormatter(formatter.DumbWriter(data)) parser =3D htmllib.HTMLParser(fmt) parser.feed("".join(self.html)) return data.getvalue() h =3D Html(html) h.crop('','') print h.text() --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From dyoo@hkn.eecs.berkeley.edu Wed Aug 14 21:48:38 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 14 Aug 2002 13:48:38 -0700 (PDT) Subject: [Tutor] Re: I am a friendly inoffensive non-commercial subject line In-Reply-To: <20020814054824.GA10048@localhost.localdomain> Message-ID: On Wed, 14 Aug 2002, Prahlad Vaidyanathan wrote: > On Tue, 13 Aug 2002 Scot W. Stevenson spewed into the ether: > > [This did have the subject line "High level file handling in the rain" but > > the SMTP mail dragon at mail.python.org didn't like that] > [-- snippity --] > > Looks to me like you are thinking of writing the exact *opposite* of > the StringIO module. ie. Trying to make a file-handle look like a string > (allow splicing, etc.). > > I remembered something that Danny Yoo posted sometime back. > Hmm .. a quick search provides this : > > http://mail.python.org/pipermail/tutor/2002-April/013366.html > > I wonder if Danny has progressed on this one since. It might be a > really interesting project to take up. I had stopped working on it for the moment. One thing drives out another. *grin* But if people are interested, I can take a look at it again when I have more time. From dyoo@hkn.eecs.berkeley.edu Wed Aug 14 21:58:15 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 14 Aug 2002 13:58:15 -0700 (PDT) Subject: [Tutor] Please! In-Reply-To: <20020814013810.18542.qmail@web14802.mail.yahoo.com> Message-ID: On Tue, 13 Aug 2002, preety zinta wrote: > Kindly please do not send any questions of python members to me. My mail > ox storage is exceeding the maximum storage. So, please kind ly please > stop sending those questions from python members to me. Hello, There's a configuration option you can set to keep from getting questions from Tutor. If you wish to turn off Tutor mail delivery, please visit: http://mail.python.org/mailman/listinfo/tutor >From the bottom of this page, you'll see a form that says "Edit Options". >From there, you should see a "Disable mail delivery" radio button, which can be set to "On". Submit this form, and that should fix things. You will still be able to post to Tutor, but you won't automatically receive the questions that other people are posting. You can still access the mailing list archive here: http://mail.python.org/pipermail/tutor/ if you'd like to see what questions other people have been asking. This being said, it's often a good thing to see the kinds of questions people are asking, as they may asking something that interests you. But if you have limited mail storage space, disabling mail delivery may be the best option for you. Good luck! From runsun@bilbo.bio.purdue.edu Wed Aug 14 22:02:50 2002 From: runsun@bilbo.bio.purdue.edu (runsun) Date: Wed, 14 Aug 2002 16:02:50 -0500 Subject: [Tutor] Experiences on python-enabled webhosting In-Reply-To: <20020814160006.3777.57161.Mailman@mail.python.org> Message-ID: Hi all, Can someone provide the experiences of using any python-enabled web hosting service ?? I have been using the FreePageHosting.com for months but recently they transferred my account to a different server and, without my knowledge and consent, they changed my account plan from "unlimited space" to "10 MegaByte". I wrote emails to protest, but they responded with closing down my account without even giving me any chance to backup my files. To conceal their wrongdoings, they also banned me from entering their customer forum. All those were done without any consent from my side. I am pissed off and considering launching a lawsuit against them (although I don't know if a lawsuit against an online company like this is possible). At the same time, I would like to hear some suggestions of using any python-enabled webhosting. Thx. pan ============================================ ~~ Be like water, be shapeless ~~ Runsun Pan, PhD, 773-834-3965 Ecology & Evolution, U of Chicago ============================================ From sarmstrong13@mac.com Wed Aug 14 22:08:14 2002 From: sarmstrong13@mac.com (SA) Date: Wed, 14 Aug 2002 16:08:14 -0500 Subject: [Tutor] How do I get text from an HTML document. In-Reply-To: <5.1.0.14.0.20020814223959.02a46888@www.thinkware.se> Message-ID: On 8/14/02 3:54 PM, "Magnus Lycka" wrote: > Well, the following change would make your code a bit more > general. Perhaps you should even skip the default parameter > value and always supply start and end patterns. > > def getTextFromHTML(html, start="", end=""): > ... > story = '(?sx)%s.+%s' % (start, end) # You don't need a raw string do you? > ... > > Some day you want to extract text in the or in the etc. > > Another option could be to write it as a class with some methods. (Untested.) > > class Html: > def __init__(self, html): > self.html = html > def crop(self, start, end): > story = '(?sx)%s.+%s' % (start, end) > self.html = re.findall(story, self.html) > def text(self): > data = StringIO.StringIO() > fmt = formatter.AbstractFormatter(formatter.DumbWriter(data)) > parser = htmllib.HTMLParser(fmt) > parser.feed("".join(self.html)) > return data.getvalue() > > h = Html(html) > h.crop('','') > print h.text() > Ahh...(he says as the light goes on above his head) Thank You. I had not even thought that far ahead yet. That would definitely be beneficial. Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From dyoo@hkn.eecs.berkeley.edu Wed Aug 14 22:09:33 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 14 Aug 2002 14:09:33 -0700 (PDT) Subject: [Tutor] need to use # sign In-Reply-To: <94FD5825A793194CBF039E6673E9AFE034D61E@bbserver1.backbonesecurity.com> Message-ID: On Wed, 14 Aug 2002, Watt III, Glenn wrote: > ok im writing a cgi and i need to use the # sign in a url. i tried > putting one of these guys down \# but that didnt seem to help like it > does with quotes. is there any way to keep it from reading as comment? There's a different form of escape character to protect weird characters in URLs. Try the 'urllib.quote()' function: ### >>> urllib.quote("#some_text") '%23some_text' ### If the url contains spaces, we can use the quoteplus() function instead: ### >>> urllib.quote("glenn watt") 'glenn%20watt' >>> urllib.quote_plus("glenn watt") 'glenn+watt' ### Hope this helps! From sarmstrong13@mac.com Wed Aug 14 22:13:39 2002 From: sarmstrong13@mac.com (SA) Date: Wed, 14 Aug 2002 16:13:39 -0500 Subject: [Tutor] Experiences on python-enabled webhosting In-Reply-To: Message-ID: On 8/14/02 4:02 PM, "runsun" wrote: > At the same time, I would like to hear some suggestions > of using any python-enabled webhosting. Thx. > Zope if you plan to do the web hosting from your own computer. Good Luck. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From dyoo@hkn.eecs.berkeley.edu Wed Aug 14 22:19:41 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 14 Aug 2002 14:19:41 -0700 (PDT) Subject: [Tutor] need to use # sign In-Reply-To: Message-ID: On Wed, 14 Aug 2002, Danny Yoo wrote: > If the url contains spaces, we can use the quoteplus() function instead: ^^^^^^^^^ Doh. I meant to write "urllib.quote_plus()". My apologies! This being said, the urllib module also has a nice function called urlencode() that may be useful for you: ### >>> urllib.urlencode( [('name', 'dyoo'), ... ('mailing_list', 'tutor@python.org')] ) 'name=dyoo&mailing_list=tutor%40python.org' ### so you may be able to avoid quoting every single cgi parameter manually, and instead use urllib.urlencode() to do it all at once. For more information about these functions, you can take a look at: http://www.python.org/doc/lib/module-urllib.html You're always welcome to ask more questions on Tutor. Best of wishes to you! From dyoo@hkn.eecs.berkeley.edu Wed Aug 14 22:01:49 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 14 Aug 2002 14:01:49 -0700 (PDT) Subject: [Tutor] understanding classes In-Reply-To: <979853.1029321776@[10.0.1.25]> Message-ID: On Wed, 14 Aug 2002, Lance E Sloan wrote: > --On Wednesday, August 14, 2002 3:07 PM +0100 alan.gauld@bt.com wrote: > >> I have one question: As far as you know, is "self" in Python > >> basically the same as "this" in Java? > > > > Exactly so and if it helps you can even call it 'this': > > > > class Foo: > > baz = "Class Foo" > > def bar(this): > > return this.baz > > Thanks for the confirmation. Gregor and others confirmed that for me, > too, also pointing out that it's a keyword in Java, but an explicitly > defined variable in Python. Is there a special term to refer to that > variable, like "instance variable"? > > My next question was going to be, why is the Python convention to name > that variable "self" rather than "this"? I suspect it's just Guido's > choice. Was Java not so well known when this was done? Or is this an > intentional choice to distance Python from Java? There's an extraordinarily important reason for this. Try: ### >>> import this ### at the interactive interpreter. *grin* From kb@kb2.net Wed Aug 14 22:25:25 2002 From: kb@kb2.net (Kyle Babich) Date: Wed, 14 Aug 2002 21:25:25 UT Subject: [Tutor] cmp() Message-ID: <20020814212525.1F8DF937F6@server2.fastmail.fm> I was just reading the UselessPython tutorial with the cmp() program.=20 I haven't learned cmp() yet so while I was reading it I thought I would launch IDLE and try it out, but I can't make sense of it. >>> cmp(937, 22) 1 >>> cmp("abc", "abc") 0 >>> cmp("abc", "def") -1 Why does it say 937 and 22 are equal? Why does it say abc and abc aren't equal? Why does it say -1 for abc and def, shouldn't it say 0? How do I make sense of this? Thank you, -- Kyle From rob@uselesspython.com Wed Aug 14 22:34:44 2002 From: rob@uselesspython.com (Rob) Date: Wed, 14 Aug 2002 16:34:44 -0500 Subject: [Tutor] Experiences on python-enabled webhosting In-Reply-To: Message-ID: I recently posed a similar question to comp.lang.python: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&newwindow=1&safe =off&threadm=Xns921893061DAC0andy47halfcookedcom%40203.109.252.31&rnum=112&p rev=/groups%3Fq%3D%2Bweb%2BOR%2Bhosting%2Bgroup:comp.lang.python%26num%3D100 %26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26newwindow%3D1%26safe%3Doff%26 scoring%3Dd%26as_drrb%3Db%26as_mind%3D12%26as_minm%3D4%26as_miny%3D2002%26as _maxd%3D14%26as_maxm%3D6%26as_maxy%3D2002%26start%3D100%26sa%3DN Rob > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On > Behalf Of runsun > Sent: Wednesday, August 14, 2002 4:03 PM > To: tutor@python.org > Subject: [Tutor] Experiences on python-enabled webhosting > > > > Hi all, > > Can someone provide the experiences of using any > python-enabled web hosting service ?? > > I have been using the FreePageHosting.com for months > but recently they transferred my account to a different > server and, without my knowledge and consent, they > changed my account plan from "unlimited space" to > "10 MegaByte". > > I wrote emails to protest, but they responded with closing > down my account without even giving me any chance to > backup my files. To conceal their wrongdoings, they also > banned me from entering their customer forum. All those > were done without any consent from my side. > > I am pissed off and considering launching a lawsuit against > them (although I don't know if a lawsuit against an online > company like this is possible). > > At the same time, I would like to hear some suggestions > of using any python-enabled webhosting. Thx. > > pan > > ============================================ > ~~ Be like water, be shapeless ~~ > Runsun Pan, PhD, 773-834-3965 > Ecology & Evolution, U of Chicago > ============================================ > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From sarmstrong13@mac.com Wed Aug 14 22:36:47 2002 From: sarmstrong13@mac.com (SA) Date: Wed, 14 Aug 2002 16:36:47 -0500 Subject: [Tutor] Diff Module? Message-ID: Does anyone know of a diff module? Right now I'm going to diff two lists which should not be hard to do, but in the future, it my be prudent to adapt some type of module to do the dirty work. Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From rob@uselesspython.com Wed Aug 14 22:46:24 2002 From: rob@uselesspython.com (Rob) Date: Wed, 14 Aug 2002 16:46:24 -0500 Subject: [Tutor] cmp() In-Reply-To: <20020814212525.1F8DF937F6@server2.fastmail.fm> Message-ID: This is from the Python documentation: "cmp(x, y) Compare the two objects x and y and return an integer according to the outcome. The return value is negative if x < y, zero if x == y and strictly positive if x > y." 932 is greater than 22, so '1' is returned. "abc" and "abc" are equal, so '0' is returned. "abc" is less than "def", so '-1' is returned. If I did my job right, it becomes more clear as Joe Useless fleshes out his program during the course of the article. He develops it so that it provides more meaningful output than '-1', '0', and '1', precisely because there is room for confusion. cmp() is only one of many tools available to the programmer that might benefit from more meaningful output (at least from the end user perspective). Of course, if another function is calling cmp(), it probably wants to see the numerical output. 3;-> Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > Kyle Babich > Sent: Wednesday, August 14, 2002 4:25 PM > To: tutor > Subject: [Tutor] cmp() > > > I was just reading the UselessPython tutorial with the cmp() program. > I haven't learned cmp() yet so while I was reading it I thought I would > launch IDLE and try it out, but I can't make sense of it. > > >>> cmp(937, 22) > 1 > >>> cmp("abc", "abc") > 0 > >>> cmp("abc", "def") > -1 > > Why does it say 937 and 22 are equal? Why does it say abc and abc > aren't equal? Why does it say -1 for abc and def, shouldn't it say 0? > How do I make sense of this? > > Thank you, > -- > Kyle > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From sarmstrong13@mac.com Wed Aug 14 22:46:17 2002 From: sarmstrong13@mac.com (SA) Date: Wed, 14 Aug 2002 16:46:17 -0500 Subject: [Tutor] understanding classes In-Reply-To: Message-ID: On 8/14/02 4:01 PM, "Danny Yoo" wrote: >>>> import this > ### The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! Cute. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From lsloan@umich.edu Wed Aug 14 22:56:24 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Wed, 14 Aug 2002 17:56:24 -0400 Subject: [Tutor] understanding classes In-Reply-To: References: Message-ID: <2020623.1029347784@[192.168.2.201]> --On Wednesday, August 14, 2002 2:01 PM -0700 Danny Yoo wrote: > > On Wed, 14 Aug 2002, Lance E Sloan wrote: >> My next question was going to be, why is the Python convention to name >> that variable "self" rather than "this"? I suspect it's just Guido's >> choice. Was Java not so well known when this was done? Or is this an >> intentional choice to distance Python from Java? > > There's an extraordinarily important reason for this. Try: > >### >>>> import this >### > > at the interactive interpreter. *groan* *sigh* "Extraordinarily important"? The Java-contingent of folks I'll be presenting this to will get a *big* kick out of that. I've been asked to explain Python, in a nutshell, as it were, to others in my workgroup, which are primarily Java and/or Perl developers. Is my work cut out for me or what? -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From kb@kb2.net Wed Aug 14 23:09:23 2002 From: kb@kb2.net (Kyle Babich) Date: Wed, 14 Aug 2002 22:09:23 UT Subject: [Tutor] OT Java Question Message-ID: <20020814220923.1C9649384C@server2.fastmail.fm> While I'm learning Python I'm also learning Java, so I just bought Learning Java 2nd Ed. I was trying the first few simple apps but they didn't work. I have jdk 1.1.8 installed on my computer sdk 1.4, so I did think there would be much of a difference. Anyway, there seems to be an error with import javax.swing.*; (I need it for JFrames) Was javax taken out at some point? Something else? Could someone clear this up for me? Thank you, -- Kyle From campbells4@ozemail.com.au Tue Aug 13 12:48:57 2002 From: campbells4@ozemail.com.au (Alistair Campbell) Date: Tue, 13 Aug 2002 21:48:57 +1000 Subject: [Tutor] [Tutor]Text menus: How to implement Message-ID: <004901c242bf$691d2660$0100a8c0@mshome.net> Hi All, I am practicing with python and I am trying to implement a main menu and a sub menu in text without a GUI. The problem I am having with the logic of the following code is that I can close the sub-menu and get to the main menu but when I try to quit from the main menu I am left in the sub-menu without the introductory text. I know this because if I enter a sub-menu choice it is the sub-menu function(s) that get initiated. As I say, I know I have got the logic of the 'while 1:' statements wrong somehow. If someone can point out how that would be great. Any pointers to a pattern for implementing text based menu's would also be a good learning for me. <> initialisation... a class... some other functions... def main(): MainMenu() def SaveUseMenu(): print print "Would you like to Save or Use this model?" print print "Would you like to Save or Use this model?" print print "1. Save.\n" print "2. Save and Use. \n" print "3. Use.\n" print "4. Quit.\n" while 1: choice = float(raw_input("Enter your choice-->")) if choice == 1: SaveTheModel() if choice ==2: SaveAndUse() if choice == 3: Use() if choice == 4: break MainMenu() def MainMenu(): print print "A General Decision Analysis Program." print print "Have You Ever Had to Make Up Your Mind?" print print "Enter the number for your choice.\n" print "1. Open existing model.\n" print "2. Create a new model.\n" print "3. Quit.\n" print while 1: choice = float(raw_input("Enter your choice-->")) if choice == 1: OpenModel() if choice == 2: NewModel() if choice == 3: print "Quitting the Decisioner.\n" print "Bye for now" break if __name__ == '__main__': main() <> All the best. Alistair Campbell From dyoo@hkn.eecs.berkeley.edu Wed Aug 14 23:23:18 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 14 Aug 2002 15:23:18 -0700 (PDT) Subject: [Tutor] Diff Module? [diff/ndiff] In-Reply-To: Message-ID: On Wed, 14 Aug 2002, SA wrote: > Does anyone know of a diff module? > > Right now I'm going to diff two lists which should not be hard to do, > but in the future, it my be prudent to adapt some type of module to do > the dirty work. Here you go: http://www.python.org/doc/lib/module-difflib.html By the way, the 'viewcvs' program uses a modified version of diff called 'ndiff' that's supposed to be more human-understandable than regular diff. You may be able to adapt it toward your list comparisons. It's located in viewcvs's lib/ directory: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/viewcvs/viewcvs/lib/ndiff.py?rev=1.3&content-type=text/vnd.viewcvs-markup From lsloan@umich.edu Wed Aug 14 23:25:16 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Wed, 14 Aug 2002 18:25:16 -0400 Subject: [Tutor] perl to python translation "phrase book"? In-Reply-To: <5.1.0.14.0.20020814035241.02abc140@www.thinkware.se> References: <5.1.0.14.0.20020814035241.02abc140@www.thinkware.se> Message-ID: <2124503.1029349516@[192.168.2.201]> --On Wednesday, August 14, 2002 3:58 AM +0200 Magnus Lycka wrote: > At 14:26 2002-08-13 -0400, Lance E Sloan wrote: >> Anybody know of a nice Perl to Python translation document, preferrably >> in the form of a "phrase book"? For example, a side-by-side comparison >> of snippets of Perl code and the Python equivalent. > > http://starship.python.net/~da/jak/cookbook.html > http://www.perl.com/pub/a/language/versus/python.html Thanks, those were immediately helpful. I've also ordered a copy of "Perl to Python Migration", by Martin C. Brown, (Addison Wesley). -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From dyoo@hkn.eecs.berkeley.edu Wed Aug 14 23:28:20 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 14 Aug 2002 15:28:20 -0700 (PDT) Subject: [Tutor] cmp() In-Reply-To: <20020814212525.1F8DF937F6@server2.fastmail.fm> Message-ID: On Wed, 14 Aug 2002, Kyle Babich wrote: > I was just reading the UselessPython tutorial with the cmp() program. > I haven't learned cmp() yet so while I was reading it I thought I would > launch IDLE and try it out, but I can't make sense of it. > > >>> cmp(937, 22) > 1 > >>> cmp("abc", "abc") > 0 > >>> cmp("abc", "def") > -1 > > Why does it say 937 and 22 are equal? Why does it say abc and abc > aren't equal? Why does it say -1 for abc and def, shouldn't it say 0? > How do I make sense of this? Hi Kyle: The quick answer is that cmp() isn't meant to be a "boolean" function: it is not meant to say "yes" or "no". Instead, it gives 3 particular values: cmp(x,y) = 0 if x == y some positive value if x > y some negative value if x < y cmp() just does more than you expect, so don't worry too much. Everyone gets caught by this at least once, because we're all so used to seeing boolean functions. Hope this helps! From bjmartin98@pennswoods.net Wed Aug 14 23:30:54 2002 From: bjmartin98@pennswoods.net (Billie) Date: Wed, 14 Aug 2002 18:30:54 -0400 Subject: [Tutor] Going Loopy over Loops Message-ID: <002701c243e2$41880ba0$b3f2d841@bjmartin98> This is a multi-part message in MIME format. ------=_NextPart_000_0024_01C243C0.B99C3840 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello: I'm using Win95 and Python version 2.2. I'm new to Python and = programming. I'm having trouble understanding how loops work, especially when they = contain conditional statements. I have an exercise that I would like = help with. By help I mean explain what's going on. I know what I'm = asking is going to be time consuming but I'm kinda stuck here and you = guys are my only source of programming help. #Rewrite the area.py program to hae a separate function for=20 # the area of a square, the area of a rectangle, and the area # of a circle. This program should include a menu interface. print "The Area Calculator" print "Please choose a letter for the option needed." print print def print_options(): print "Options:" print " 'p' Please choose an option." print " 'c' Calculate the area of a Circle" print " 'r' Calculate the area of a Rectangle" print " 's' Calculate the area of a Square" print " 'q' To quit the program" def areaOfCircle(c_radius): return 3.14*c_radius**2 def areaOfRectangle(length,width): return length*width def areaOfSquare(s_side): return s_side**2 choice =3D"p" while choice !=3D "q": if choice =3D=3D "c": radius =3D imput("Enter radius of circle: ") while radius <=3D 0: print "The number entered must be positive." radius =3D imput("Enter radius of circle: ") print "Area of circle is: ",areaOfCircle(radius) elif choice =3D=3D "r": l =3D=3Dinput("Enter length: ") while l <=3D 0: print "The number must be positive." l =3D input("Enter length: ") w =3D input("Enter width: ") while w <=3D 0: print "The number must be positive." w =3D input("Enter width: ") print "The area of a rectangle is: ",areaOfRectangle(l,w) elif choice =3D "s": side =3D input("Enter side length: ") while side <=3D 0: print "The number entered must be positive." side =3D input("Enter side length: ") print "The area of a square is: ",areaOfSquare(side) elif choice !=3D "q": print_options() choice =3D raw_input("Option: ") This program works as written. But beside knowing what the loops are = doing I have a few questions about redundancy. There seems to be a lot = of them in my program. Could I have made the positive number loop a = function? Is it necessary, say for instance in "choice c", when I = construct my while loop for the positive number to state again radius = =3D input("Enter length:"). Anyone who would take the time to help me would be greatly appreciated. bjmartin@pennswoods.net =20 ------=_NextPart_000_0024_01C243C0.B99C3840 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hello:
I'm using Win95 and Python version 2.2. = I'm new to=20 Python and programming.
 
I'm having = trouble understanding how=20 loops work, especially when they contain conditional statements.  I = have an=20 exercise that I would like help with. By help I mean explain what's = going=20 on.  I know what I'm asking is going to be time consuming but I'm = kinda=20 stuck here and you guys are my only source of programming = help.
 
#Rewrite the area.py program to hae a = separate=20 function for
# the area of a square, the area of a = rectangle,=20 and the area
# of a circle.  This program = should include a=20 menu interface.
 
print "The Area = Calculator"
print "Please choose a letter for the = option=20 needed."
print
print
 
def print_options():
    print = "Options:"
    print " 'p' Please = choose an=20 option."
    print " 'c' = Calculate the area=20 of a Circle"
    print " 'r'  = Calculate the=20 area of a Rectangle"
    print " = 's' Calculate the=20 area of a Square"
    print " 'q' To quit = the=20 program"
 
def = areaOfCircle(c_radius):
    return=20 3.14*c_radius**2
 
def = areaOfRectangle(length,width):
    return = length*width
 
def areaOfSquare(s_side):
    return = s_side**2
 
choice =3D"p"
while choice !=3D "q":
    if choice =3D=3D = "c":
        = radius =3D=20 imput("Enter radius of circle: ")
        while=20 radius <=3D 0:
          &nbs= p; print=20 "The number  entered must be positive."
       =20     radius =3D imput("Enter radius of circle: = ")
        = print "Area=20 of circle is: ",areaOfCircle(radius)
    elif choice =3D=3D = "r":
        l = =3D=3Dinput("Enter length: ")
        = while l <=3D=20 0:
       =20     print "The number must be positive."
       =20     l =3D input("Enter length: ")
        w =3D=20 input("Enter width: ")
        = while w <=3D=20 0:
       =20     print "The number must be positive."
       =20     w =3D input("Enter width: ")
        = print "The=20 area of a rectangle is: ",areaOfRectangle(l,w)
    elif choice =3D = "s":
        = side =3D=20 input("Enter side length: ")
        = while side=20 <=3D 0:
       =20     print "The number entered must be = positive."
       =20     side =3D input("Enter side length: ")
        = print "The=20 area of a square is: ",areaOfSquare(side)
    elif choice !=3D = "q":
       =20 print_options()
    choice =3D = raw_input("Option:=20 ")
 
This program works as written.  = But beside=20 knowing what the loops are doing I have a few questions about = redundancy. =20 There seems to be a lot of them in my = program.  Could I have made the positive number loop a = function?  Is=20 it necessary, say for instance in "choice c",  when I construct my = while=20 loop for the positive number to state again radius =3D input("Enter=20 length:").
 
Anyone who would take the time to help = me would be=20 greatly appreciated.
 
bjmartin@pennswoods.net
       =20
------=_NextPart_000_0024_01C243C0.B99C3840-- From kb@kb2.net Wed Aug 14 23:33:35 2002 From: kb@kb2.net (Kyle Babich) Date: Wed, 14 Aug 2002 22:33:35 UT Subject: [Tutor] cmp() Message-ID: <20020814223335.CEBA79384F@server2.fastmail.fm> Ok, so based on this I tried: ########## from sys import * arg1 =3D stdin.readline()[-1:] arg2 =3D stdin.readline()[-1:] compar =3D cmp(arg1, arg2) if compar =3D=3D 1: print "first greater" elif compar =3D=3D 0: print "equal" elif compar =3D=3D -1: print "second greater" else: print "error" ########## So why no matter what I enter it returns that they are equal? On Wed, 14 Aug 2002 16:46:24 -0500, "Rob" said: > This is from the Python documentation: >=20 > "cmp(x, y) > Compare the two objects x and y and return an integer according to the > outcome. The return value is negative if x < y, zero if x =3D=3D y and > strictly > positive if x > y." >=20 > 932 is greater than 22, so '1' is returned. > "abc" and "abc" are equal, so '0' is returned. > "abc" is less than "def", so '-1' is returned. >=20 > If I did my job right, it becomes more clear as Joe Useless fleshes out > his > program during the course of the article. He develops it so that it > provides > more meaningful output than '-1', '0', and '1', precisely because there > is > room for confusion. cmp() is only one of many tools available to the > programmer that might benefit from more meaningful output (at least > from the > end user perspective). Of course, if another function is calling cmp(), > it > probably wants to see the numerical output. >=20 > 3;-> > Rob > http://uselesspython.com >=20 > > -----Original Message----- > > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf= Of > > Kyle Babich > > Sent: Wednesday, August 14, 2002 4:25 PM > > To: tutor > > Subject: [Tutor] cmp() > > > > > > I was just reading the UselessPython tutorial with the cmp() program. > > I haven't learned cmp() yet so while I was reading it I thought I wou= ld > > launch IDLE and try it out, but I can't make sense of it. > > > > >>> cmp(937, 22) > > 1 > > >>> cmp("abc", "abc") > > 0 > > >>> cmp("abc", "def") > > -1 > > > > Why does it say 937 and 22 are equal? Why does it say abc and abc > > aren't equal? Why does it say -1 for abc and def, shouldn't it say 0= ? > > How do I make sense of this? > > > > Thank you, > > -- > > Kyle > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > http://mail.python.org/mailman/listinfo/tutor > > >=20 >=20 >=20 > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor >=20 -- Kyle From dyoo@hkn.eecs.berkeley.edu Wed Aug 14 23:37:36 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 14 Aug 2002 15:37:36 -0700 (PDT) Subject: [Tutor] OT Java Question In-Reply-To: <20020814220923.1C9649384C@server2.fastmail.fm> Message-ID: On Wed, 14 Aug 2002, Kyle Babich wrote: > While I'm learning Python I'm also learning Java, so I just bought > Learning Java 2nd Ed. I was trying the first few simple apps but they > didn't work. I have jdk 1.1.8 installed on my computer sdk 1.4, so I > did think there would be much of a difference. Hi Kyle, You may want to ask on another mailing list about Java-specific questions, just because many of us here may not have Java experience yet. Sun does host its own forums for learning and using the Java language, so you may find these links helpful: http://forum.java.sun.com/forum.jsp?forum=14 http://forum.java.sun.com/ Back to your question: the version does make a difference. The javax.swing module was added fairly recently, so my suspicion is that you may be running with the 1.1.8 javac libraries instead of the 1.4 ones. For the javax.swing stuff, you'll need to use the latest version of the Java Development Kit (JDK). You can visit: http://java.sun.com/ to get the latest version of the JDK. Best of wishes to you! From dyoo@hkn.eecs.berkeley.edu Wed Aug 14 23:39:09 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 14 Aug 2002 15:39:09 -0700 (PDT) Subject: [Tutor] cmp() In-Reply-To: <20020814223335.CEBA79384F@server2.fastmail.fm> Message-ID: On Wed, 14 Aug 2002, Kyle Babich wrote: > Ok, so based on this I tried: > > ########## > from sys import * > > arg1 = stdin.readline()[-1:] > arg2 = stdin.readline()[-1:] > > compar = cmp(arg1, arg2) > > if compar == 1: > print "first greater" > elif compar == 0: > print "equal" > elif compar == -1: > print "second greater" > else: > print "error" > ########## > > So why no matter what I enter it returns that they are equal? Hi Kyle, Can you explain what these two lines are doing? > arg1 = stdin.readline()[-1:] > arg2 = stdin.readline()[-1:] Good luck! From sarmstrong13@mac.com Wed Aug 14 23:44:52 2002 From: sarmstrong13@mac.com (SA) Date: Wed, 14 Aug 2002 17:44:52 -0500 Subject: [Tutor] Another Class question. Message-ID: Hi Everyone- While we are the subject of classes, here is one more question for you (at least I hope it is one more...): If I have the following class- Class Fud: def __init__(self, text) self.text = text # does this create an instance? def search(self, start, end): tags = r'''%s.+%s''' % (start, end) def extract(self): self.text = re.findall(tags, self.text) First off, is this written correctly? If not where did I goof? Secondly, tags in the extract funtion should be the same as the final tags in the search function. So should I be using tags, self.tags, or search.tags in the extract function in order to pass along the correct value to that function? So my main question deals with namespace defining in this class. By the way I purposefully broke this class down into three functions. I know I could have done it in two, but I wanted three to give an example of the namespace question. Thanks in advance. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From jmz@satx.rr.com Thu Aug 15 00:07:03 2002 From: jmz@satx.rr.com (John Ziriax) Date: Wed, 14 Aug 2002 18:07:03 -0500 Subject: [Tutor] One character output In-Reply-To: <20020814222415.20312.6320.Mailman@mail.python.org> References: <20020814222415.20312.6320.Mailman@mail.python.org> Message-ID: <200208142301.g7EN1NmE008738@sm12.texas.rr.com> I want to print out one character at a time without any return. print "x", prints the character X, but adds a space afterwards. How do I stop the space and print just the single character? Thanks in advance, John From magnus@thinkware.se Thu Aug 15 00:11:16 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Thu, 15 Aug 2002 01:11:16 +0200 Subject: [Tutor] understanding classes In-Reply-To: <2020623.1029347784@[192.168.2.201]> References: Message-ID: <5.1.0.14.0.20020815003411.02a61d40@www.thinkware.se> At 17:56 2002-08-14 -0400, Lance E Sloan wrote: >I've been asked to explain Python, in a nutshell, as it were, to others in= =20 >my workgroup, which are primarily Java and/or Perl developers. Is my work= =20 >cut out for me or what? It don't think they will get stuck on "this". As you can read in http://www.python.org/doc/essays/foreword.html the main influences for Python was ABC and Modula-3. If memory serves me right, "self" comes from Modula-3. There is even a programming language called "Self", so that word should not come as a surprise. Tim Peters' "poem" is much more recent than the self convention, so obviously "import this" is a very recent "feature". And remember, Python started in 1989, long before Java. But it wasn't backed by one of the worlds largest computer companies. For the Perl hackers you can say that it's briefly Perl with most $, @, { and } removed, with proper intentation required, and they can forget all traces of sed and awk syntax, as well as backward constructions such as "unless" and putting the block before if and the condition after. They might find it boring to write, but probably much less stressful to understand if they need to change someone elses code (or something they wrote more than a few months ago). The Perl OO model is based on Python, but in the Python incarnation it has sane names, and isn't bolted on in version five. Actually, Tim's poem has a lot of points (even if it tries to be a little funny as well.) Why don't you run Guido's excellent presentation for them. As a programmer you should see the virtue in reuse: http://www.python.org/doc/essays/ppt/lwnyc2002/intro22.ppt If you understand all in this intro, you won't have any problems. There is also some issues for Java -> Python transition in http://www.python.org/doc/essays/ppt/hp-training/sld022.htm I think this presentation might be a bit tough for complete beginners though. Obviously these kinds of presentations are only brief summaries of what one might say in such a presentation. Get back if you plan to use one of there but are lost about what some particular thing means. At http://www.bagley.org/~doug/shootout/ you can find a lot of examples of code written in different languages. Most of the Python code is neither very pretty, nor very clever, but at least you can show some examples of Perl, Python and Java used for the same purpose. My general problem with those programs is that they don't show the great strengths of Python, such as the standard libraries for internet etc. You can write a complete web server in just a few lines of code. Or an XML/RPC-server. Change two lines of code and it's a threading version. Etc. Some testimonials can be found at http://www.thinkware.se/cgi-bin/thinki.cgi/PythonQuotes Good Luck! /Magnus --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From dyoo@hkn.eecs.berkeley.edu Thu Aug 15 00:14:13 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 14 Aug 2002 16:14:13 -0700 (PDT) Subject: [Tutor] One character output In-Reply-To: <200208142301.g7EN1NmE008738@sm12.texas.rr.com> Message-ID: On Wed, 14 Aug 2002, John Ziriax wrote: > I want to print out one character at a time without any return. > > print "x", > > prints the character X, but adds a space afterwards. > > How do I stop the space and print just the single character? Hi John, For really fine-grained control over standard output, you can use the write() method in the 'sys.stdout' object: ### >>> import sys >>> def test(): ... sys.stdout.write("hello") ... sys.stdout.write("world") ... >>> test() helloworld>>> ### sys.stdout.write() will write exactly what you send to it, without inserting spaces or newlines. If you have more questions, please feel free to ask on Tutor. From scot@possum.in-berlin.de Wed Aug 14 22:08:55 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Wed, 14 Aug 2002 23:08:55 +0200 Subject: [Tutor] RE: New file stuff In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C82D@mbtlipnt02.btlabs.bt.co.uk> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C82D@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <200208142308.55725.scot@possum.in-berlin.de> Hello Alan, > Pascal has the rather nice feature of defining binary > files in terms of the high level dta types you want to > store. Thus if we define a class Foo we can declare a > FILE OF FOO Okay, I found a text on Pascal that say stuff like FILE OF CHAR and FILE OF PACKED ARRAY [1...40] OF CHAR - but isn't this better handled by Python's pickle module? > I don't mean define the interface I mean actually write > a prototype of the basic open/read/write/slice operations > as a class. Oh. Well, I'll just start pecking on it and see how far I get. Whenever I get stuck, I can always come back here =8). > To radically change how we use files we need to change > how we design the hardware! Well, that might be somewhat outside of my range at the moment, but I'll keep it in mind =X)... Y, Scot -- Scot W. Stevenson wrote me on Wednesday, 14. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1388 hours and has a CPU that is falling asleep at a system load of 0.05. From magnus@thinkware.se Thu Aug 15 00:24:09 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Thu, 15 Aug 2002 01:24:09 +0200 Subject: [Tutor] Another Class question. In-Reply-To: Message-ID: <5.1.0.14.0.20020815011329.02a31c00@www.thinkware.se> At 17:44 2002-08-14 -0500, SA wrote: >Hi Everyone- > >While we are the subject of classes, here is one more question for you (at >least I hope it is one more...): > >If I have the following class- > >Class Fud: > def __init__(self, text) > self.text =3D text # does this create an instance? No, you create an instance when you write x =3D Fud('dfgdfg') __init__() is run when you create an instance. It doesn't create the instance. If you don't want anything particular to happen when you create the instance, you can skip __init__. > def search(self, start, end): > tags =3D r'''%s.+%s''' % (start, end) > def extract(self): > self.text =3D re.findall(tags, self.text) > >First off, is this written correctly? If not where did I goof? Secondly, >tags in the extract funtion should be the same as the final tags in the >search function. So should I be using tags, self.tags, or search.tags in= the >extract function in order to pass along the correct value to that function? >So my main question deals with namespace defining in this class. The first parameter to a method, conventionally called self, is the instance object. If x is an instance of Fud, x.extract() is just a short form of Fud.extract(x). So if the value of "tags" is to live beyond the execution of the search method, you need "self.tags =3D r'''...", and to access it in extract you need "re.findall(self.tags ..." A plain "tags" would be a local variable that is garbage collected as soon as i goes out of scope (end of method). Search.tags would not help. "Tags" need to be an attribute of the particular instance object, not the method. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From gus.tabares@verizon.net Thu Aug 15 01:12:20 2002 From: gus.tabares@verizon.net (Gus Tabares) Date: Wed, 14 Aug 2002 20:12:20 -0400 Subject: [Tutor] Another Class question. In-Reply-To: Message-ID: Hello, I just wanted to point out that it is "class" and not "Class". I know it's trivial, but just thought I'd point it out;P Gus -----Original Message----- From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of SA Sent: Wednesday, August 14, 2002 6:45 PM To: 'tutor@python.org' Subject: [Tutor] Another Class question. Hi Everyone- While we are the subject of classes, here is one more question for you (at least I hope it is one more...): If I have the following class- Class Fud: def __init__(self, text) self.text = text # does this create an instance? def search(self, start, end): tags = r'''%s.+%s''' % (start, end) def extract(self): self.text = re.findall(tags, self.text) First off, is this written correctly? If not where did I goof? Secondly, tags in the extract funtion should be the same as the final tags in the search function. So should I be using tags, self.tags, or search.tags in the extract function in order to pass along the correct value to that function? So my main question deals with namespace defining in this class. By the way I purposefully broke this class down into three functions. I know I could have done it in two, but I wanted three to give an example of the namespace question. Thanks in advance. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From aicolburn@yahoo.com Thu Aug 15 01:30:23 2002 From: aicolburn@yahoo.com (Alan Colburn) Date: Wed, 14 Aug 2002 17:30:23 -0700 Subject: [Tutor] Saving Files for Spreadsheet Exporting Message-ID: <009d01c243f2$f20362d0$cae68b86@fo5132> Two quick questions today: 1) I'd like to save a file, with a list of lists, in a format that could be read directly into a spreadsheet. Each list would represent a different row, and each list element a different column. How would I go about doing this? (List elements are strings.) 2) In the interest of "teaching a man to fish" (rather than "giving him a fish"), how would you go about searching the Python documentation to find an answer to this question? ... That's where I started, but I wasn't successful :-) Thanks, as always! -- Al From kb@kb2.net Thu Aug 15 02:05:58 2002 From: kb@kb2.net (Kyle Babich) Date: Thu, 15 Aug 2002 01:05:58 UT Subject: [Tutor] cmp() Message-ID: <20020815010558.A462A938AD@server2.fastmail.fm> On Wed, 14 Aug 2002 15:39:09 -0700 (PDT), "Danny Yoo" said: >=20 >=20 > On Wed, 14 Aug 2002, Kyle Babich wrote: >=20 > > Ok, so based on this I tried: > > > > ########## > > from sys import * > > > > arg1 =3D stdin.readline()[-1:] > > arg2 =3D stdin.readline()[-1:] > > > > compar =3D cmp(arg1, arg2) > > > > if compar =3D=3D 1: > > print "first greater" > > elif compar =3D=3D 0: > > print "equal" > > elif compar =3D=3D -1: > > print "second greater" > > else: > > print "error" > > ########## > > > > So why no matter what I enter it returns that they are equal? >=20 > Hi Kyle, >=20 > Can you explain what these two lines are doing? >=20 > > arg1 =3D stdin.readline()[-1:] > > arg2 =3D stdin.readline()[-1:] >=20 Taking user input, removing the \n that is put at the end of it by default & dumping it into arg1 and arg2. >=20 > Good luck! Thank you >=20 >=20 -- Kyle From kb@kb2.net Thu Aug 15 02:09:04 2002 From: kb@kb2.net (Kyle Babich) Date: Thu, 15 Aug 2002 01:09:04 UT Subject: [Tutor] OT Java Question Message-ID: <20020815010904.61AB9938AD@server2.fastmail.fm> On Wed, 14 Aug 2002 15:37:36 -0700 (PDT), "Danny Yoo" said: >=20 >=20 > On Wed, 14 Aug 2002, Kyle Babich wrote: >=20 > > While I'm learning Python I'm also learning Java, so I just bought > > Learning Java 2nd Ed. I was trying the first few simple apps but the= y > > didn't work. I have jdk 1.1.8 installed on my computer sdk 1.4, so I > > did think there would be much of a difference. >=20 >=20 > Hi Kyle, >=20 > You may want to ask on another mailing list about Java-specific > questions, > just because many of us here may not have Java experience yet. Sun > does > host its own forums for learning and using the Java language, so you > may > find these links helpful: >=20 > http://forum.java.sun.com/forum.jsp?forum=3D14 > http://forum.java.sun.com/ >=20 >=20 > Back to your question: the version does make a difference. The > javax.swing module was added fairly recently, so my suspicion is that > you > may be running with the 1.1.8 javac libraries instead of the 1.4 ones. > For the javax.swing stuff, you'll need to use the latest version of the > Java Development Kit (JDK). You can visit: >=20 > http://java.sun.com/ >=20 > to get the latest version of the JDK. >=20 >=20 > Best of wishes to you! >=20 >=20 Yes, I'm just having some trouble finding a discussion list as devoted to java as this list is to python. Anyway I decided the best way to do it is to install the java sdk version that came on the cd with the book. -- Kyle From dylan.belsey@baesystems.com Thu Aug 15 02:15:48 2002 From: dylan.belsey@baesystems.com (BELSEY, Dylan) Date: Thu, 15 Aug 2002 10:45:48 +0930 Subject: [Tutor] Saving Files for Spreadsheet Exporting Message-ID: <86C3892A0C52D411AF5000A0C9EAA3B96320E5@wtntex1.baea.com.au> Hi Alan, I'm quite sure that you have considered this but the simplistic way is to loop through the list and append a tab "\t" or a ";" etc to the end of each string and write to a file. In pseudo code: open file for writing for each element in outerlist for each element in the innnerlist obtain the string append delimiting character write to file write newline to a file close the file I would probably consider this to be slow if speed was an issue for you, as the lists have to be iterated through and file I/O may also consume some time. Unfortunately I don't know Python that well to suggest any inbuilt Python to aid the process. As far as implementing the above pseudo code, I would begin searching the docs for file reading and writing etc and string operations (I don't mean the 'string' module as such). HTH Dylan -----Original Message----- From: Alan Colburn [mailto:aicolburn@yahoo.com] Sent: Thursday, 15 August 2002 10:30 To: Python Tutor List Subject: [Tutor] Saving Files for Spreadsheet Exporting Two quick questions today: 1) I'd like to save a file, with a list of lists, in a format that could be read directly into a spreadsheet. Each list would represent a different row, and each list element a different column. How would I go about doing this? (List elements are strings.) 2) In the interest of "teaching a man to fish" (rather than "giving him a fish"), how would you go about searching the Python documentation to find an answer to this question? ... That's where I started, but I wasn't successful :-) Thanks, as always! -- Al _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From dylan.belsey@baesystems.com Thu Aug 15 02:27:14 2002 From: dylan.belsey@baesystems.com (BELSEY, Dylan) Date: Thu, 15 Aug 2002 10:57:14 +0930 Subject: [Tutor] where does pythonpath go? Message-ID: <86C3892A0C52D411AF5000A0C9EAA3B96320E6@wtntex1.baea.com.au> Hi Laney, Not sure if this helps but you may want to remove PIL and re-install it in C:\MyPrograms\Python22 ie. where your Python installation lives. I had to do this when installing Pmw (Python Mega Widgets for Tkinter). Haven't tried the Pil so not a guaranteed fix but I suppose it's worth a try if nothing else works. Perhaps you might want to post the error, on this list, that you get when you try to import the functions etc. It may yield more information as to the problem. It may come down to adding to PYTHONPATH???? Dylan -----Original Message----- From: Laney Mills [mailto:millsl@cofc.edu] Sent: Wednesday, 14 August 2002 21:17 To: 'tutor@python.org' Subject: [Tutor] where does pythonpath go? I'm running Python 2.2 on a Windows 98se system. I just downloaded the pil thing (what is it called, a library?), but, of course, the Python2.2 couldn't find it. The install program put it in C:\py22. My python installation is in c:\my programs\python22. I drug the three files in the distribution: pil, dlls, and samples into my python22 directory under the filename pil: ex: C:\program files\python22\pil\{dlls, pil, samples} Still the python couldn't find it. I checked vis sys sys.path and the pil stuff isn't there, so of course, I need to put it there somehow. Incidentally, I had no difficulty like this at all with the visual library. I installer found the python22 directory and put the visual stuff in a subdirectory and python found it with no trouble. This experience is surely one that everyone using pil on a windows system would run into, yet as far as I can tell, the entire python documentation system takes the point of view that there is no such problem. frustration Thanks in advance. Laney Mills _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From rickp@telocity.com Thu Aug 15 02:24:56 2002 From: rickp@telocity.com (Rick Pasotto) Date: Wed, 14 Aug 2002 21:24:56 -0400 Subject: [Tutor] cmp() In-Reply-To: <20020815010558.A462A938AD@server2.fastmail.fm> References: <20020815010558.A462A938AD@server2.fastmail.fm> Message-ID: <20020815012456.GO8720@tc.niof.net> On Thu, Aug 15, 2002 at 01:05:58AM +0000, Kyle Babich wrote: > On Wed, 14 Aug 2002 15:39:09 -0700 (PDT), "Danny Yoo" > said: > > > > > > So why no matter what I enter it returns that they are equal? > > > > Hi Kyle, > > > > Can you explain what these two lines are doing? > > > > > arg1 = stdin.readline()[-1:] > > > arg2 = stdin.readline()[-1:] > > Taking user input, removing the \n that is put at the end of it by > default & dumping it into arg1 and arg2. Really? :-) Are you sure about that? Don't you think that the following would work better? arg1 = stdin.readline()[:-1] arg2 = stdin.readline()[:-1] Could it be that '\n' is always equal to '\n'? -- "When people tell you we couldn't support the government on a voluntary basis, [tell them that] we could support _a_ government, but [it] sure as hell [is] not this one." --- Rob Thorn Rick Pasotto rickp@telocity.com http://www.niof.net From dyoo@hkn.eecs.berkeley.edu Thu Aug 15 02:25:25 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 14 Aug 2002 18:25:25 -0700 (PDT) Subject: [Tutor] cmp() In-Reply-To: <20020815010558.A462A938AD@server2.fastmail.fm> Message-ID: On Thu, 15 Aug 2002, Kyle Babich wrote: > > > from sys import * > > > > > > arg1 = stdin.readline()[-1:] > > > arg2 = stdin.readline()[-1:] > > > > > > compar = cmp(arg1, arg2) > > > > > > if compar == 1: > > > print "first greater" > > > elif compar == 0: > > > print "equal" > > > elif compar == -1: > > > print "second greater" > > > else: > > > print "error" > > > ########## > > > > > > So why no matter what I enter it returns that they are equal? > > > > Hi Kyle, > > > > Can you explain what these two lines are doing? > > > > > arg1 = stdin.readline()[-1:] > > > arg2 = stdin.readline()[-1:] > > > > Taking user input, removing the \n that is put at the end of it by > default & dumping it into arg1 and arg2. Are you sure? (Test out those two statements in the interactive interpreter, and you should find the bug quickly. Don't worry, you'll see it quickly. *grin*) By the way, a safer way of removing whitespace at the end of the line uses the rstrip() method on strings. This is similar to Java's trim() string method, but rstrip() just chomps from the right side of a string. Good luck! From sarmstrong13@mac.com Thu Aug 15 02:58:36 2002 From: sarmstrong13@mac.com (SA) Date: Wed, 14 Aug 2002 20:58:36 -0500 Subject: [Tutor] Another Class question. In-Reply-To: <5.1.0.14.0.20020815011329.02a31c00@www.thinkware.se> Message-ID: On 8/14/02 6:24 PM, "Magnus Lycka" wrote: > The first parameter to a method, conventionally called self, is > the instance object. If x is an instance of Fud, x.extract() is > just a short form of Fud.extract(x). > > So if the value of "tags" is to live beyond the execution of > the search method, you need "self.tags = r'''...", and to access > it in extract you need "re.findall(self.tags ..." > > A plain "tags" would be a local variable that is garbage collected > as soon as i goes out of scope (end of method). Search.tags would > not help. "Tags" need to be an attribute of the particular instance > object, not the method. > Ahah!(I hope) Let me make sure I understand You here: 1. When you create the instance x = Fud(), any string I pass to x is run through __init__ and then passed to def extract through self.text? 2. But def extract will do nothing for 2 reasons. One, start and end were never passed to the Class? Two, even if they had been passed, data from the function search is not passed to the function extract? 3. so by saying x = Fud(text) is the same as Fud(x, text) which is saying: class Fud: def __init__(x, text): x.text = text Is this correct? (Keep in mind I'm trying to make this as general as possible) So what I would like to do then is pass the data into the class, let the class do all of the work, and then return the modified data. At the same time, to make the class work for the a more general situation, it would also have to be able to pass data to just part of the class and return the output. Am I on the right track here now, because this is one of the more difficult concepts to grasp for a newbie. Thanks in Advance. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From sarmstrong13@mac.com Thu Aug 15 03:03:30 2002 From: sarmstrong13@mac.com (SA) Date: Wed, 14 Aug 2002 21:03:30 -0500 Subject: [Tutor] Saving Files for Spreadsheet Exporting In-Reply-To: <86C3892A0C52D411AF5000A0C9EAA3B96320E5@wtntex1.baea.com.au> Message-ID: On 8/14/02 8:15 PM, "BELSEY, Dylan" wrote: > Hi Alan, > I'm quite sure that you have considered this but the simplistic way > is to loop through the list and append a tab "\t" or a ";" etc to the end of > each string and write to a file. In pseudo code: > Actually you can use any type of symbol and then filter the file within excel. Good Luck. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From sarmstrong13@mac.com Thu Aug 15 03:27:59 2002 From: sarmstrong13@mac.com (SA) Date: Wed, 14 Aug 2002 21:27:59 -0500 Subject: [Tutor] cmp() In-Reply-To: Message-ID: Quick question: Where is cmp.py located? I could not find it on useless python. Thanks. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From dylan.belsey@baesystems.com Thu Aug 15 04:50:46 2002 From: dylan.belsey@baesystems.com (BELSEY, Dylan) Date: Thu, 15 Aug 2002 13:20:46 +0930 Subject: FW: [Tutor] where does pythonpath go? Message-ID: <86C3892A0C52D411AF5000A0C9EAA3B96320E7@wtntex1.baea.com.au> Laney, will forward this on to the python tutor list as someone will undoubtedly be able to help and it keeps everyone informed and learning :) Couple of things, though it won't solve your problem. I'm partial to leaving the autoexec.bat file alone and usually set these variables using the ENVIRONMENT tab in System, under Control Panel. I don't have a '98 machine with me so I can't remember if it is found in the same place. If it is then you would want: Variable: PYTHONPATH Value: C:\myprogr~\python22\pilfiles\pil;C:\myprogr~\python22\pilfiles\dlls;C:\mypr ogr~\python22\pilfiles\samples or add to the variable the directories where the installer put your files rather than moving them around. The error that you have reported below from the python prompt does seem to indicate that it cannot locate the module you are trying to import. Silly question...but have you checked that image.py or image.pyd or image.dll exists in the directory - just checking all avenues :) You can put the directory that it lives in, in PYTHONPATH. Alternatively, I could be completely off track and in that case I hope that I get picked up on it and someone else can solve your prob.....particularly anyone with PIL experience. Dylan -----Original Message----- From: Laney Mills [mailto:millsl@cofc.edu] Sent: Thursday, 15 August 2002 11:58 To: 'BELSEY, Dylan' Subject: RE: [Tutor] where does pythonpath go? Hi Dylan, Thanks a lot for your note. The PIL installer give no choice. It says "I am putting it in C:\py22 ... . The only choice is to accept or cancel. I did put in a pythonpath statement in my autoexec file: C:\PROGRA~1\NORTON~1\NAVDX.EXE /Startup SET SOUND=C:\PROGRA~1\CREATIVE\CTSND SET MIDI=SYNTH:1 MAP:E MODE:0 SET BLASTER=A220 I9 D3 H7 P300 E620 T6 SET PATH=C:\WINDOWS\SYSTEM;%PATH% set pythonpath=C:\myprogr~\python22\pilfiles\pil;C:\myprogr~\python22\pilfil es\dlls;C:\myprogr~\python22\pilfiles\samples When I ran the autoexec file, it say I was out of envonment space. Here it is Scanning Memory... OK Scanning Master Boot Records... OK Scanning Boot Record... OK Scanning files... DONE C:\>SET SOUND=C:\PROGRA~1\CREATIVE\CTSND C:\>SET MIDI=SYNTH:1 MAP:E MODE:0 C:\>SET BLASTER=A220 I9 D3 H7 P300 E620 T6 C:\> C:\>SET PATH=C:\WINDOWS\SYSTEM;C:\WINDOWS\SYSTEM;C:\WINDOWS;C:\WINDOWS\COMMAND Out of environment space C:\>set pythonpath=C:\myprogr~\python22\pilfiles\pil;C:\myprogr~\python2 2\pilfil es\dlls;C:\myprogr~\python22\pilfiles\samples C:\>and it still does this: Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. IDLE Fork 0.8 -- press F1 for help >>> import image Traceback (most recent call last): File "", line 1, in ? import image ImportError: No module named image >>> I guess I need to say I now have the pil directory and the samples directory drug directly into my main python22 directory. There were only two files in the pil dlls directory. I just drug them into the python dlls directory. Thanks for your time. I appreciate your help. I can't think of a single unusual feature of my system that would lead to all this. You can see that my path statement proper isn't very big. Thanks, Laney -----Original Message----- From: BELSEY, Dylan [SMTP:dylan.belsey@baesystems.com] Sent: Wednesday, August 14, 2002 9:27 PM To: 'millsl@cofc.edu'; 'tutor@python.org' Subject: RE: [Tutor] where does pythonpath go? Hi Laney, Not sure if this helps but you may want to remove PIL and re-install it in C:\MyPrograms\Python22 ie. where your Python installation lives. I had to do this when installing Pmw (Python Mega Widgets for Tkinter). Haven't tried the Pil so not a guaranteed fix but I suppose it's worth a try if nothing else works. Perhaps you might want to post the error, on this list, that you get when you try to import the functions etc. It may yield more information as to the problem. It may come down to adding to PYTHONPATH???? Dylan -----Original Message----- From: Laney Mills [mailto:millsl@cofc.edu] Sent: Wednesday, 14 August 2002 21:17 To: 'tutor@python.org' Subject: [Tutor] where does pythonpath go? I'm running Python 2.2 on a Windows 98se system. I just downloaded the pil thing (what is it called, a library?), but, of course, the Python2.2 couldn't find it. The install program put it in C:\py22. My python installation is in c:\my programs\python22. I drug the three files in the distribution: pil, dlls, and samples into my python22 directory under the filename pil: ex: C:\program files\python22\pil\{dlls, pil, samples} Still the python couldn't find it. I checked vis sys sys.path and the pil stuff isn't there, so of course, I need to put it there somehow. Incidentally, I had no difficulty like this at all with the visual library. I installer found the python22 directory and put the visual stuff in a subdirectory and python found it with no trouble. This experience is surely one that everyone using pil on a windows system would run into, yet as far as I can tell, the entire python documentation system takes the point of view that there is no such problem. frustration Thanks in advance. Laney Mills _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From dylan.belsey@baesystems.com Thu Aug 15 04:52:09 2002 From: dylan.belsey@baesystems.com (BELSEY, Dylan) Date: Thu, 15 Aug 2002 13:22:09 +0930 Subject: FW: [Tutor] where does pythonpath go? Message-ID: <86C3892A0C52D411AF5000A0C9EAA3B96320E8@wtntex1.baea.com.au> Also forwarding this on to the list........ -----Original Message----- From: Laney Mills [mailto:millsl@cofc.edu] Sent: Thursday, 15 August 2002 12:01 To: 'BELSEY, Dylan' Subject: RE: [Tutor] where does pythonpath go? I just noticed that my pythonpath statement referred to an earlier configuration I had tried. Now I have corrected the pythonpath statementa to point to the pil, the samples, and the dlls directories, which is how I have them placed now. I still get the same message from python in response to import image Thanks lrm -----Original Message----- From: BELSEY, Dylan [SMTP:dylan.belsey@baesystems.com] Sent: Wednesday, August 14, 2002 9:27 PM To: 'millsl@cofc.edu'; 'tutor@python.org' Subject: RE: [Tutor] where does pythonpath go? Hi Laney, Not sure if this helps but you may want to remove PIL and re-install it in C:\MyPrograms\Python22 ie. where your Python installation lives. I had to do this when installing Pmw (Python Mega Widgets for Tkinter). Haven't tried the Pil so not a guaranteed fix but I suppose it's worth a try if nothing else works. Perhaps you might want to post the error, on this list, that you get when you try to import the functions etc. It may yield more information as to the problem. It may come down to adding to PYTHONPATH???? Dylan -----Original Message----- From: Laney Mills [mailto:millsl@cofc.edu] Sent: Wednesday, 14 August 2002 21:17 To: 'tutor@python.org' Subject: [Tutor] where does pythonpath go? I'm running Python 2.2 on a Windows 98se system. I just downloaded the pil thing (what is it called, a library?), but, of course, the Python2.2 couldn't find it. The install program put it in C:\py22. My python installation is in c:\my programs\python22. I drug the three files in the distribution: pil, dlls, and samples into my python22 directory under the filename pil: ex: C:\program files\python22\pil\{dlls, pil, samples} Still the python couldn't find it. I checked vis sys sys.path and the pil stuff isn't there, so of course, I need to put it there somehow. Incidentally, I had no difficulty like this at all with the visual library. I installer found the python22 directory and put the visual stuff in a subdirectory and python found it with no trouble. This experience is surely one that everyone using pil on a windows system would run into, yet as far as I can tell, the entire python documentation system takes the point of view that there is no such problem. frustration Thanks in advance. Laney Mills _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From glingl@aon.at Thu Aug 15 07:57:46 2002 From: glingl@aon.at (Gregor Lingl) Date: Thu, 15 Aug 2002 08:57:46 +0200 Subject: [Tutor] Going Loopy over Loops References: <002701c243e2$41880ba0$b3f2d841@bjmartin98> Message-ID: <3D5B50EA.2070703@aon.at> Billie schrieb: > Hello: > I'm using Win95 and Python version 2.2. I'm new to Python and programming. > > I'm having trouble understanding how loops work, especially when they > contain conditional statements. If you want to understand, how this works, put it in an extra file, (replace imput by input) > radius = imput("Enter radius of circle: ") > while radius <= 0: > print "The number entered must be positive." > radius = imput("Enter radius of circle: ") Add some print statements to inform you whats going on, e.g.: radius = input("Enter radius of circle: ") while radius <= 0: print "while-loop entered, because radius =", radius print "hence condition radius <=0 is true" print "The number entered must be positive." radius = input("Enter radius of circle: ") print "while-loop exited, because radius =", radius print "hence condition radius <=0 is false" And run it. Example: >>> Enter radius of circle: -4 while-loop entered, because radius = -4 hence condition radius <=0 is true The number entered must be positive. Enter radius of circle: -100.9 while-loop entered, because radius = -100.9 hence condition radius <=0 is true The number entered must be positive. Enter radius of circle: 0.02 while-loop exited, because radius = 0.02 hence condition radius <=0 is false >>> Do it yourself now! If you unterstand what's going on, return to your program. You made the clever observation, that this part of the code occurs several times in your program. So you developed the desire to isolate it in a function: > l ==input("Enter length: ") > while l <= 0: > print "The number must be positive." > l = input("Enter length: ") def getPositiveNumber(): l ==input("Enter length: ") while l <= 0: print "The number must be positive." l = input("Enter length: ") To make this work, you have to: add a statement, which outputs the resulting value of l, that is, as you used it with your area-functions, a return-statement and you should provide a parameter for the promt of the input-statement, because this changes every time you want to use the function: Perhaps it would also be nice to change then name of the variable l to something neutral, e.g. number def getPositiveNumber(prompt): number==input(prompt) ...... etc. (while-loop here) return number After you have managed this you may use the function in the following way: w = getPositiveNumber("Enter width: ") etc. Seems hard? Not so much! Try it! Gregor From idiot1@netzero.net Thu Aug 15 08:05:00 2002 From: idiot1@netzero.net (Kirk Bailey) Date: Thu, 15 Aug 2002 03:05:00 -0400 Subject: [Tutor] membership monitoring In TinyList. Message-ID: <3D5B529C.5D354CE3@netzero.net> I have a user who wants a list for the volunteer fire department he runs. OK. He likes TinyList. Even better. Likes the web management of membership, ease of use, all smiles on my part. And he wants to be able to monitor membership in his list. Hmmm, TL was designed to protect privacy. Till now, no such feature was envisioned. I cobbled up a simple shtml page with some ssi to include their subscriber file, and it worked fine, BUT, anyone coming across the address can access it, no safeguards. So I am designing a new feature, and implementing a owner's file. a form will accept listname, owner's email address, and a password, and submit to another script. This checks the owners file, and IF it matches, display the subscriber file. OK, the form could have been static html, but then someone has to go in and edit it to include the correct domain name/url for the script. This uses the already existing self configuring feature to read the config file and handle building the form page automagically, easier for amateurs JUST able to get the thing installed and running. The form script is done, here it is: http://www.tinylist.org/cgi-bin/TLmembershipform.py Granted, it can stand a little tidying up on text layout. -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | KILL spam dead! http://www.scambusters.org/stopspam/#Pledge | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com From lumbricus@gmx.net Thu Aug 15 10:19:16 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Thu, 15 Aug 2002 11:19:16 +0200 (MEST) Subject: [Tutor] pom for py References: <47B6167F8E69D31194BA0008C7918D4205C54D79@msxcvg02itscge.gecits.ge.com> Message-ID: <17490.1029403156@www20.gmx.net> > Hey Folks, Hi! > Has anyone ever written (or conceived of) an algorithm that can calculate > the phases of the moon? I am interested in doing a program in python that > will do just that, and I need a starting point! "Numerical Recipes in C" contains such a program. > Thanks HTH, HAND J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From magnus@thinkware.se Thu Aug 15 10:28:25 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Thu, 15 Aug 2002 11:28:25 +0200 Subject: [Tutor] Another Class question. In-Reply-To: References: <5.1.0.14.0.20020815011329.02a31c00@www.thinkware.se> Message-ID: <5.1.0.14.0.20020815091337.02a60dd8@www.thinkware.se> At 20:58 2002-08-14 -0500, SA wrote: >Ahah!(I hope) > >Let me make sure I understand You here: > >1. When you create the instance x =3D Fud(), any string I pass to x is run >through __init__ and then passed to def extract through self.text? Or to be more precise: If Fud is a class, "x =3D Fud()" is called an "instantiation operation". (See the Python Tutorial 9.3.2.) An instantiation operation creates an empty instance object of the called class. If you define an __init__ method, you can pass parameters, and perform operations at the time of instantiation, to bring the instance to a desired initial state. So, x =3D Fud(y) could in pseudo code be described as: x =3D Fud.__init__(x, y) __init__ can basically do anything that any function can do. All methods in a class must take at least one parameter, and the first parameter must be an instance of the class (or a subclass). The __init__ method has the additional limitation that you can't return any value with the return statement, since it is typically called in a context where an instance of the class is returned. class Fud1: def __init__(self, text): self.text =3D text x =3D Fud1('Hello') is basically the same as class Fud2: pass x =3D Fud2() x.text =3D 'Hello' The difference is of course that in the first case you always have a attribute called text directly after instantiation od Fud1. (You can remove it with "del x.text" though.) >2. But def extract will do nothing for 2 reasons. One, start and end were >never passed to the Class? Two, even if they had been passed, data from the >function search is not passed to the function extract? Hm... If we are talking about the same code, see below, start and end were passed to the search method, which is all we need. Once we create our variable "tags", we don't need start and end any longer, right? def search(self, start, end): tags =3D r'''%s.+%s''' % (start, end) It is typical that we discard the parameters passed to a function once the function is finished. The problem is only that "tags" is a local variable in the namespace of the search method. As soon as the search method finishes, we no longer have any reference/name/variable that refers to the raw string object we created. It will be impossible to reach the object, and it will actually be garbage collected at once, since Python uses reference counting. A namespace is like a dictionary. If we look under the hood of python we could imagine something like this for the code above: # the search function starts, create a local namespace (ns) seach_ns =3D {} # We got the parameters self, start and end, so we will # have local variables refering to the objects that are # being passed in. search_ns['self'] =3D self search_ns['start'] =3D start search_ns['end'] =3D end # Aha, now we are creating a local varable 'tags' and # allocating a raw string to it. search_ns['tags'] =3D r'''%s.+%s''' % (search_ns['start'], search_ns['end']) # End of function, dispose of local variables del search_ns Replace the code with: def search(self, start, end): self.tags =3D r'''%s.+%s''' % (start, end) Now the raw string object will have a name that persists as long as the Fud instance object which we here refer to with the name self. If you called seach like this: x.search('X', 'Y') You will now have extended the object x refers to with a new attribute. >>> print x.tags X.+Y >3. so by saying x =3D Fud(text) is the same as Fud(x, text) which is= saying: > class Fud: > def __init__(x, text): > x.text =3D text > Is this correct? (Keep in mind I'm trying to make this as general as > possible) Maybe we should note the difference between variables and objects. An object is a "thing". A variable is a name for a thing. If we change the code back to: > x =3D Fud('something') > class Fud: > def __init__(self, text): > self.text =3D text We can say that the variable/name x in the "global" namespace and the variable/name "self" in the __init__ namespace refer to the same object, which happens to be an instance of the Fud class. In other words: >>> x =3D Fud('Hello') >>> print x.text Hello >So what I would like to do then is pass the data into the class, let the >class do all of the work, and then return the modified data. At the same >time, to make the class work for the a more general situation, it would= also >have to be able to pass data to just part of the class and return the >output. Hm... sort of... Typically one could say that the methods, or member functions, are part of the class, only existing in one copy, shared by all instances. Attributes, or member variables exits in the instances, and is not shared between instances. So I react a bit when you talk about passing data to the class, but you are right that when you call a method, you pass the parameters to the code which is in the class. And as I said, the instance itself, self, is passed first. So basically, one could imagine that the instance says to the class: "Please manipulate me with these parameters". >>> x1 =3D Fud('Hello') >>> x2 =3D Fud('Goodbye') >>> print x2.text Goodbye >>> print x1.text Hello >Am I on the right track here now, because this is one of the more difficult >concepts to grasp for a newbie. You tell me... You need to understand the distinction between variables and objects and how namespaces work. Grokking the distinction between mutable and immutable objects is also a good thing. I like brief texts, but I have problems writing them, and I tink this presentation by Guido is very useful. http://www.python.org/doc/essays/ppt/lwnyc2002/intro22.ppt --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From polbranckotte@skynet.be Thu Aug 15 11:27:02 2002 From: polbranckotte@skynet.be (Pol Branckotte) Date: Thu, 15 Aug 2002 12:27:02 +0200 Subject: [Tutor] First step Message-ID: <000801c24446$4c1f89d0$681788d9@b> This is a multi-part message in MIME format. ------=_NextPart_000_0005_01C24457.0F4B1EA0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I just try to define a window and later decide to make it visible: Here are the two programs, I can understand the error message generated = by the first but not the one generated by the second What am I missing? How to make it happen? from wxPython.wx import * class MyApp(wxApp): def OnInit(self): frame =3D wxFrame(NULL, -1, "hello from wxPy") #frame.Show(true) self.SetTopWindow(frame) return true app =3D MyApp(0) app.frame.Show(true) app.MainLoop() attribute error: MyApp instance has no attribute 'frame' __________________________________________________ from wxPython.wx import * class MyApp(wxApp): def OnInit(self): frame =3D wxFrame(NULL, -1, "hello from wxPy") #frame.Show(true) self.SetTopWindow(frame) return true app =3D MyApp(0) frame.Show(true) app.MainLoop() name error name "frame" is not defined __________________________________________________________ Thanks=20 Pol ------=_NextPart_000_0005_01C24457.0F4B1EA0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I just try to define a = window and=20 later decide to make it visible:
Here are the two = programs, I can=20 understand the error message generated by the first
but not the one = generated by the=20 second
What am I = missing?
How to make it = happen?
 
 
from wxPython.wx import = *
 
class=20 MyApp(wxApp):
    def=20 OnInit(self):
        frame =3D=20 wxFrame(NULL, -1, "hello from=20 wxPy")
       =20 #frame.Show(true)
       =20 self.SetTopWindow(frame)
        = return=20 true
 
app =3D=20 MyApp(0)
app.frame.Show(true)
app.MainLoop()
 
attribute error: MyApp = instance has=20 no attribute=20 'frame'
__________________________________________________
 
from wxPython.wx import = *
 
class=20 MyApp(wxApp):
    def=20 OnInit(self):
        frame =3D=20 wxFrame(NULL, -1, "hello from=20 wxPy")
       =20 #frame.Show(true)
       =20 self.SetTopWindow(frame)
        = return=20 true
 
app =3D=20 MyApp(0)
frame.Show(true)
app.MainLoop()
 
name error name "frame" = is not=20 defined
__________________________________________________________
=
Thanks
 
Pol
------=_NextPart_000_0005_01C24457.0F4B1EA0-- From glingl@aon.at Thu Aug 15 12:25:18 2002 From: glingl@aon.at (Gregor Lingl) Date: Thu, 15 Aug 2002 13:25:18 +0200 Subject: [Tutor] First step References: <000801c24446$4c1f89d0$681788d9@b> Message-ID: <3D5B8F9E.1000908@aon.at> Pol Branckotte schrieb: > I just try to define a window and later decide to make it visible: > Here are the two programs, I can understand the error message > generated by the first > but not the one generated by the second > What am I missing? > How to make it happen? > I'd like to direct you to the thread Another Class question, and the conversation between SA, Magnus Lycka and others there, which has pretty much to do with your problem (as I don't know wxPython, I can't give you an exact advice for solving it ... sorry) gl > from wxPython.wx import * > > class MyApp(wxApp): > def OnInit(self): > frame = wxFrame(NULL, -1, "hello from wxPy") > #frame.Show(true) > self.SetTopWindow(frame) > return true > > app = MyApp(0) > app.frame.Show(true) > app.MainLoop() > > attribute error: MyApp instance has no attribute 'frame' > __________________________________________________ > > from wxPython.wx import * > > class MyApp(wxApp): > def OnInit(self): > frame = wxFrame(NULL, -1, "hello from wxPy") > #frame.Show(true) > self.SetTopWindow(frame) > return true > > app = MyApp(0) > frame.Show(true) > app.MainLoop() > > name error name "frame" is not defined > __________________________________________________________ > Thanks > > Pol From kb@kb2.net Thu Aug 15 12:43:26 2002 From: kb@kb2.net (Kyle Babich) Date: Thu, 15 Aug 2002 11:43:26 UT Subject: [Tutor] cmp() Message-ID: <20020815114326.AA0F89376F@server2.fastmail.fm> It's in the tutorial "Joe Useless Writes A Program". http://www.uselesspython.com/JoeUselessWritesAProgram.html On Wed, 14 Aug 2002 21:27:59 -0500, "SA" said: > Quick question: >=20 > Where is cmp.py located? >=20 > I could not find it on useless python. >=20 > Thanks. > SA >=20 > --=20 > "I can do everything on my Mac I used to on my PC. Plus a lot more ..." > -Me >=20 >=20 -- Kyle From yduppen@xs4all.nl Thu Aug 15 13:13:20 2002 From: yduppen@xs4all.nl (Yigal Duppen) Date: Thu, 15 Aug 2002 14:13:20 +0200 Subject: [Tutor] First step In-Reply-To: <000801c24446$4c1f89d0$681788d9@b> References: <000801c24446$4c1f89d0$681788d9@b> Message-ID: <200208151413.20913.yduppen@xs4all.nl> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > I just try to define a window and later decide to make it visible: > Here are the two programs, I can understand the error message generated by > the first but not the one generated by the second > What am I missing? Your problem has to do with the different scopes of names. Basically, there are three kinds of scopes. - - Local scope. These names are defined within a method/function and no longer exists when the method/function returns. - - Instance scope. These names are bound to an instance of an object. Within an object they are usually accessed using the 'self.xxx' convention. - - Global scope. These names are bound within a module. (Note: this distinction is not completely exact, but it's correct enough to answer your question) > from wxPython.wx import * > > class MyApp(wxApp): > def OnInit(self): > frame = wxFrame(NULL, -1, "hello from wxPy") > #frame.Show(true) > self.SetTopWindow(frame) > return true > > app = MyApp(0) > app.frame.Show(true) > app.MainLoop() > > attribute error: MyApp instance has no attribute 'frame' What happens here is that within the OnInit method, you create a new name 'frame'. This name is defined within the method and therefore automatically gets a local scope. So when OnInit returns, 'frame' is no longer defined. At the end of your program, you try to extract 'frame' from 'app' by calling 'app.frame'. You can probably see that this won't work; Python sees this as well and raises an AttributeError. This problem can be solved by changing the first line of OnInit to: self.frame = wxFrame(NULL, -1, "hello world") By prefixing with self, the name 'frame' is bound to the MyApp instance. > __________________________________________________ > > from wxPython.wx import * > > class MyApp(wxApp): > def OnInit(self): > frame = wxFrame(NULL, -1, "hello from wxPy") > #frame.Show(true) > self.SetTopWindow(frame) > return true > > app = MyApp(0) > frame.Show(true) > app.MainLoop() > > name error name "frame" is not defined Here the method is identical, but at the end of the program, you try to access frame as if it were in the global scope. If you're from a C++ or Java background: in Python there is no implicit 'this'. Instead, you have to use it explicitly -- that's why you always have the 'self' parameter in methods. Hope this helps; if not, feel free to ask more. YDD - -- http://www.xs4all.nl/~yduppen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9W5rgLsKMuCf5EdwRAqTXAJ9NJt9thfv9jjCG+ByaadVMn+/I4QCeNNya VjxlUiSQxAr5ZnJfep/gFuc= =743L -----END PGP SIGNATURE----- From sarmstrong13@mac.com Thu Aug 15 13:25:12 2002 From: sarmstrong13@mac.com (SA) Date: Thu, 15 Aug 2002 07:25:12 -0500 Subject: [Tutor] First step In-Reply-To: <000801c24446$4c1f89d0$681788d9@b> Message-ID: On 8/15/02 5:27 AM, "Pol Branckotte" wrote: > I just try to define a window and later decide to make it visible: > Here are the two programs, I can understand the error message generated by the > first > but not the one generated by the second > What am I missing? > How to make it happen? > > > from wxPython.wx import * > > class MyApp(wxApp): > def OnInit(self): > frame = wxFrame(NULL, -1, "hello from wxPy") > #frame.Show(true) > self.SetTopWindow(frame) > return true > > app = MyApp(0) > app.frame.Show(true) > app.MainLoop() > > attribute error: MyApp instance has no attribute 'frame' > __________________________________________________ > > from wxPython.wx import * > > class MyApp(wxApp): > def OnInit(self): > frame = wxFrame(NULL, -1, "hello from wxPy") > #frame.Show(true) > self.SetTopWindow(frame) > return true > > app = MyApp(0) > frame.Show(true) > app.MainLoop() > > name error name "frame" is not defined > > Well, first it looks like app = MyApp(0) is passing the value 0 to wxApp. I'm not 100% sure on this. But I can tell you python is giving you the correct response. There is no attribute frame because frame is not defined in the instance. app.frame.Show(true) should be: app.OnInit(true) OnInit is the attribute frame is part of the function Oninit. (I believe) Gregor is correct. Look back at the few emails I have been conversing with Magnus on this very subject. Good Luck. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From thomi@thomi.imail.net.nz Thu Aug 15 13:29:22 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Fri, 16 Aug 2002 00:29:22 +1200 Subject: [Tutor] python GUI module selection. Message-ID: <20020816002922.06b166e3.thomi@thomi.imail.net.nz> hey there! I'm looking for some advice on choosing what GUI toolkit to use for an upcoming project. here are the requirements: 1.- must work in both linux and windows 2.- must be able to hold complex thingies... I'm going to have a map which is updated at around 50 times a second within this GUI interface, and the user must be able to scroll around the map, without it slowing the program down. (the map will be larger than the screen resolution see, so there will have to be a scrolling nature to it somehow). 3.- it MUST be easy to program!! im not very good with python yet, and i should be able to decode what is going on :-) any ideas?? the only ones i have heard of are Tkinter, GTK, and wxpython. but i have been led to believe there are more. any ideas?? thanks. -- The software required Win95 or better, so I installed Linux. Thomi Richards, thomi@imail.net.nz From magnus@thinkware.se Thu Aug 15 13:55:34 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Thu, 15 Aug 2002 14:55:34 +0200 Subject: [Tutor] First step In-Reply-To: References: <000801c24446$4c1f89d0$681788d9@b> Message-ID: <5.1.0.14.0.20020815145221.02aef560@www.thinkware.se> At 07:25 2002-08-15 -0500, SA wrote: >app.frame.Show(true) should be: >app.OnInit(true) No, I'm afraid it's not like that. wxPython is, like most GUI tool kits a rather complex thingie. It's also just a fairly thin Python wrapper arount the C++ wxWindows. There is a lot of magic involved, and OnInit is called automagically. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From adi.clepcea@sysrom.ro Thu Aug 15 13:15:46 2002 From: adi.clepcea@sysrom.ro (Adi Clepcea) Date: Thu, 15 Aug 2002 15:15:46 +0300 (E. Europe Daylight Time) Subject: [Tutor] Re: OT Java Question Message-ID: <3D5B9B72.000009.01192@adi-clepcea> --------------Boundary-00=_AQWVMY50000000000000 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable You are using the java 1.1.8 libraries. Back then the swing classes were = not part of the standard distribution. You should look in your path and classpath variables and make sure that t= hey point to your jsdk1.4intslation and not the other one. There is a for= um about java on yahoo. You can find there many answers. HTH Adi --------------Boundary-00=_AQWVMY50000000000000 Content-Type: Text/HTML; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
You are using the java 1.1.8 libraries. Back then the swing cl= asses=20 were not part of the standard distribution.
You should look in your path and classpath variables and make = sure=20 that they point to your jsdk1.4intslation and not the other one. Th= ere is=20 a forum about java on yahoo. You can find there many answers.
HTH
Adi
=09 =09 =09 =09 =09 =09 =09
_________________________________________________
IncrediMail - Email has finally= =20 evolved -
Click=20 Here
--------------Boundary-00=_AQWVMY50000000000000-- From sarmstrong13@mac.com Thu Aug 15 13:58:04 2002 From: sarmstrong13@mac.com (SA) Date: Thu, 15 Aug 2002 07:58:04 -0500 Subject: [Tutor] Another Class question. In-Reply-To: <5.1.0.14.0.20020815091337.02a60dd8@www.thinkware.se> Message-ID: Ok. Now the light is starting to come on. So in the global namespace, I first want to make an instance of the class, then I can pass on data to each of the classes functions for data manipulation. The result of which is assigned to the instance? So one last question(I hope;)): If you have two classes, I'll try to keep it simple but I'm sure this can be scaled upwards, and you create an instance for each, how would you pass data from on instance to the next? Is this done by assignment? For example(really general): class 1: #The first class ... class 2: #The second class ... x = 1() #create instance of first class y = 2() #create instance of second class x(..) #do some work on some data through this instance y(x) #pass result from first instance to second for more manipulation? Does this work? Is there a better way? Could I put the second class in line first and make it a subclass of SuperClass 1 instead? (Ok I lied. I thought of a few more question as I was writing out my example. So sue me ... ;) ) Thanks in advance. SA -- "I can do everything on my Mac I used to on my PC. Plus a lot more ..." -Me From yduppen@xs4all.nl Thu Aug 15 14:06:20 2002 From: yduppen@xs4all.nl (Yigal Duppen) Date: Thu, 15 Aug 2002 15:06:20 +0200 Subject: [Tutor] python GUI module selection. In-Reply-To: <20020816002922.06b166e3.thomi@thomi.imail.net.nz> References: <20020816002922.06b166e3.thomi@thomi.imail.net.nz> Message-ID: <200208151506.20344.yduppen@xs4all.nl> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > any ideas?? the only ones i have heard of are Tkinter, GTK, and > wxpython. but i have been led to believe there are more. Qt !! There are some issues with licensing for Windows applications, but the programming model is Excellent! Like, really really good :) The Qt widgets look nice, it seems that as of Qt3 it is very easy to give your Qt apps a native look and feel, and the library is Huge. Furthermore, qt is the best example I know of OO GUI programming. And then of course there is Boudewijn Rempt's book "GUI Programming with Python: Using the Qt Toolkit". The 3rd part of this book is filled with examples of building a non-trivial GUI application with Python and Qt. Which makes it much better than most books I know on GUI programming. YDD - -- http://www.xs4all.nl/~yduppen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9W6dMLsKMuCf5EdwRAo+RAKCv3+K2LiN8TxExT4+E7saHCRPDTACgiMds q8+4bRj3GA2gciEcYDQXLxE= =Hkp9 -----END PGP SIGNATURE----- From magnus@thinkware.se Thu Aug 15 14:18:51 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Thu, 15 Aug 2002 15:18:51 +0200 Subject: [Tutor] python GUI module selection. In-Reply-To: <20020816002922.06b166e3.thomi@thomi.imail.net.nz> Message-ID: <5.1.0.14.0.20020815145549.029f1a08@www.thinkware.se> At 00:29 2002-08-16 +1200, Thomi Richards wrote: >any ideas?? the only ones i have heard of are Tkinter, GTK, and >wxpython. but i have been led to believe there are more. Sure, look at http://www.thinkware.se/cgi-bin/thinki.cgi/PythonGuis or=20 http://directory.google.com/Top/Computers/Programming/Languages/Python/Modul= es/GUI/ for some pointers. Tkinter and wxPython seems to be the main contenders though. Tkinter has better docs, but wxPython has more features. Didn't I write about them a few days ago? Yep, look at http://mail.python.org/pipermail/tutor/2002-August/016172.html --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From lsloan@umich.edu Thu Aug 15 14:53:36 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Thu, 15 Aug 2002 09:53:36 -0400 Subject: [Tutor] Another Class question. In-Reply-To: <5.1.0.14.0.20020815091337.02a60dd8@www.thinkware.se> References: <5.1.0.14.0.20020815011329.02a31c00@www.thinkware.se> <5.1.0.14.0.20020815091337.02a60dd8@www.thinkware.se> Message-ID: <3163976.1029405216@[10.0.1.30]> --On Thursday, August 15, 2002 11:28 AM +0200 Magnus Lycka wrote: > You need to understand the distinction between variables and objects and > how namespaces work. Grokking the distinction between mutable and > immutable objects is also a good thing. I like brief texts, but I have > problems writing them, and I tink this presentation by Guido is very > useful. http://www.python.org/doc/essays/ppt/lwnyc2002/intro22.ppt For those of us without PowerPoint, the PDF version is at . If you step up to , you can access many more of Guido's presentations. (I wish Guido had converted the presentation to HTML as he did some of his other presentations, like the one he did for Yahoo!.) -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From rob@uselesspython.com Thu Aug 15 15:26:05 2002 From: rob@uselesspython.com (Rob) Date: Thu, 15 Aug 2002 09:26:05 -0500 Subject: [Tutor] python GUI module selection. In-Reply-To: <20020816002922.06b166e3.thomi@thomi.imail.net.nz> Message-ID: > any ideas?? the only ones i have heard of are Tkinter, GTK, and > wxpython. but i have been led to believe there are more. > > any ideas?? With Jython, you have access to Java's GUI tools (Swing and AWT). I'm not a master of them yet, although I do find Swing interesting to play with. I wrote a short article demo'ing Jython/Swing at: http://uselesspython.com/Jython_Swing_Basics.html For ease of use, someone who is early in the learning process might want to start with Tkinter. I'm not sure about the performance issues of the various approaches, but Tkinter seems to be a good first GUI experience for a lot of people. Rob http://uselesspython.com From shey@argonaut.com Thu Aug 15 15:52:31 2002 From: shey@argonaut.com (shey crompton) Date: Thu, 15 Aug 2002 15:52:31 +0100 Subject: [Tutor] Python + editor Message-ID: <415C917D807AD411B72C00805FF7330B0383639E@MAILSRV> Hi all, I realise I may be thrashing a dead thread.... but: Does anyone use UltraEdit. Some guys at work use it for our in house language, and find it pretty good to use. I have toyed around with it a bit and added the python context recognition. Works a treat. The only problem I have, and this is where you all come in :-), is that I cannot get it to run anything in the python shell (IDLE). If anyone uses UltraEdit, and has managed to get the shell to run a program from UltraEdit, please could you let me know. I am thinking something akin to CTRL-F5 in the text editor window with IDLE. On a different note: I feel it would be nice if the text editor window with IDLE was a split window type editor which marked down all the classes and/or functions in a separate frame. I have seen some editors do this, and double clicking on the function/class name will take you to the line of the function. I feel this would help learners looking through other programs. As a learner I find it hard to search through line by line within the code for a function on user input (for example) . Double clicking in a separate frame to go directly to that point in the program would _possibly_ speed up my learning (probably not, but anyway... :-) ) Who would I send a suggestion like the above to? I am interested on feedback on both parts of the mail. Feel free to go for it with suggestions, comments etc. :-) Thanks, Shey From lists@shrestha.net.np Thu Aug 15 16:52:35 2002 From: lists@shrestha.net.np (Ashish Shrestha) Date: Thu, 15 Aug 2002 21:37:35 +0545 Subject: [Tutor] Saving Files for Spreadsheet Exporting Message-ID: <3D5BCE43.8060803@shrestha.net.np> well something that works for smaller lists. may be not efficient for big lists! >>> myList = [['a','b','c'],['d','e','f'],['g','h','i']] >>> '\n'.join([','.join(sublist) for sublist in myList]) 'a,b,c\nd,e,f\ng,h,i' Ashish jabber id: axhixh@jabber.org http://www.nyatapol.com.np From lsloan@umich.edu Thu Aug 15 17:47:15 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Thu, 15 Aug 2002 12:47:15 -0400 Subject: [Tutor] Another Class question. In-Reply-To: References: Message-ID: <3742939.1029415635@[10.0.1.30]> --On Thursday, August 15, 2002 7:58 AM -0500 SA wrote: > If you have two classes, I'll try to keep it simple but I'm sure this can > be scaled upwards, and you create an instance for each, how would you > pass data from on instance to the next? > > Is this done by assignment? > > For example(really general): > > class 1: #The first class > ... > class 2: #The second class > ... > > x = 1() #create instance of first class > y = 2() #create instance of second class > > x(..) #do some work on some data through this instance > y(x) #pass result from first instance to second for more manipulation? Calling the methods would probably look like: x.process(data) y.process(x.get_processed_data()) You would have to define the get_processed_data method of class 1. Or maybe you don't want to use a method. You could just access the instance variable of x that's holding the data. -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From grfkdsgn@worldnet.att.net Thu Aug 15 18:07:46 2002 From: grfkdsgn@worldnet.att.net (David Howard) Date: Thu, 15 Aug 2002 13:07:46 -0400 Subject: [Tutor] Scripting errors Message-ID: <002601c2447e$47d67400$1500a8c0@david> This is a multi-part message in MIME format. ------=_NextPart_000_0023_01C2445C.C00C3260 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have a program called Poser Pro Pack that uses Python scripts to a = variety of tasks. One such script compresses files from the earlier = version of Poser so as the amount of hard drive space used is reduced. I = tried running the script and got this error: Traceback (innermost last): File "", line 210, in ? AttributeError: AppLocation I've looked thru the script but cannot find where it is looking for the = Poser application or anything. I'm new to this scripting thing and of = course am clueless when something doesn't work as it should. If need be = I can attach the script for interested parties and maybe they can see = what the problem is. Thanks, David Howard GRFK DSGN Unlimited=20 ------=_NextPart_000_0023_01C2445C.C00C3260 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I have a program called Poser Pro Pack that uses = Python=20 scripts to a variety of tasks. One such script compresses files from the = earlier=20 version of Poser so as the amount of hard drive space used is reduced. I = tried=20 running the script and got this error:
 
Traceback (innermost last):
File = "",=20 line 210, in ?
AttributeError: AppLocation
 
I've looked thru the script but = cannot find where=20 it is looking for the Poser application or anything. I'm new to this = scripting=20 thing and of course am clueless when something doesn't work as it = should. If=20 need be I can attach the script for interested parties and = maybe they=20 can see what the problem is.
 
Thanks,
David Howard
GRFK DSGN=20 Unlimited 
------=_NextPart_000_0023_01C2445C.C00C3260-- From ashish@shrestha.net.np Thu Aug 15 04:22:29 2002 From: ashish@shrestha.net.np (Ashish Shrestha) Date: Thu, 15 Aug 2002 09:07:29 +0545 Subject: [Tutor] Saving Files for Spreadsheet Exporting References: <86C3892A0C52D411AF5000A0C9EAA3B96320E5@wtntex1.baea.com.au> Message-ID: <3D5B1E75.80905@shrestha.net.np> well something that works for smaller lists. may be not efficient for big lists! >>> myList = [['a','b','c'],['d','e','f'],['g','h','i']] >>> '\n'.join([','.join(sublist) for sublist in myList]) 'a,b,c\nd,e,f\ng,h,i' Ashish jabber id: axhixh@jabber.org http://www.nyatapol.com.np From jeff@ccvcorp.com Thu Aug 15 23:26:44 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Thu, 15 Aug 2002 15:26:44 -0700 Subject: [Tutor] Saving Files for Spreadsheet Exporting References: <86C3892A0C52D411AF5000A0C9EAA3B96320E5@wtntex1.baea.com.au> Message-ID: <3D5C2AA4.CDB55BC0@ccvcorp.com> "BELSEY, Dylan" wrote: > Hi Alan, > I'm quite sure that you have considered this but the simplistic way > is to loop through the list and append a tab "\t" or a ";" etc to the end of > each string and write to a file. Ashish Shrestha wrote: > well something that works for smaller lists. may be not efficient for > big lists! > > >>> myList = [['a','b','c'],['d','e','f'],['g','h','i']] > >>> '\n'.join([','.join(sublist) for sublist in myList]) > 'a,b,c\nd,e,f\ng,h,i' In fact, join() is probably the most efficient way possible to accomplish this task. Looping through the list and appending characters individually is *very* slow -- you're creating a temporary string object for *each* append, and throwing it away almost immediately. All that allocation takes a lot of time. In contrast, join() creates exactly one string object, no matter what the size of the list. Also, all the loop control is handled internally, which means at C speed instead of Python speed. Even if you were to pass your list of lists to a custom C extension to write your file, it would be unlikely to be significantly faster than using join() and file.write(), because those string methods have been heavily optimized by some very talented programmers. (I sure wouldn't bet anything on *my* being able to write faster code than Tim Peters... ;) ) So, my choice for writing this file would be: outfile = open('output.tsv', 'w') output = '\n'.join( ['\t'.join(sublist) for sublist in MyList] ) outfile.write(output) outfile.close() Note that I use tabs ('\t') as column-separators, rather than commas. While comma-separated values are something of a standard, it leads to all sorts of quoting headaches when commas may be a valid part of a string -- especially if quote characters are also potentially valid. Tabs are a lot less likely to be valid data than commas are. Whatever the separator of choice is, though, Excel (or whatever other spreadsheet) should be able to import this file quite simply. If you want to do anything fancier, or have a particular need to create XLS files without human intervention, then look into controlling Excel through the PythonCOM framework. Jeff Shannon Technician/Programmer Credit International From dman@dman.ddts.net Fri Aug 16 05:11:15 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Fri, 16 Aug 2002 00:11:15 -0400 Subject: [Tutor] Re: Saving Files for Spreadsheet Exporting In-Reply-To: <009d01c243f2$f20362d0$cae68b86@fo5132> References: <009d01c243f2$f20362d0$cae68b86@fo5132> Message-ID: <20020816041115.GA30896@dman.ddts.net> --sdtB3X0nJg68CQEu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 14, 2002 at 05:30:23PM -0700, Alan Colburn wrote: | Two quick questions today: |=20 | 1) I'd like to save a file, with a list of lists, in a format that could = be | read directly into a spreadsheet. Each list would represent a different r= ow, | and each list element a different column. How would I go about doing this? | (List elements are strings.) Look into using either the CSV (Comma-Separated Values) or Tab-Separated Values formats. | 2) In the interest of "teaching a man to fish" (rather than "giving him a | fish"), how would you go about searching the Python documentation to find= an | answer to this question? ... That's where I started, but I wasn't success= ful | :-) The trick is to know what you have and know where you are going. You have the first part down, but not the second. After reading this message you know the second (CSV), so you can search the Vaults of Parnassus for some existing code. I happen to know that (at least a year ago) there were some CSV modules available there. If you can't find one, then you need to write one. I see that some other posters have given the simplistic (but incomplete) method for doing that. (they are incomplete because they don't handle data with embedded commas or quotes, but CSV has rules for encoding that stuff) HTH, -D --=20 [Perl] combines all the worst aspects of C and Lisp: a billion different sublanguages in one monolithic executable. It combines the power of C with the readability of PostScript. -- Jamie Zawinski =20 http://dman.ddts.net/~dman/ --sdtB3X0nJg68CQEu Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1ce2MACgkQO8l8XBKTpRRF2QCcCXpbYN633nmAzGL8fRUy8mOL BwgAoJEch4qvu4yY4BhDV4g2sTVzK8Iv =XsIb -----END PGP SIGNATURE----- --sdtB3X0nJg68CQEu-- From dman@dman.ddts.net Fri Aug 16 05:17:06 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Fri, 16 Aug 2002 00:17:06 -0400 Subject: [Tutor] Re: OT Java Question In-Reply-To: <20020814220923.1C9649384C@server2.fastmail.fm> References: <20020814220923.1C9649384C@server2.fastmail.fm> Message-ID: <20020816041706.GB30896@dman.ddts.net> --i9LlY+UWpKt15+FH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 14, 2002 at 10:09:23PM +0000, Kyle Babich wrote: | While I'm learning Python I'm also learning Java, so I just bought | Learning Java 2nd Ed. I was trying the first few simple apps but they | didn't work. I have jdk 1.1.8 installed on my computer sdk 1.4, so I | did think there would be much of a difference. Wrong! JDK 1.0.x, 1.1.x, 1.2.x, 1.3 and 1.4 are all vastly different. (SDK =3D=3D JDK, just marketing terminology) When it comes to Sun/Java versioning, think of the first number as a constant, the second as the major number and the third as the minor number. The _language_ itself changed between 1.0 and 1.1, and the library changed majorly between 1.1 and 1.2. 1.2 and 1.3 are fairly similar, and I recently learned that 1.4 adds more stuff to the standard library. | Anyway, there seems to | be an error with import javax.swing.*; (I need it for JFrames) | Was javax taken out at some point? Something else? Could someone | clear this up for me? No, swing was created after the 1.1.x releases. You can separately obtain an (old) version of swing which will work with jdk 1.1.8, but 1.1 is soo ancient and obsolete that I don't recommend starting with it. Use at least 1.3, or 1.4 if your OS is supported. JDK >=3D 1.2 includes swing as part of the standard library. -D --=20 Misfortune pursues the sinner, but prosperity is the reward for the righteous. Proverbs 13:21 =20 http://dman.ddts.net/~dman/ --i9LlY+UWpKt15+FH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1cfMIACgkQO8l8XBKTpRThxACffkC3R7fmM7VW3Y/i4ufVlxKa 4d0AniDAl8936L7nmQRJx3+55/VZR+Ut =PfiA -----END PGP SIGNATURE----- --i9LlY+UWpKt15+FH-- From slime@vsnl.net Fri Aug 16 04:39:37 2002 From: slime@vsnl.net (Prahlad Vaidyanathan) Date: Fri, 16 Aug 2002 09:09:37 +0530 Subject: [Tutor] Re: How do I get text from an HTML document. In-Reply-To: References: Message-ID: <20020816033937.GA3680@localhost.localdomain> Hi, On Wed, 14 Aug 2002 SA spewed into the ether: > Hi Everyone- > > I have HTML docs that have text between the comment tags: > > Some text here > > > What would be the simplest way to get this text. The text will also have > some common html tags mixed in like

. So I want to strip all the html > tags from the text I get also. [-- snippity --] This is a modified version of a script I found on the net sometime back (I think on the Python Cookbook site). It defines a derived clas of the sgmllib.SGMLParser class, and subsequently uses the handle_starttag() and handle_endtag() methods to strip out unwanted tags. Here goes : """ import sgmllib class StrippingParser(sgmllib.SGMLParser): # These are the HTML tags that we will leave intact valid_tags = ('b', 'i', 'p') from htmlentitydefs import entitydefs # replace entitydefs from sgmllib def __init__(self): sgmllib.SGMLParser.__init__(self) self.result = [] self.endTagList = [] def handle_data(self, data): if data: self.result.append(data) def handle_charref(self, name): self.result.append("&#%s;" % name) def handle_entityref(self, name): x = '' # this breaks unstandard entities that end with ';' if self.entitydefs.has_key(name): x = ';' self.result.append("&%s%s" % (name, x)) def unknown_starttag(self, tag, attrs): """ Delete all tags except for legal ones """ if tag in self.valid_tags: self.result.append('<%s' % tag) for k, v in attrs: if k[0:2].lower() != 'on' and v[0:10].lower() != 'javascript': self.result.append(' %s="%s"' % (k, v)) endTag = '' % tag self.endTagList.insert(0,endTag) self.result.append('>') def unknown_endtag(self, tag): if tag in self.valid_tags: self.result.append("" % tag) remTag = '' % tag self.endTagList.remove(remTag) def cleanup(self): """ Append missing closing tags """ for i in self.endTagList : self.result.append(i) self.result = "".join(self.result) def strip(s): """ Strip illegal HTML tags from string s """ parser = StrippingParser() parser.feed(s) parser.close() parser.cleanup() return parser.result if __name__ == "__main__" : import sys file = sys.argv[1] fd = open(file,'r') res = strip(fd.read()) fd.close() print res """ HTH, pv. -- Prahlad Vaidyanathan Children are like cats, they can tell when you don't like them. That's when they come over and violate your body space. From hsteiger@comcast.net Fri Aug 16 05:23:54 2002 From: hsteiger@comcast.net (Henry Steigerwaldt) Date: Thu, 15 Aug 2002 23:23:54 -0500 Subject: [Tutor] Test message Message-ID: <003b01c244dc$bb491ce0$0201a8c0@eagle> This is a multi-part message in MIME format. --Boundary_(ID_nnJ7sBmYtFeu14fujF9cag) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT To All: This is a test message to see if it makes it to the list. Thanks. Henry Steigerwaldt Hermitage, TN --Boundary_(ID_nnJ7sBmYtFeu14fujF9cag) Content-type: text/html; charset=iso-8859-1 Content-transfer-encoding: 7BIT

To All:
 
This is a test message to see if it makes it to the
list.
 
Thanks.
 
Henry Steigerwaldt
Hermitage, TN
 
--Boundary_(ID_nnJ7sBmYtFeu14fujF9cag)-- From dyoo@hkn.eecs.berkeley.edu Fri Aug 16 05:38:42 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Thu, 15 Aug 2002 21:38:42 -0700 (PDT) Subject: [Tutor] Test message In-Reply-To: <003b01c244dc$bb491ce0$0201a8c0@eagle> Message-ID: On Thu, 15 Aug 2002, Henry Steigerwaldt wrote: > This is a test message to see if it makes it to the list. You're coming through loud and clear. *grin* Glad to see it's working now. From idiot1@netzero.net Sat Aug 17 05:35:40 2002 From: idiot1@netzero.net (Kirk Bailey) Date: Sat, 17 Aug 2002 00:35:40 -0400 Subject: [Tutor] Error in cgi script having health effects on blood presure readings Message-ID: <3D5DD29C.6EB20242@netzero.net> MY blood pressure, as I get frustrated. Folks, I am getting an error which is driving me a little nutz-er. I was asked to build a method whereby a user can inspect the membership roster of a list he is the owner of. OK, but it has to be secure, so a simple ssi include is out. I wrote a form script to build a web page with form and the domain name read in from the cf file- it works fine, the URL is it's output. The SECOND script checks for identity and password, and displays results IF everything checks out. Alas, it bombs. Here is the url for the form page: http://www.tinylist.org/cgi-bin/TLmembershipform.py BEWARE WORD WRAP! THE URL: http://www.tinylist.org/cgi-bin/TLmemberlister.py?Owner=highprimate%40howlermonkey.net&password=fubar&listname=testlist3&Submit=SUBMIT RESULTS THE CURENT ERROR Traceback (innermost last): File "/www/www.tinylist.org/cgi-bin/TLmemberlister.py", line 125, in ? mylist = form.getvalue("listname","") # listname, File "/usr/local/lib/python1.5/cgi.py", line 888, in __getattr__ raise AttributeError, name AttributeError: getvalue THE SCRIPT Listing of file TLmemberlister.py in directory:/www/www.tinylist.org/cgi-bin #!/usr/local/bin/python # # This is TLmemberviewer V:1.3.0 COPYRIGHT 2002 by Kirk D Bailey # # It is part of the TinyList MLM suite, released under the GNU GPL. # which suite is also COPYRIGHT 2002 by Kirk D Bailey. # Please referr to enclosed GNU license in a seperate file. # # Being modular makes for MORE CHOICES AVAILABLE TO YOU! #10############################################################################# ### # Python can be studied and aquired at http://www.python.org/ !!! #########1#########2#########3#########4#########5#########6#########7#########8 # that line is 80 char across, try to stay within it if you can. # # ADMIN AND LEGAL STUFF: # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. #20 # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # You should have received a copy of the GNU General Public License #30 along with this program; if not, write to: # # Free Software Foundation, Inc. # 59 Temple Place - Suite 330 # Boston, MA 02111-1307 USA. # # and request one; be cool and include a business sized SASE. # # Also, the GNU GPL may be viewed online at # http://www.gnu.org/licenses/gpl.html #40############################################################################ # # "The tyrant's foe, the people's friend, a free press." -Dr Benjamin Franklin. # # Think about that last line- this software is your Ezine engine. ############################################################################### # # OWNERSHIP AND PERMISSION ISSUES # make sure this script runs as a TRUSTED USER- # and NOT as root!!! You set that up in the Sendmail Config file (sendmail.cf). #50 Make sure that a NON-priviliged user OWNS # this script, and that it runs as that identity! # Generally, this is accomplished by making sure it is owned by that user. # Permission on all scripts must be 755, files as 666, and listdir as 744. # The image files must NOT be placed in the cgi-bin, but in the web directory! ############################################################################### # # SPAM # Spam SUCKS. It also ROBS everyone it touches, each system it passes through. # Fight spam. DO NOT host open lists all the world may post to. #60 TinyList CANNOT do so as written, PLEASE do not defeat this. # ############################################################################### # # import os, sys, string, cgi # MUST be invoked! # # CONFIGURATION SECTION # ===================== # #70 # NOTE that this script is SUPPOSED to be installed in the web cgi-bin! # and the lists dir is immediately under this dir! # # ok, where am I? I just woke up! fullpathtoscript = os.path.split(os.path.abspath(sys.argv[0])) # # ok, now my config file is supposed to be RIGHT HERE with me! # So let's read the thing! f1=open("tinylist.cf",'r') #80 # Tell me little file, who am I? webdomain=string.strip(f1.readline()) f1.close() # # knowing where I am, I know that my lists are ONE FLOOR DOWN! path=fullpathtoscript[0] # ALL TinyList scripts MUST live in the web cgi-bin, and # ALL global and list files are directly off the web cgi-bin dir in '/lists'. # that dir should be owned by the same owner and group as this script, and #90 should be chmod 766. DIR 'list' must be 766, with all Scripts 755. # # # # # # # # # data arrives as 'QUERY_STRING'=(listname value) using #100 the GET method, but cgi module handles this nicely, # parsing it out into keywords and vlaues in a dictionary! # # # print "Content-type: text/html\n\n" # HTML is following print '' print '' print 'TinyList membership listing Utility.' print '' print "" print '
' print '


  TinyList

' print '


' # form=cgi.FieldStorage() # recover the form's data, if not (form.has_key("Owner")): # debug code insues print "Key 'owner' not found!" #120 if not (form.has_key("password")): print "key 'password' not found!" if not (form.has_key("listname")): print "key 'listname' not found!" mylist = form.getvalue("listname","") # listname, print 'listname='+mylist+'

' myowner = form.getvalue("Owner","") # owner, print 'owner='+myowner+'

' mypassword = form.getvalue("password","") # and password. print 'password='+mypassword+'

' #130 end debug code f1=open('/lists/' + listname + '.owner','r') # read the (listname).owner file , trueowner=string.srip(f1.readline()) # read the owner id trueword=string.strip(f1.readline()) # read THE PASSWORD f1.close() # Close the file. if myowner == trueowner : # if the owner matches up, test the password; if mypassword==trueword: # if the password also matches, f1=open('/lists/'+ mylist,'r') #proceed to access the member roster. members=f1.readlines() # read them in, f1.close # and close the file. for i in members: #130 print i + '
' else: print 'Sorry, wrong password.' else: print 'Sorry, wrong owner id.' # print '


' # close the page, and en d. # # #140 # ns# ns# -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | KILL spam dead! http://www.scambusters.org/stopspam/#Pledge | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com From bjmartin98@pennswoods.net Sat Aug 17 21:14:16 2002 From: bjmartin98@pennswoods.net (Billie) Date: Sat, 17 Aug 2002 16:14:16 -0400 Subject: [Tutor] Newbie question Message-ID: <000a01c2462a$aa24bba0$74344d3f@bjmartin98> This is a multi-part message in MIME format. ------=_NextPart_000_0007_01C24609.2238E840 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello: I'm doing an exercise in which you get three guesses before the program = quits. #Note that this must not be the password so that the #while loop runs at least once. password =3D "foobar" count =3D 0 #intialize to zero #note that !=3Dmeans not equal while password !=3D "unicorn": password =3D raw_input("Password:") count =3D count + 1 # add one each time round the loop print "You've entered the password %d times."%count if password !=3D "unicorn" and count >=3D 3: print" You cannot enter!" break =20 if password =3D=3D "unicorn": print "Welcome in" My question is "Isn't using the break here bad form?" I don't know how = to stop the program at 3 guesses unless the answer is "unicorn". I need = it to stop also if at 3 guesses the password is wrong. Help! Billie ------=_NextPart_000_0007_01C24609.2238E840 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello:
I'm doing an exercise in which you get = three=20 guesses before the program quits.
 
#Note that this must not be the = password so that=20 the
#while loop runs at least once.
password =3D "foobar"
count = =3D 0=20 #intialize to zero
#note that !=3Dmeans not equal
while password = !=3D=20 "unicorn":
    password =3D=20 raw_input("Password:")
    count =3D count + 1  # = add one=20 each time round the loop
    print "You've entered the = password %d times."%count
    if password !=3D = "unicorn" and=20 count >=3D 3:
 print" You cannot = enter!"
 break
 
if=20 password =3D=3D "unicorn":
    print "Welcome = in"
 
 
My question is "Isn't using the break = here bad=20 form?"  I don't know how to stop the program at 3 guesses unless = the answer=20 is "unicorn".  I need it to stop also if at 3 guesses the password = is=20 wrong.
 
Help!
Billie
------=_NextPart_000_0007_01C24609.2238E840-- From iumarumo@eidosnet.co.uk Sat Aug 17 21:59:26 2002 From: iumarumo@eidosnet.co.uk (ibraheem umaru-mohammed) Date: Sat, 17 Aug 2002 21:59:26 +0100 Subject: [Tutor] Newbie question In-Reply-To: <000a01c2462a$aa24bba0$74344d3f@bjmartin98> References: <000a01c2462a$aa24bba0$74344d3f@bjmartin98> Message-ID: <20020817205926.GA1488@micromuse.com> [Billie wrote...] -| Hello: -| I'm doing an exercise in which you get three guesses before the program quits. -| -| #Note that this must not be the password so that the -| #while loop runs at least once. -| password = "foobar" -| count = 0 #intialize to zero -| #note that !=means not equal > Don't think the comment above is necessary, as the reader should/would know "!=" is what it is. -| while password != "unicorn": -| password = raw_input("Password:") -| count = count + 1 # add one each time round the loop -| print "You've entered the password %d times."%count -| if password != "unicorn" and count >= 3: -| print" You cannot enter!" -| break -| if password == "unicorn": -| print "Welcome in" -| > Although this works, it could be neater. Looking at your code, you test password against unicorn three times. I think you could test password against unicorn once, and test count against the maximum number of incorrect passwords once. Here is an example, -- -- #!/usr/bin/python password_attempts=0 max_incorrect_attempts=3 while password_attempts < max_incorrect_attempts: password = raw_input("Password: ") password_attempts+=1 if password == "unicorn": print "Password accepted. Welcome in." break else: print "Incorrect password. Please try again." else: print print "%d incorrect password attempts!" % max_incorrect_attempts print "You cannot enter!" -- -- -| -| My question is "Isn't using the break here bad form?" I don't know how -| to stop the program at 3 guesses unless the answer is "unicorn". I need -| it to stop also if at 3 guesses the password is wrong. > The code snippet above uses a break in a similar way, so there is nothing wrong in terms of form. The break statement terminates the loop, and also skips the else statement of the while loop. We use the else statement with the while loop, so that when the condition is false (i.e password_attempts < max_incorrect_attempts) the else statement is executed, as the last step before termination of the loop. -| -| Help! -| Billie HTH --ibs. -- ibraheem umaru-mohammed www.micromuse.com --0-- From kb@kb2.net Sun Aug 18 02:07:13 2002 From: kb@kb2.net (Kyle Babich) Date: Sun, 18 Aug 2002 01:07:13 UT Subject: [Tutor] referrer, triming Message-ID: <20020818010713.593A5937FB@server2.fastmail.fm> Quick question, how/where do I find the HTTP_REFERRER and how would I trim it to just the file? (Ie. if the referrer was http://abc.com/media/dateline.html how would I trim it to dateline.html?) Also is there a way to do it within the server? (Ie. referrer /home/public_html/123.html) Thank you, -- Kyle From dyoo@hkn.eecs.berkeley.edu Sun Aug 18 05:44:53 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sat, 17 Aug 2002 21:44:53 -0700 (PDT) Subject: [Tutor] referrer, triming [getting environmental varaibles and the 'urlparse' module] In-Reply-To: <20020818010713.593A5937FB@server2.fastmail.fm> Message-ID: On Sun, 18 Aug 2002, Kyle Babich wrote: > Quick question, how/where do I find the HTTP_REFERRER Hi Kyle, glad to hear from you again! I believe that it should be one of the environmental variables available to your CGI program. A program's environmental variables are accessible through the 'os.environ' dictionary. os.environ['HTTP_REFERRER'] should be enough to get the referrer information. > and how would I trim it to just the file? (Ie. if the referrer was > http://abc.com/media/dateline.html how would I trim it to > dateline.html?) The 'urlparse' module has a few functions in there that can help you break up an 'url' into pieces. http://www.python.org/doc/lib/module-urlparse.html You'll probably need to fiddle with the urlsplit() or urlparse() functions a bit, but it shouldn't be too bad. I hope this helps! From thomi@thomi.imail.net.nz Sun Aug 18 11:39:15 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Sun, 18 Aug 2002 22:39:15 +1200 Subject: [Tutor] python GUI module selection. In-Reply-To: <20020816002922.06b166e3.thomi@thomi.imail.net.nz> References: <20020816002922.06b166e3.thomi@thomi.imail.net.nz> Message-ID: <20020818223915.53a081eb.thomi@thomi.imail.net.nz> thanks for all that guys. Ill have to start doing some coding soonish.. now that most of the design is out of the way :-) -- This message was brought to you by one bored guy, with nothing better to do, And the letter Q. Thomi Richards, thomi@imail.net.nz From randolph.s.robinson@btinternet.com Sun Aug 18 12:55:20 2002 From: randolph.s.robinson@btinternet.com (Stuart Robinson) Date: Sun, 18 Aug 2002 11:55:20 +0000 Subject: [Tutor] Pythoncard Message-ID: <200208181155.20659.randolph.s.robinson@btinternet.com> Hey all, I'm having a little difficulty (import errors) getting python to see wher= e=20 PythonCardPrototype is. I'm running suse linux and Activestate python 2.2= =2E=20 WX and PythonCardPrototype are both in the same directory and I've no tro= uble=20 getting WX apps to run. FYI my path is set in .bashrc with: =09export PATH=3D/usr/local/ActivePython-2.2/bin/:$PATH The resulting error when I ryun a minimal PythonCard app is: =09Import Error: no module names PythonCardPrototype Has anyone here had experience with the same problem?=20 Thanks in advance for any suggestions. Stu From rab121@york.ac.uk Sun Aug 18 15:12:19 2002 From: rab121@york.ac.uk (Russell Bungay) Date: Sun, 18 Aug 2002 15:12:19 +0100 Subject: [Tutor] Little Encryption Tool Message-ID: <3D5FAB43.51767A4@york.ac.uk> Hello All, I think I remember someone asking about encrypting information or passwords or something recently? Or I may be imagining it (can't find anything in the archives...). Anyway, here is a little class I knocked up over the last couple of days. Basically, it creates and accesses simple text files containing key:password pairs with the passwords encrypted using the rotor module. As you will be able to from the code this is not very secure and should NOT be used for storing any kind of sensitive information. I wrote it merely as a little exercise and to keep a few non-important passwords for the many odd services I use in a place where prying eyes couldn't easily see them. A much more detailed description is available in the text file at: http://www-users.york.ac.uk/~rab121/comp/prog/bmdpwd.txt I think it works pretty well, I haven't tried it anger yet (I only finished it off this morning). Also submitted to Useless :o) Cheers, Russell Bungay -- Tulips Ate My Socks http://www.bigmaddrongo.com Chair of The York Glee Singers: http://www.gleesingers.co.uk """ bmdpwd.py: module for saving, accessing and changing passwords in an encrypted file. Passwords are saved as key: password pairs. Passwords are encrypted with rotor, using the key name and filename as encryption keys. A password is required to access each file, this is encrypted as the first line of each file using the filename and a string as encryption key. Please do not use colons : in keys as this will break the parsing of password files. there are no other restrictions. This system offers little real protection and is intended only to provide a simple way of keeping casual prying eyes away from passwords. DO NOT use this to secure genuinely valuble information. Version 0.2.01 18th August 2002 Author: R A Bungay/Big Mad Drongo """ import os.path, rotor class BmdPwdError(Exception): def __init__(self, value): self.value = value def __str__(self): return `self.value` class BmdPwdFileError(BmdPwdError): def __init__(self, file): BmdPwdError.__init__(self, 'No such BmdPwd File: %s' % file) class BmdPwdKeyExistsError(BmdPwdError): def __init__(self, key): BmdPwdError.__init__(self, 'This key already exists: %s' % key) class BmdPwdNoSuchKeyError(BmdPwdError): def __init__(self, key): BmdPwdError.__init__(self, 'No such key exists: %s' % key) class BmdPwdPwdTypeError(BmdPwdError): def __init__(self, key): BmdPwdError.__init__(self, 'Invalid Type for password: Must be string') class BmdPwdInvalidPwdError(BmdPwdError): def __init__(self, key): BmdPwdError.__init__(self, 'Invlaid password for %s key' % key) class BmdPwdInvalidFilePwdError(BmdPwdError): def __init__(self, file): BmdPwdError.__init__(self, 'Invlaid password for file %s' % file) class BmdPwd: def __init__(self, file, fpwd, encrypt="default", newfile=0): """Validate existance of file and file password.""" if newfile == 1: self.newpwdfile(file, fpwd, encrypt) #use flag to create new file if os.path.exists(file): self.file = file else: raise BmdPwdFileError, file filerotor = rotor.newrotor('%s%s' % (file, encrypt)) #create new rotor object to check file password pwdfile = open(self.file, 'r') if not fpwd == filerotor.decrypt(pwdfile.readline().strip()): pwdfile.close() raise BmdPwdInvalidFilePwdError, file #validate file password del filerotor pwdfile.close() def encrypt(self, key, pwd): """Encrypts pwd and writes key: pwd pair to end of file.""" try: pwdfile = open(self.file, 'r') for line in pwdfile.readlines(): #check file for existance of key if line.split(':')[0] == key: pwdfile.close() raise BmdPwdKeyExistsError, key pwdfile.close() bmdrotor = rotor.newrotor('%s%s' % (self.file, str(key))) #use encryption key of filename and keyname enpwd = bmdrotor.encrypt(pwd) del bmdrotor pwdfile = open(self.file, 'a') pwdfile.write('%s:%s\n' % (key, enpwd)) #write key: encrypted pwd line end pwdfile.close() except TypeError, value: raise BmdPwdPwdTypeError, 0 def decrypt(self, key): """Decrypts and returns pwd.""" pwdline = '' #only set from blank if key is in file pwdfile = open(self.file, 'r') for line in pwdfile.readlines(): if key == line.split(':')[0]: #will break if encrypted file password contains key: (very unlikely) pwdline = line break pwdfile.close() bmdrotor = rotor.newrotor('%s%s' % (self.file, str(key))) if pwdline == '': raise BmdPwdNoSuchKeyError, key #no key found else: return bmdrotor.decrypt(pwdline.split(':', 1)[1].strip()) #return decrypted value based on key,file encryption key def pwdchange(self, key, opwd, npwd): """Checks old pwd and writes new pwd to file.""" if not opwd == self.decrypt(key): raise BmdPwdInvalidPwdError, key #validate old pwd pwdfile = open(self.file, 'r') keys = pwdfile.readlines() pwdfile.close() for k in keys: if key == k.split(':')[0]: #remove key with old pwd from lines del keys[keys.index(k)] break pwdfile = open(self.file, 'w') #write file back with line removed pwdfile.writelines(keys) pwdfile.close() self.encrypt(key, npwd) #encrypt new pwd back into the file def newpwdfile(self, file, fpwd, encrypt): """Creates new pwd file.""" filerotor = rotor.newrotor('%s%s' % (file, encrypt)) newpwd = '%s%s' % (filerotor.encrypt(fpwd),'\n') del filerotor newfile = open(file, 'w') #write encrypted file pwd to first line of new file newfile.write(newpwd) newfile.close() From buc40@bemail.org Sun Aug 18 15:56:09 2002 From: buc40@bemail.org (S A) Date: Sun, 18 Aug 2002 07:56:09 -0700 Subject: [Tutor] How secure is the mail module? Message-ID: <200208181456.g7IEu9O08168@mail22.bigmailbox.com> Hi Everyone- Does anyone know how secure the mail Module is when sending usernames and passwords to mail servers? Is it just sending plain text? Is there a way to make sure data is being securely sent to the mail server? Thanks. SA "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From paul@meaney.cjb.net Sun Aug 18 17:27:33 2002 From: paul@meaney.cjb.net (paul meaney) Date: Sun, 18 Aug 2002 17:27:33 +0100 Subject: [Tutor] stuck newbie Message-ID: <000a01c246d4$28f57060$b08f4c51@paulkqormmrjdc> This is a multi-part message in MIME format. ------=_NextPart_000_0007_01C246DC.89C6ECE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Im a total newbie and this is my first effort at writing my own bit of = code. The program asks for the user to enter details of soccer teams = performance from their last six home/away games to calculate a = performance score. Everything was going well to this point until I when it started skipping = the section asking for home team and only inputs the team names and the = following error message is generated;=20 Traceback (most recent call last): File "E:\Documents and Settings\paul\Desktop\match_form.py", line 24, = in ? while aw + ad + al !=3D 6 : NameError: name 'aw' is not defined I know this will probably be a fundamental mistake, but your help and = guidance would be appreciated, Paul #enter home team details print "Please enter home team details" home_team =3D raw_input ("Enter home team: ") #check that no more than 6 results are entered while hw + hd + hl !=3D 6 : hw =3D input ("Enter number home teams no. of home wins out of last = six games 6: ") hd =3D input ("Enter number home teams no. of home draws out of last = six games 6: ") hl =3D input ("Enter number home teams no. of home defeats out of = last six games 6: ") =20 if hw + hd + hl > 6: print "These figures come to more than six = games this system works on the form of the last six games only" if hw + hd + hl < 6: print "These figures come to less than six = games this system works on the form of the last six games only"=20 else: print "Please enter away team details" #enter away team details away_team =3D raw_input ("Enter away team: ") #check that no more than 6 results are entered while aw + ad + al !=3D 6 : aw =3D input ("Enter number away teams no. of away wins out of last = six games 6: ") ad =3D input ("Enter number away teams no. of away draws out of last = six games 6: ") al =3D input ("Enter number away teams no. of away defeats out of = last six games 6: ") if aw + ad + al > 6: print "These figures come to more than six = games this system works on the form of the last six games only" if aw + ad + al < 6: print "These figures come to less than six = games this system works on the form of the last six games only"=20 #calculate probability of each team winning --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002 ------=_NextPart_000_0007_01C246DC.89C6ECE0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 
Im a total newbie and this is my first = effort at=20 writing my own bit of code. The program asks for the user to enter = details of=20 soccer teams performance from their last six home/away games to = calculate a=20 performance score.
 
Everything was going well to this point = until I=20 when it started skipping the section asking for home team and only = inputs the=20 team names and the following error message is generated;
 
Traceback (most recent call = last):
  File=20 "E:\Documents and Settings\paul\Desktop\match_form.py", line 24, in=20 ?
    while aw + ad + al !=3D 6 :
NameError: name = 'aw' is not=20 defined
 
I know this will probably be a = fundamental mistake,=20 but your help and guidance would be appreciated,
 
Paul
 
#enter home team details
 
print "Please enter home team = details"
home_team=20 =3D raw_input ("Enter home team: ")
 
#check that no more than 6 results are=20 entered
 
while hw + hd + hl !=3D 6 = :
    hw=20 =3D input ("Enter number home teams no. of home wins out of last six = games 6:=20 ")
    hd =3D input ("Enter number home teams no. of = home draws=20 out of last six games 6: ")
    hl =3D input ("Enter = number home=20 teams no. of home defeats out of last six games 6: = ")
   =20
    if hw + hd + hl > 6: print "These figures come = to more=20 than six games this system works on the form of the last six games=20 only"
    if hw + hd + hl < 6: print "These figures = come to=20 less than six games this system works on the form of the last six games = only"=20
    = else:
        print=20 "Please enter away team details"
 

#enter away team details
 
away_team =3D raw_input ("Enter away team: ")
 
#check that no more than 6 results are entered
 

while aw + ad + al !=3D 6 :
    aw =3D input = ("Enter=20 number away teams no. of away wins out of last six games 6:=20 ")
    ad =3D input ("Enter number away teams no. of = away draws=20 out of last six games 6: ")
    al =3D input ("Enter = number away=20 teams no. of away defeats out of last six games 6: = ")
    if=20 aw + ad + al > 6: print "These figures come to more than six games = this=20 system works on the form of the last six games = only"
    if aw=20 + ad + al < 6: print "These figures come to less than six games this = system=20 works on the form of the last six games only"
 
#calculate probability of each team winning
 
 

---
Outgoing mail is certified Virus Free.
Checked by AVG = anti-virus system (http://www.grisoft.com).
Version: = 6.0.381 /=20 Virus Database: 214 - Release Date: = 02/08/2002
------=_NextPart_000_0007_01C246DC.89C6ECE0-- From marta_andrea@libero.it Sun Aug 18 18:04:47 2002 From: marta_andrea@libero.it (Andrea Valle) Date: Sun, 18 Aug 2002 19:04:47 +0200 Subject: [Tutor] string conversion In-Reply-To: Message-ID: Dear List, I am creating a simple plotter for mathematical functions. Im my thoughts, I'd like to let the user give in input a string containin= g a mathematical function, i.e. =66rom math import * function=3Dinput("function?\n") >>> function? >>> "sin(x)" How can I make some textual substition, so to convert the string 'functio= n' in code? Is it possible? Thank you as usual -a- Andrea Valle via Lanzo 108 10073 - Ciri=E8 (TO) ITALIA 011/921 45 84 - 349/55 47 343 From shalehperry@attbi.com Sun Aug 18 18:17:08 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Sun, 18 Aug 2002 10:17:08 -0700 (PDT) Subject: [Tutor] stuck newbie In-Reply-To: <000a01c246d4$28f57060$b08f4c51@paulkqormmrjdc> Message-ID: On 18-Aug-2002 paul meaney wrote: > > Im a total newbie and this is my first effort at writing my own bit of code. > The program asks for the user to enter details of soccer teams performance > from their last six home/away games to calculate a performance score. > > Everything was going well to this point until I when it started skipping the > section asking for home team and only inputs the team names and the following > error message is generated; > > Traceback (most recent call last): > File "E:\Documents and Settings\paul\Desktop\match_form.py", line 24, in ? > while aw + ad + al != 6 : > NameError: name 'aw' is not defined > > I know this will probably be a fundamental mistake, but your help and > guidance would be appreciated, > is this your entire script? It looks like you simply forgot to initialize the variables before the loop: aw = 0 ad = 0 al = 0 while aw + ad + al != 6: ... ... in Python the variable must exist before it can be used. From budgester@budgester.com Sun Aug 18 19:43:36 2002 From: budgester@budgester.com (Martin Stevens) Date: Sun, 18 Aug 2002 19:43:36 +0100 Subject: [Tutor] Output XML from Python Message-ID: <20020818184336.GA4405@budge.net> Hi, I've written an application that reads XML documents and does various things with it, however the next stage is output back to XML. The question is this: Is there a prefered method of outputing to XML or is it just a case of opening a new file and doing the formating in the code and then writing out. TIA Martin Stevens -- Budgester Technologies Ltd Office : 01992 718568 Mobile : 07815 982380 mailto:martin@budgester.com http://www.budgester.com From glingl@aon.at Sun Aug 18 19:46:34 2002 From: glingl@aon.at (Gregor Lingl) Date: Sun, 18 Aug 2002 20:46:34 +0200 Subject: [Tutor] string conversion References: Message-ID: <3D5FEB8A.6080205@aon.at> Andrea Valle schrieb: >Dear List, >I am creating a simple plotter for mathematical functions. >Im my thoughts, I'd like to let the user give in input a string containing a >mathematical function, i.e. > >from math import * >function=input("function?\n") > > > >>>>function? >>>>"sin(x)" >>>> >>>> > >How can I make some textual substition, so to convert the string 'function' >in code? Is it possible? > >Hi Andrea! > At the moment I've only got two minutes to anser this. (One could talk about it hours) Try the following (and note the difference between input and raw_input, which in essence is: input = raw_input+eval >>> from math import sin >>> x = 1.0 >>> i = input("function? ") function? sin(x) >>> i 0.8414709848078965 >>> # this is sin(1.0) >>> f = raw_input("Funktion? ") Funktion? sin(x) >>> f 'sin(x)' >>> eval(f) 0.8414709848078965 >>> x = 0.5 >>> eval(f) 0.47942553860420301 >>> Hope that helps. at least as an appetizer Gregor From paul@meaney.cjb.net Sun Aug 18 23:27:08 2002 From: paul@meaney.cjb.net (paul meaney) Date: Sun, 18 Aug 2002 23:27:08 +0100 Subject: [Tutor] stuck newbie References: Message-ID: <001001c24706$64741420$077f893e@paulkqormmrjdc> *blushes* thanks ----- Original Message ----- From: "Sean 'Shaleh' Perry" To: "paul meaney" Cc: Sent: Sunday, August 18, 2002 6:17 PM Subject: RE: [Tutor] stuck newbie > > On 18-Aug-2002 paul meaney wrote: > > > > Im a total newbie and this is my first effort at writing my own bit of code. > > The program asks for the user to enter details of soccer teams performance > > from their last six home/away games to calculate a performance score. > > > > Everything was going well to this point until I when it started skipping the > > section asking for home team and only inputs the team names and the following > > error message is generated; > > > > Traceback (most recent call last): > > File "E:\Documents and Settings\paul\Desktop\match_form.py", line 24, in ? > > while aw + ad + al != 6 : > > NameError: name 'aw' is not defined > > > > I know this will probably be a fundamental mistake, but your help and > > guidance would be appreciated, > > > > is this your entire script? It looks like you simply forgot to initialize the > variables before the loop: > > aw = 0 > ad = 0 > al = 0 > while aw + ad + al != 6: > ... > ... > > in Python the variable must exist before it can be used. > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002 From gus.tabares@verizon.net Mon Aug 19 02:58:01 2002 From: gus.tabares@verizon.net (Gus Tabares) Date: Sun, 18 Aug 2002 21:58:01 -0400 Subject: [Tutor] Trying to shadow... Message-ID: Hello, I'm looking for a module? or something that won't show any text when you type in a password if prompted for one. Any help will be greatly appreciated. Thank you... Gus From python Mon Aug 19 03:12:34 2002 From: python (python) Date: Sun, 18 Aug 2002 19:12:34 -0700 Subject: [Tutor] Trying to shadow... In-Reply-To: References: Message-ID: <146324082484.20020818191234@inkedmn.net> getpass will do what you want. best of luck, brett GT> Hello, GT> I'm looking for a module? or something that won't show any text when you GT> type in a password if prompted for one. Any help will be greatly GT> appreciated. Thank you... GT> Gus GT> _______________________________________________ GT> Tutor maillist - Tutor@python.org GT> http://mail.python.org/mailman/listinfo/tutor From selevin@attbi.com Mon Aug 19 04:51:51 2002 From: selevin@attbi.com (selevin) Date: Sun, 18 Aug 2002 23:51:51 -0400 Subject: [Tutor] Love it Message-ID: <000c01c24733$c0cb7a60$99b3b042@chara> This is a multi-part message in MIME format. ------=_NextPart_000_0009_01C24712.396D8F20 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Last time I did this it was 1980 on punch cards. =20 That was in Brooklyn College. Steve. ------=_NextPart_000_0009_01C24712.396D8F20 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Last time I did this it was 1980 on = punch=20 cards.
 
That was in Brooklyn = College.
Steve.
------=_NextPart_000_0009_01C24712.396D8F20-- From espo89@msn.com Mon Aug 19 05:00:43 2002 From: espo89@msn.com (melvin terry) Date: Mon, 19 Aug 2002 00:00:43 -0400 Subject: [Tutor] Want something cool Message-ID: ------=_NextPart_001_0002_01C24713.76119650 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I jus started python can some one e mail me something like a cool script?= Get more from the Web. FREE MSN Explorer download : http://explorer.msn.= com ------=_NextPart_001_0002_01C24713.76119650 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I jus started = python can some one e mail me something like a cool script?

 


Get more from the Web= . FREE MSN Explorer download : http:= //explorer.msn.com

------=_NextPart_001_0002_01C24713.76119650-- From python Mon Aug 19 05:10:03 2002 From: python (python) Date: Sun, 18 Aug 2002 21:10:03 -0700 Subject: [Tutor] Want something cool In-Reply-To: References: Message-ID: <36331131850.20020818211003@inkedmn.net> you can check these two sites out: http://www.codeexamples.org <--- a ton of well commented code :) http://www.inkedmn.net/code <--- that's just a bunch of stuff i've done. some is finished, some isn't best of luck, brett mt> I jus started python can some one e mail me something like a cool script?Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com From espo89@msn.com Mon Aug 19 05:15:57 2002 From: espo89@msn.com (melvin terry) Date: Mon, 19 Aug 2002 00:15:57 -0400 Subject: [Tutor] I saw this Message-ID: ------=_NextPart_001_0003_01C24715.96DD5C50 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I want to break into a website with python (this guy is making fun of me) is this possible O ya and when I try to write a file I get to like say I say type 1 for (a= name say tom) and I want it to say tom is so cool after they type 1 this= is what I got so far print "Hi my name is tom and this is the subertrip program" print "-------------------------------------------------------" print "please pick a name" print "1 for tom" name =3D input("1") =20 thanksGet more from the Web. FREE MSN Explorer download : http://explore= r.msn.com ------=_NextPart_001_0003_01C24715.96DD5C50 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I want to brea= k into a website with python (this guy is making fun of me)

 = is this possible
O ya and when I try to write a file I get to = like say I say type 1 for (a name say tom) and I want it to say tom is so= cool after they type 1 this is what I got so far
 
=
 
print "Hi my name is tom and this is the sub= ertrip program"
print "-----------------------------------------------= --------"
print "please pick a name"
print "1 for tom"
name =3D = input("1")
  
thanks


Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com

------=_NextPart_001_0003_01C24715.96DD5C50-- From espo89@msn.com Mon Aug 19 05:16:20 2002 From: espo89@msn.com (melvin terry) Date: Mon, 19 Aug 2002 00:16:20 -0400 Subject: [Tutor] hi Message-ID: ------=_NextPart_001_0004_01C24715.A4F96BD0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I want to break into a website with python (this guy is making fun of me) is this possible O ya and when I try to write a file I get to like say I say type 1 for (a= name say tom) and I want it to say tom is so cool after they type 1 this= is what I got so far print "Hi my name is tom and this is the subertrip program" print "-------------------------------------------------------" print "please pick a name" print "1 for tom" name =3D input("1") =20 thanksGet more from the Web. FREE MSN Explorer download : http://explore= r.msn.com ------=_NextPart_001_0004_01C24715.A4F96BD0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

I want to break into a website with python (this guy is making fun of m= e)

 is this possible
O ya and when I try to write = a file I get to like say I say type 1 for (a name say tom) and I want it = to say tom is so cool after they type 1 this is what I got so far
<= DIV> 
 
print "Hi my name is tom and= this is the subertrip program"
print "-------------------------------= ------------------------"
print "please pick a name"
print "1 for t= om"
name =3D input("1")
  
thanks

&n= bsp;

 

 




Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com

------=_NextPart_001_0004_01C24715.A4F96BD0-- From rob@uselesspython.com Mon Aug 19 05:24:36 2002 From: rob@uselesspython.com (Rob) Date: Sun, 18 Aug 2002 23:24:36 -0500 Subject: [Tutor] I saw this In-Reply-To: Message-ID: Would anyone have any idea what I'm talking about if I said that this email reminds me of poetry by e. e. cummings? Rob -----Original Message----- To: tutor@python.org Subject: [Tutor] I saw this I want to break into a website with python (this guy is making fun of me) is this possible O ya and when I try to write a file I get to like say I say type 1 for (a name say tom) and I want it to say tom is so cool after they type 1 this is what I got so far print "Hi my name is tom and this is the subertrip program" print "-------------------------------------------------------" print "please pick a name" print "1 for tom" name = input("1") thanks From python Mon Aug 19 05:29:02 2002 From: python (python) Date: Sun, 18 Aug 2002 21:29:02 -0700 Subject: [Tutor] I saw this In-Reply-To: References: Message-ID: <62332270746.20020818212902@inkedmn.net> print "Hi my name is tom and this is the subertrip program" print "-------------------------------------------------------" print "please pick a name" name = int(raw_input("enter 1 for Tom: ")) if name = 1: print "Tom is so cool" else: print "you didn't enter 1" best of luck, brett mt> I want to break into a website with python (this guy is making fun of me) mt> is this possible mt> O ya and when I try to write a file I get to like say I say type 1 for (a name say tom) and I want it to say tom is so cool after they type 1 this is what I got so far mt> print "Hi my name is tom and this is the subertrip program" mt> print "-------------------------------------------------------" mt> print "please pick a name" mt> print "1 for tom" mt> name = input("1") mt> thanksGet more from the Web. FREE MSN Explorer download : http://explorer.msn.com From espo89@msn.com Mon Aug 19 05:35:48 2002 From: espo89@msn.com (melvin terry) Date: Mon, 19 Aug 2002 00:35:48 -0400 Subject: [Tutor] HELP Message-ID: ------=_NextPart_001_0005_01C24718.5CE53E70 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =20 print "Hi my name is tom and this is the subertrip program" print "-------------------------------------------------------" print "please pick a name" name =3D int(raw_input("enter 1 for Tom: ")) "if name =3D 1:" print "Tom is so cool" else: print "you didn't enter 1" this always comes up how do I fix it? SyntaxError: invalid syntax File "C:/Python22/sm", line 6 print "Tom is so cool" ^ SyntaxError: invalid syntaxGet more from the Web. FREE MSN Explorer down= load : http://explorer.msn.com ------=_NextPart_001_0005_01C24718.5CE53E70 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 
<= DIV> 
 
 
 
 
print "Hi my name is tom and this is the subertrip p= rogram"
print "-------------------------------------------------------= "
print "please pick a name"
name =3D int(raw_input("enter 1 for To= m: "))
"if name =3D 1:"
   print "Tom is so cool"
else= :
   print "you didn't enter 1"
 
=
 
 
 
this always co= mes up how do I fix it?
 
SyntaxError: invalid= syntax
  File "C:/Python22/sm", line 6
    pri= nt "Tom is so cool"
    ^
SyntaxError: invalid synta= x



Get more from the Web. = FREE MSN Explorer download : http://e= xplorer.msn.com

------=_NextPart_001_0005_01C24718.5CE53E70-- From python Mon Aug 19 05:48:04 2002 From: python (python) Date: Sun, 18 Aug 2002 21:48:04 -0700 Subject: [Tutor] HELP In-Reply-To: References: Message-ID: <93333413177.20020818214804@inkedmn.net> that's because there's quotes around the if statement. i don't remember putting those there, but take them off and it should work :) best of luck, brett mt> print "Hi my name is tom and this is the subertrip program" mt> print "-------------------------------------------------------" mt> print "please pick a name" mt> name = int(raw_input("enter 1 for Tom: ")) mt> if name = 1: mt> print "Tom is so cool" mt> else: mt> print "you didn't enter 1" mt> this always comes up how do I fix it? mt> SyntaxError: invalid syntax mt> File "C:/Python22/sm", line 6 mt> print "Tom is so cool" mt> ^ mt> SyntaxError: invalid syntaxGet more from the Web. FREE MSN Explorer download : http://explorer.msn.com From espo89@msn.com Mon Aug 19 05:45:47 2002 From: espo89@msn.com (melvin terry) Date: Mon, 19 Aug 2002 00:45:47 -0400 Subject: [Tutor] Re: HELP Message-ID: ------=_NextPart_001_0006_01C24719.C1E8A900 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I got this working but how do I get it say say chose 1 for michael or typ= e 2 for ryan? Then if they chose 2 have it say He is cool but not as cool= as MIchael? print "Hi my name is michael and this is the subertrip program" print "-------------------------------------------------------" print "please pick a name" name =3D int(raw_input("enter 1 for michael: ")) if name =3D=3D1: print "michael is so cool" else: print "He is ok but not as cool as michael"Get more from the Web. FRE= E MSN Explorer download : http://explorer.msn.com ------=_NextPart_001_0006_01C24719.C1E8A900 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 
<= DIV> 
=

I got this working but how do I get it say say chose 1 for michael or= type 2 for ryan? Then if they chose 2 have it say He is cool but not as = cool as MIchael?

 

print "Hi my name is michael and th= is is the subertrip program"
print "----------------------------------= ---------------------"
print "please pick a name"

name =3D int(= raw_input("enter 1 for michael: "))

if name =3D=3D1:
 &nbs= p; print "michael is so cool"
else:
   print "He is ok bu= t not as cool as michael"


<= hr>Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com

------=_NextPart_001_0006_01C24719.C1E8A900-- From espo89@msn.com Mon Aug 19 05:58:19 2002 From: espo89@msn.com (melvin terry) Date: Mon, 19 Aug 2002 00:58:19 -0400 Subject: [Tutor] hi Message-ID: ------=_NextPart_001_0007_01C2471B.82253200 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable why is this not working? print "Hi this is a secreat place only those here are members may continu= e" print "what is your password?" pass =3D int(raw_input("enter your password: ")) if pass =3D=3D idontknow: print "Welcome ryan" if pass =3D=3D wizard: print "welcome Michael" thanks everyone thats been helping me!Get more from the Web. FREE MSN Ex= plorer download : http://explorer.msn.com ------=_NextPart_001_0007_01C2471B.82253200 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
why is this no= t working?
 
 
print "Hi this = is a secreat place only those here are members may continue"
print "wh= at is your password?"
pass =3D int(raw_input("enter your password: "))=
if pass =3D=3D idontknow:
    print "Welcome ryan"<= BR>    if pass =3D=3D wizard:
    &= nbsp;   print "welcome Michael"
 
th= anks everyone thats been helping me!


 


Get more from the Web. FREE MSN Explorer do= wnload : http://explorer.msn.com<= br>

------=_NextPart_001_0007_01C2471B.82253200-- From dreynolds26@cogeco.ca Mon Aug 19 07:53:26 2002 From: dreynolds26@cogeco.ca (Darren Reynolds) Date: Mon, 19 Aug 2002 02:53:26 -0400 Subject: [Tutor] online "study guides" Message-ID: <3D6095E6.3050605@cogeco.ca> has anyone come across any worthwhie "study guides" concerning python that they could recommend to someone new to the language? i've got an idea for a tool i want to try writing for myself that i think python would be perfect for. in the past i've always found it easier to pick things up by having little "exercises" to work on with a corresponding answer sheet or whathaveyou to reference what i've done against. From dyoo@hkn.eecs.berkeley.edu Mon Aug 19 08:26:25 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 19 Aug 2002 00:26:25 -0700 (PDT) Subject: [Tutor] I saw this In-Reply-To: Message-ID: On Mon, 19 Aug 2002, melvin terry wrote: > I want to break into a website with python (this guy is making fun of > me) Hi Melvin, I'm sorry; we simply cannot help you do this. If you want to know why your intent makes me uncomfortable, see: http://www.tuxedo.org/~esr/faqs/hacker-howto.html What you are planning to do is unquestionably "cracking" in the malicious sense of the word. If you're fully convinced that cracking into someone else's web site will make your life better, there's probably nothing we can say to change your mind. But please reconsider what choices you have. Sincerely, Danny Yoo From dyoo@hkn.eecs.berkeley.edu Mon Aug 19 08:30:52 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 19 Aug 2002 00:30:52 -0700 (PDT) Subject: [Tutor] online "study guides" In-Reply-To: <3D6095E6.3050605@cogeco.ca> Message-ID: On Mon, 19 Aug 2002, Darren Reynolds wrote: > has anyone come across any worthwhie "study guides" concerning python > that they could recommend to someone new to the language? i've got an > idea for a tool i want to try writing for myself that i think python > would be perfect for. in the past i've always found it easier to pick > things up by having little "exercises" to work on with a corresponding > answer sheet or whathaveyou to reference what i've done against. Hi Darren, There are some pretty nice worksheets that the "Livewires" project has written; you may want to try them out: http://www.livewires.org.uk/python/ Give them a whirl; I think they're pretty nice! Good luck! From dyoo@hkn.eecs.berkeley.edu Mon Aug 19 08:44:57 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 19 Aug 2002 00:44:57 -0700 (PDT) Subject: [Tutor] Error in cgi script having health effects on blood presure readings In-Reply-To: <3D5DD29C.6EB20242@netzero.net> Message-ID: > Traceback (innermost last): > File "/www/www.tinylist.org/cgi-bin/TLmemberlister.py", line 125, in ? > mylist = form.getvalue("listname","") # listname, > File "/usr/local/lib/python1.5/cgi.py", line 888, in __getattr__ > raise AttributeError, name > AttributeError: getvalue Hi Kirk, Ah! the getvalue() method was only recently added in Python 2.2 as part of the "Higher Level Interface" of the 'cgi' module: http://www.python.org/doc/lib/node296.html If you want to stick with Python 1.52, you might be able to use this: mylist = form['listname'].value ... although this isn't quite equivalent. Is it possible to upgrade to Python 2.2? Hope this helps! From dyoo@hkn.eecs.berkeley.edu Mon Aug 19 08:49:19 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 19 Aug 2002 00:49:19 -0700 (PDT) Subject: [Tutor] Pythoncard In-Reply-To: <200208181155.20659.randolph.s.robinson@btinternet.com> Message-ID: On Sun, 18 Aug 2002, Stuart Robinson wrote: > I'm having a little difficulty (import errors) getting python to see > where PythonCardPrototype is. I'm running suse linux and Activestate > python 2.2. > > WX and PythonCardPrototype are both in the same directory and I've no trouble > getting WX apps to run. FYI my path is set in .bashrc with: > > export PATH=/usr/local/ActivePython-2.2/bin/:$PATH > > The resulting error when I ryun a minimal PythonCard app is: > > Import Error: no module names PythonCardPrototype Hi Stu, Hmmm... strange! Let's get some more information. Can you tell us where WX and PythonCardPrototype are installed? Absolute pathnames will help. Python actually uses the 'PYTHONPATH' environmental variable to find where more Python modules are located. However, we don't usually need to touch this if the modules have been installed with the standard distutils 'setup.py'. Does anyone know if wxpython and PythonCard are distutils-aware? We'll probably need more details to figure out what's going on. We'll get to the bottom of this. *grin* Good luck! From dyoo@hkn.eecs.berkeley.edu Mon Aug 19 09:02:05 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 19 Aug 2002 01:02:05 -0700 (PDT) Subject: [Tutor] stuck newbie [descriptive variable names] In-Reply-To: <000a01c246d4$28f57060$b08f4c51@paulkqormmrjdc> Message-ID: On Sun, 18 Aug 2002, paul meaney wrote: > Im a total newbie and this is my first effort at writing my own bit of > code. Cool! If you don't mind, I wanted to make some comments on the code. Sean already caught the initialzation bug, so I'll assume that the code is working fine now. > while hw + hd + hl != 6 : > hw = input ("Enter number home teams no. of home wins out of last six games 6: ") > hd = input ("Enter number home teams no. of home draws out of last six games 6: ") > hl = input ("Enter number home teams no. of home defeats out of last six games 6: ") [some code cut] This block of code looks like it tries to read the following: wins, draws, and losses, and tries to make sure that the numbers make sense. Sounds good so far. If it's possible, you may want to name your variables more descriptively. 'hw' here stands for 'home wins', when it could easily also mean 'hot water', or 'home world'. *grin* So something like: ### home_wins = input("Enter home teams no. of home wins: ") home_draws = input("Enter home teams no. of home draws: ") home_losses = input("Enter home teams no. of home losses: ") ### which is a little longer to type, admittedly, but is a little easier to read as well. Best of wishes to you! From glingl@aon.at Mon Aug 19 09:57:21 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 19 Aug 2002 10:57:21 +0200 Subject: [Tutor] stuck newbie [descriptive variable names] References: Message-ID: <3D60B2F1.4030504@aon.at> Danny Yoo schrieb: >So something like: > >### > home_wins = input("Enter home teams no. of home wins: ") > home_draws = input("Enter home teams no. of home draws: ") > home_losses = input("Enter home teams no. of home losses: ") >### > >which is a little longer to type, admittedly, but is a little easier to >read as well. > And a lot easier to understand ... Gregor From alan.gauld@bt.com Mon Aug 19 10:14:01 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 19 Aug 2002 10:14:01 +0100 Subject: [Tutor] Want something cool Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C841@mbtlipnt02.btlabs.bt.co.uk> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C24760.C1A0F960 Content-Type: text/plain; charset="iso-8859-1" > I jus started python can some one e mail me something like a cool script? If you haven't downloaded Python yet then go visit the "Useless Python" web site and look at the code there. If you have downloaded it look at the sample code that comes with the download (eg the tools directory) Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld ------_=_NextPart_001_01C24760.C1A0F960 Content-Type: text/html; charset="iso-8859-1"
 >  I jus started python can some one e mail me something like a cool script? 
 
If you haven't downloaded Python yet then go visit the
"Useless Python" web site and look at the code there.
 
If you have downloaded it look at the sample code that
comes with the download (eg the tools directory) 
 

Alan g.
Author of the 'Learning to Program' web site
http://www.freenetpages.co.uk/hp/alan.gauld

------_=_NextPart_001_01C24760.C1A0F960-- From printers@sendme.cz Mon Aug 19 12:54:40 2002 From: printers@sendme.cz (A) Date: Mon, 19 Aug 2002 13:54:40 +0200 Subject: [Tutor] How to do a program dump - reposted Message-ID: <3D60F8A0.15863.F9AF94F@localhost> Hi, I have a program( compiled into EXE with Installer) that runs well on some Win32 systems. The problem is that it runs on SOME not on ALL. Different users have different Win32 systems( some have W9x, others Win2k and still others Windows Me or XP.) Is there a way how to do a dump ( e.g. print line and the last successully executed command from my Python program ) when there is a General Protection Error ? Thanks for help Ladislav From Nicole.Seitz@urz.uni-hd.de Mon Aug 19 15:25:25 2002 From: Nicole.Seitz@urz.uni-hd.de (Nicole.Seitz@urz.uni-hd.de) Date: Mon, 19 Aug 2002 16:25:25 +0200 Subject: [Tutor] re.sub Message-ID: <1029767125.3d60ffd52748b@wwwmail.urz.uni-heidelberg.de> Hi there! Today I got the following exception after inserting re.sub("ü","=FC= ",text) somewhere in my program. Python 2.2.1 (#34, Apr 9 2002, 19:34:33) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. IDLE 0.8 -- press F1 for help >>> Exception in Tkinter callback Traceback (most recent call last): File "C:\Programme\lib\lib-tk\Tkinter.py", line 1292, in __call__ return apply(self.func, args) File "C:\PROGRA~1\Tools\idle\IOBinding.py", line 128, in save if self.writefile(self.filename): File "C:\PROGRA~1\Tools\idle\IOBinding.py", line 154, in writefile f.write(chars) UnicodeError: ASCII encoding error: ordinal not in range(128) Can anybody tell my why there's a problem with the German umlaut? Thanx in advance Nicole From alan.gauld@bt.com Mon Aug 19 17:28:31 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 19 Aug 2002 17:28:31 +0100 Subject: [Tutor] Re: HELP Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C852@mbtlipnt02.btlabs.bt.co.uk> > I got this working but how do I get it say say > chose 1 for michael or type 2 for ryan? > print "Hi my name is michael and this is the subertrip program" > print "-------------------------------------------------------" > print "please pick a name" print "1. Michael" print "2. Ryan" > name = int(raw_input("enter 1 for michael: ")) name = int(raw_input("Pick a number(1/2) ")) if name == 1: print "michael is so cool" elif: name == 2: print "He is cool but not as cool as MIchael?" The next step is to handle invalid input. Try searching the archives for this group at active state for "menu" and "error" etc. Its all been covered in the last couple of weeks... Alan g. From alan.gauld@bt.com Mon Aug 19 17:33:08 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 19 Aug 2002 17:33:08 +0100 Subject: [Tutor] hi Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C853@mbtlipnt02.btlabs.bt.co.uk> > why is this not working? Because you are getting your types all miuxed up. You need to go back and read about the difference between integers(numbers) and strings(characters) It looks like you might be reading Josh's tutor and I'm sure he covers it somewhere, but alternatively jump into mine at the topic called "Raw Materials" and read the first half. Without understanding that difference you will get into lots of difficulties. pass = int(raw_input("enter your password: ")) You are converting the password into a number - which doesn't make sense. if pass == idontknow: You are testing the password against a variable which isn't created yet, I think you should be using a string (ie surrounded by quotes) print "Welcome ryan" if pass == wizard: print "welcome Michael" The second of is indented too far, you need to pull it back to align with the first if... Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From slime@vsnl.net Mon Aug 19 17:41:21 2002 From: slime@vsnl.net (Prahlad Vaidyanathan) Date: Mon, 19 Aug 2002 22:11:21 +0530 Subject: [Tutor] building the readline module Message-ID: <20020819164121.GA25828@localhost.localdomain> Hi, I've been trying to build Python 2.2 with the readline module, in order to enable tab-completion, and other such nifty stuff in the interactive session, but I have so far been unsuccessful. I rummaged through the docs, and then did this. - ran the configure script (without arguments) - edited Modules/Setup, and uncommented the "readline" line - ran "make" But, make dies, saying that the linker (GNU ld) cannot find "-ltermcap". So, I looked for a libtermcap.a file, and, surely enough, it wasn't there. So, I pulled out my Mandrake 8.0 CD, and decided to install the relevant RPMS.viz. - readline - readline-devel - libtermcap2 But still, I can't seem to find the libtermcap.a file, and, as expected, "make" barfs at the same place. I don't know which package I should install, which has libtermcap.a (assuming that is where the problem lies), so I decided to ask here, and see if anyone knew what I am doing wrong. Do let me know. Thanks. pv. -- Prahlad Vaidyanathan Why you say you no bunny rabbit when you have little powder-puff tail? -- The Tasmanian Devil From dyoo@hkn.eecs.berkeley.edu Mon Aug 19 18:16:36 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 19 Aug 2002 10:16:36 -0700 (PDT) Subject: [Tutor] building the readline module In-Reply-To: <20020819164121.GA25828@localhost.localdomain> Message-ID: On Mon, 19 Aug 2002, Prahlad Vaidyanathan wrote: > I've been trying to build Python 2.2 with the readline module, in > order to enable tab-completion, and other such nifty stuff in the > interactive session, but I have so far been unsuccessful. > > I rummaged through the docs, and then did this. > > - ran the configure script (without arguments) > - edited Modules/Setup, and uncommented the "readline" line Actually, you shouldn't need to do the uncommenting anymore in 'Modules/Setup'. Recent versions of Python will, in most cases, autodetect modules for you when Python is being compiled. > But, make dies, saying that the linker (GNU ld) cannot find > "-ltermcap". So, I looked for a libtermcap.a file, and, surely enough, > it wasn't there. > > So, I pulled out my Mandrake 8.0 CD, and decided to install the > relevant RPMS.viz. > > - readline > - readline-devel > - libtermcap2 > > But still, I can't seem to find the libtermcap.a file, and, as > expected, "make" barfs at the same place. I don't know which package I > should install, which has libtermcap.a (assuming that is where the > problem lies), so I decided to ask here, and see if anyone knew what I > am doing wrong. You may need one more package: ### [dyoo@tesuque dyoo]$ rpm -qf /usr/lib/libtermcap.a libtermcap-devel-2.0.8-28 ### But this is on a Redhat 7.3 system though, so the package name might be slightly different on a Linux Mandrake system. If you install the 'libtermcap-devel' package, that should bring 'libtermcap.a' over to your system. Good luck to you! From glingl@aon.at Mon Aug 19 18:29:42 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 19 Aug 2002 19:29:42 +0200 Subject: [Tutor] re.sub References: <1029767125.3d60ffd52748b@wwwmail.urz.uni-heidelberg.de> Message-ID: <3D612B06.8060900@aon.at> This is a multi-part message in MIME format. --------------060905000305000409070301 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Nicole.Seitz@urz.uni-hd.de schrieb: >Hi there! > Today I got the following exception after inserting re.sub("ü","ü",text) > >somewhere in my program. > > >Python 2.2.1 (#34, Apr 9 2002, 19:34:33) [MSC 32 bit (Intel)] on win32 >... > File "C:\PROGRA~1\Tools\idle\IOBinding.py", line 154, in writefile > f.write(chars) >UnicodeError: ASCII encoding error: ordinal not in range(128) > >Can anybody tell my why there's a problem with the German umlaut? > > This is an ugly IDLE-"feature". IDLE uses (and allows) only characters with ASCII-code < 128 As the error-message says, Umlaute hav ASCII-codes not in this range: >>> map(ord,"äöüÄÖÜß") [228, 246, 252, 196, 214, 220, 223] >>> You may change this by informing IDLE/Python about your local environment. To this end put the attached file sitecustomize.py into the Lib-subdirectory of your Python-Directory (standard: C:\Python22\Lib). Restart IDLE and the problem will be disappeared. If there could arise other new problems because of changing the "locale" (see global module-Index, locale.py) I don't know. I didn't encounter any. Best wishes Gregor --------------060905000305000409070301 Content-Type: text/plain; name="sitecustomize.py" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sitecustomize.py" import sys, locale loc = locale.getdefaultlocale() if loc[1]: encoding = loc[1] if encoding != "ascii": sys.setdefaultencoding(encoding) --------------060905000305000409070301-- From aicolburn@yahoo.com Mon Aug 19 19:14:38 2002 From: aicolburn@yahoo.com (Alan Colburn) Date: Mon, 19 Aug 2002 11:14:38 -0700 Subject: [Tutor] Sorting Data Message-ID: <004801c247ac$4a08c170$cae68b86@fo5132> I have a quick, general question. Suppose I have a database of information--list, tuple, or dictionary--with each element (or value) being a list, i.e., a list of lists, a tuple or lists, or a dictionary of lists. Regardless, assume each of these data lists is ordered similarly. list1[0], list2[0], and list3[0] all represent, for example, a person's first name, and list1[1], list2[1], and list3[1] all represent a last name. What's a typical way to be able to sort the database by any list element? In the above example, I recognize I could sort by first name simply by using the .sort() command. (If the database was contained in a variable called MasterList, I could invoke MasterList.sort().) However, how would you sort by last name? And what if the lists making up the database had multiple entries (first name, last name, a date, text notes, etc.)? In most spreadsheet programs, a user can simply highlight a column and click an icon called "Sort" to accomplish the goal I'm asking about. Thank you, as always! -- Al p.s. I've asked a couple questions to the list during the last few weeks. Your responses have been very helpful! From espo89@msn.com Mon Aug 19 19:29:38 2002 From: espo89@msn.com (melvin terry) Date: Mon, 19 Aug 2002 14:29:38 -0400 Subject: [Tutor] this wont work Message-ID: ------=_NextPart_001_0000_01C2478C.D9719B90 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I am thinking of all kinds of things to show to my friends and I'm trying= to write a program that will say stuff about this guy we don't like here= it is but it wont work it always says here is an error on line 12. And o= y can I make it when people type in there pass it will come up in these = ****? print "Hi this is a secret place only those here are members may continue= " print "what is your password?" zozo =3D raw_input("enter your password: ") if zozo =3D=3D "gogo": print "------------------------------" print "welcome Michael" else: print "Try again!" if zozo =3D=3D "zozo": print "Welcome ryan what would you like to do?" boo =3D raw_input("type 1 for plans on messing up brandon.") if boo =3D=3D 1: print "we will break him up with gina" elif zozo =3D=3D "gogo": print "welcome Michael" else: print "Try again!"Get more from the Web. FREE MSN Explorer download = : http://explorer.msn.com ------=_NextPart_001_0000_01C2478C.D9719B90 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I am thinking = of all kinds of things to show to my friends and I'm trying to write a pr= ogram that will say stuff about this guy we don't like here it is but it = wont work it always says here is an error on line 12. And o y can I make = it when people type in there pass it will come up in these ****?
 
print "Hi this is a secret place only those here are= members may continue"
print "what is your password?"
zozo =3D raw_= input("enter your password: ")
if zozo =3D=3D "gogo":
  &= nbsp; print "------------------------------"
    print&= nbsp;       "welcome Michael"
else:
&= nbsp;   print "Try again!"
if zozo =3D=3D "zozo":
 &= nbsp;  print "Welcome ryan what would you like to do?"
 &nbs= p;  boo =3D raw_input("type 1 for plans on messing up brandon.")
=    if boo =3D=3D 1:
       pri= nt "we will break him up with gina"
elif zozo =3D=3D "gogo":
 =    print "welcome Michael"
else:
    print= "Try again!"




Get more= from the Web. FREE MSN Explorer download : http://explorer.msn.com

------=_NextPart_001_0000_01C2478C.D9719B90-- From randolph.s.robinson@btinternet.com Mon Aug 19 20:36:49 2002 From: randolph.s.robinson@btinternet.com (Stuart Robinson) Date: 19 Aug 2002 19:36:49 +0000 Subject: [Tutor] Pythoncard In-Reply-To: References: Message-ID: <1029785814.1300.58.camel@linux> Danny, I had both wx and pythoncard install under site-packages... which is why I did not understand how wx could work but not pythoncard??? I did also discover something unusual last night - I tried to run idle for the first time and it wouldn't run either (if I remember correctly it was another import error of some description). The only other things I can think of which might be significant was that I was running in usr/local/ rather than than usr/lib (the default location for python 2.2 in my distro [suse]) Anyway I bit the bullet and have abandoned the ActiveState install and completely reinstalled linux (a bit drastic I know, but hey, my soundcard now works so I'm happy!) I will stick with the 'normal' python install and try to get it all running again under usr/lib One other thing: I don't remember running setup.py for either wx or pythoncard.... I guess I'll find out now! I'll download everything again and see what makes or breaks ;-) Stu On Mon, 2002-08-19 at 07:49, Danny Yoo wrote: > Hmmm... strange! Let's get some more information. Can you tell us where > WX and PythonCardPrototype are installed? Absolute pathnames will help. > > Python actually uses the 'PYTHONPATH' environmental variable to find where > more Python modules are located. However, we don't usually need to touch > this if the modules have been installed with the standard distutils > 'setup.py'. Does anyone know if wxpython and PythonCard are > distutils-aware? > > > We'll probably need more details to figure out what's going on. We'll get > to the bottom of this. *grin* From ATrautman@perryjudds.com Mon Aug 19 19:46:09 2002 From: ATrautman@perryjudds.com (Alan Trautman) Date: Mon, 19 Aug 2002 13:46:09 -0500 Subject: [Tutor] this wont work Message-ID: <0BA95581EDA7D611841B00A0C9AD25DD2B581F@mail.pjinet.com> Melvin, Just a simple indentation error. Second level items need to be at the same level to function properly. It also really easy to get wrong as you cut and paste things. I am thinking of all kinds of things to show to my friends and I'm trying to write a program that will say stuff about this guy we don't like here it is but it wont work it always says here is an error on line 12. And o y can I make it when people type in there pass it will come up in these ****? print "Hi this is a secret place only those here are members may continue" print "what is your password?" zozo = raw_input("enter your password: ") if zozo == "gogo": print "------------------------------" print "welcome Michael" else: print "Try again!" if zozo == "zozo": print "Welcome ryan what would you like to do?" boo = raw_input("type 1 for plans on messing up brandon.") if boo == 1: ^Add a space in here the indentation is important in python >That should get it started again:) print "we will break him up with gina" elif zozo == "gogo": print "welcome Michael" else: print "Try again!" Peace Alan From espo89@msn.com Mon Aug 19 20:36:59 2002 From: espo89@msn.com (melvin terry) Date: Mon, 19 Aug 2002 15:36:59 -0400 Subject: [Tutor] dang this is hard Message-ID: ------=_NextPart_001_0002_01C24796.41EB2070 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable why wont this work? #welcome print "welcome ryan I just wanted you to have a second calculator!" print "here you can ahose from what you would like o ind the radius of...= " print "Type 1 for a rectangle" print "type 2 for a circle" if input =3D=3D 1: heigth =3D input("please type height here") width =3D input ("please type width here") area =3D height*width print "find area"Get more from the Web. FREE MSN Explorer download = : http://explorer.msn.com ------=_NextPart_001_0002_01C24796.41EB2070 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
why wont this = work?
 
#welcome
print "welcome ryan I just= wanted you to have a second calculator!"
print "here you can ahose fr= om what you would like o ind the radius of..."
print "Type 1 for a rec= tangle"
print "type 2 for a circle"
    if input =3D= =3D 1:
     heigth =3D input("please type height h= ere")
     width =3D input ("please type width her= e")
     area =3D height*width
  &nbs= p;  print "find area"


Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com

------=_NextPart_001_0002_01C24796.41EB2070-- From espo89@msn.com Mon Aug 19 20:46:26 2002 From: espo89@msn.com (melvin terry) Date: Mon, 19 Aug 2002 15:46:26 -0400 Subject: [Tutor] this is hard Message-ID: ------=_NextPart_001_0003_01C24797.93E7A1E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable why wont this work? When you type 1 noting happenes #welcome print "welcome ryan I just wanted you to have a second calculator!" print "here you can ahose from what you would like o ind the rarea of..." input =3D raw_input("type 1 for a rectangle") if input =3D=3D 1: =20 heigth =3D input("please type height here:") width =3D input ("please type width here:") area =3D height*width print "The area is" areaGet more from the Web. FREE MSN Explorer download : http://expl= orer.msn.com ------=_NextPart_001_0003_01C24797.93E7A1E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
why wont this = work? When you type 1 noting happenes
 
#welco= me
print "welcome ryan I just wanted you to have a second calculator!"=
print "here you can ahose from what you would like o ind the rarea of= ..."
input =3D raw_input("type 1 for a rectangle")
if input =3D=3D = 1:
   
     heigth =3D input("p= lease type height here:")
     width =3D input ("p= lease type width here:")
     area =3D height*widt= h
     print "The area is"
   &n= bsp; area


Get more from the We= b. FREE MSN Explorer download : http= ://explorer.msn.com

------=_NextPart_001_0003_01C24797.93E7A1E0-- From jeff@ccvcorp.com Mon Aug 19 20:48:45 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Mon, 19 Aug 2002 12:48:45 -0700 Subject: [Tutor] Sorting Data References: <004801c247ac$4a08c170$cae68b86@fo5132> Message-ID: <3D614B9D.E6E7B696@ccvcorp.com> Alan Colburn wrote: > What's a typical way to be able to sort the database by any list element? This depends to some degree on the size of the database. If you have anything more than a few hundred records, you should probably use some sort of dbms that's more reliable than simply lists or dictionaries. However, if your needs are small, lists will work fairly well. What you need to do to sort your list, is to create a *new* list. Each element of the new list will be a tuple of two values -- the first one is the contents of the column you want to sort on, the second one is the *entire* record (sublist) from the original list. You can then sort the new list, and lastly pull the records into *another* list in their new order. Some quick (untested) code, using list comprehensions: def SortByColumn(outerlist, column): temp = [ (record[column], record) for record in outerlist ] temp.sort() sortedlist = [record[1] for record in temp] return sortedlist This is sometimes known as the "decorate-sort-undecorate" pattern, because you're "decorating" the original list with the contents of the column that you want to sort on. Jeff Shannon Technician/Programmer Credit International From dyoo@hkn.eecs.berkeley.edu Mon Aug 19 20:55:24 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 19 Aug 2002 12:55:24 -0700 (PDT) Subject: [Tutor] this is hard In-Reply-To: Message-ID: On Mon, 19 Aug 2002, melvin terry wrote: > why wont this work? When you type 1 noting happenes > > #welcome > print "welcome ryan I just wanted you to have a second calculator!" > print "here you can ahose from what you would like o ind the rarea of..." > input = raw_input("type 1 for a rectangle") > if input == 1: > heigth = input("please type height here:") > width = input ("please type width here:") > area = height*width > print "The area is", area Hi Melvin, Can you explain why the program uses raw_input() here: > input = raw_input("type 1 for a rectangle") while, later on in the program, it uses the input() function? There's a difference between the two functions that's causing the bug in the program. Best of wishes! From rob@uselesspython.com Mon Aug 19 20:58:49 2002 From: rob@uselesspython.com (Rob) Date: Mon, 19 Aug 2002 14:58:49 -0500 Subject: [Tutor] this is hard In-Reply-To: Message-ID: #welcome print "welcome ryan I just wanted you to have a second calculator!" print "here you can ahose from what you would like o ind the rarea of..." input = raw_input("type 1 for a rectangle") if input == '1': height = raw_input("please type height here:") width = raw_input("please type width here:") area = int(height) * int(width) print "The area is" + str(area) I made a few minor changes, including correcting one spelling error ("heigth"). You can use raw_input() to get input from the user, and then specify what sort of data you want to translate the input into. For instance, you may want to use int (integer) or float (floating-point) for the math part, and I chose int here. Also, on the 5th line, I changed 1 to '1', because raw_input() grabs the user's input as a string, which uses quotes. Rob -----Original Message----- From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of melvin terry Sent: Monday, August 19, 2002 2:46 PM To: Pythontutor Subject: [Tutor] this is hard why wont this work? When you type 1 noting happenes #welcome print "welcome ryan I just wanted you to have a second calculator!" print "here you can ahose from what you would like o ind the rarea of..." input = raw_input("type 1 for a rectangle") if input == 1: heigth = input("please type height here:") width = input ("please type width here:") area = height*width print "The area is" area Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com From ATrautman@perryjudds.com Mon Aug 19 20:57:23 2002 From: ATrautman@perryjudds.com (Alan Trautman) Date: Mon, 19 Aug 2002 14:57:23 -0500 Subject: [Tutor] this is hard Message-ID: <0BA95581EDA7D611841B00A0C9AD25DD2B5820@mail.pjinet.com> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C247BA.A27AEF50 Content-Type: text/plain; charset="iso-8859-1" raw_input and many other Python functions return strings (i.e... alphanumeric items a,b,c) that must be thought of as text. This includes numbers that are not explicitly defined as numbers (int,float). Therefore you cannot compare the value 1.0 with the string value 1 and get the same thing. The function raw_input is returning a string which you are then comparing to a integer 1. if input ==1: These must be of the same type to compare. Either you must convert the integer to a string: if input =='1': or convert the value of input to an integer: if int(input) ==1: I do not recommend the second as many errors can be created unless you have perfect users and then you have to catch them all:) This also work for your prior posting. I recommend reading any good text including the Python website for information about types as without a basic understanding it is very hard to do anything. Peace [Alan Trautman] -----Original Message----- From: melvin terry [mailto:espo89@msn.com] Sent: Monday, August 19, 2002 2:46 PM To: Pythontutor Subject: [Tutor] this is hard why wont this work? When you type 1 noting happenes #welcome print "welcome ryan I just wanted you to have a second calculator!" print "here you can ahose from what you would like o ind the rarea of..." input = raw_input("type 1 for a rectangle") if input == 1: heigth = input("please type height here:") width = input ("please type width here:") area = height*width print "The area is" area _____ Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com ------_=_NextPart_001_01C247BA.A27AEF50 Content-Type: text/html; charset="iso-8859-1"
raw_input and many other Python functions return strings (i.e... alphanumeric items a,b,c) that must be thought of as text. This includes numbers that are not explicitly defined as numbers (int,float). Therefore you cannot compare the value 1.0 with the string value 1 and get the same thing. The function raw_input is returning a string which you are then comparing to a integer 1.
if input ==1:
 
These must be of the same type to compare. Either you must convert the integer to a string:
if input =='1':
 
or convert the value of input to an integer:
if int(input) ==1:
 
I do not recommend the second as many errors can be created unless you have perfect users and then you have to catch them all:) This also work for your prior posting.  I recommend reading any good text including the Python website for information about types as without a basic understanding it is very hard to do anything.
 
Peace

[Alan Trautman] 
 
 -----Original Message-----
From: melvin terry [mailto:espo89@msn.com]
Sent: Monday, August 19, 2002 2:46 PM
To: Pythontutor
Subject: [Tutor] this is hard

why wont this work? When you type 1 noting happenes
 
#welcome
print "welcome ryan I just wanted you to have a second calculator!"
print "here you can ahose from what you would like o ind the rarea of..."
input = raw_input("type 1 for a rectangle")
if input == 1:
   
     heigth = input("please type height here:")
     width = input ("please type width here:")
     area = height*width
     print "The area is"
     area


Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com

------_=_NextPart_001_01C247BA.A27AEF50-- From glingl@aon.at Mon Aug 19 21:15:54 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 19 Aug 2002 22:15:54 +0200 Subject: [Tutor] this is hard References: Message-ID: <3D6151FA.5070601@aon.at> Danny Yoo schrieb: >On Mon, 19 Aug 2002, melvin terry wrote: > > > >>why wont this work? When you type 1 noting happenes >> >>#welcome >>print "welcome ryan I just wanted you to have a second calculator!" >>print "here you can ahose from what you would like o ind the rarea of..." >>input = raw_input("type 1 for a rectangle") >>if input == 1: >> heigth = input("please type height here:") >> width = input ("please type width here:") >> area = height*width >> print "The area is", area >> >> > > >Hi Melvin, > > >Can you explain why the program uses raw_input() here: > > > >>input = raw_input("type 1 for a rectangle") >> >> > >while, later on in the program, it uses the input() function? > moreover, when you try to use the input-function in your program, you will not have a handle to it any more: When you start the Python-interpreter, input is already there: >>> input >>> input = raw_input("type 1 for a rectangle") type 1 for a rectangle1 >>> input '1' >>> '1'==1 0 As in Python 0 means false, you see, why the statements within the if - statement are not executed. But if they were ... >>> heigth = input("please type height here:") Traceback (most recent call last): File "", line 1, in ? heigth = input("please type height here:") TypeError: 'str' object is not callable >>> ... you would get this error. The 'str' object beeing the '1', which has now overwritten the original input. And als '1' is a string an not a function, it cannot be called: '1'("please type height here:") simply makes no sense, '1' is not callable. Remedy: if this disturbs you, never mind! Simply do never use names (as input) that already have some meaning (i. e. some object they refer to). Regards, Gregor > There's a >difference between the two functions that's causing the bug in the >program. > > > >Best of wishes! > > >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > > > > From scott_hamma@yahoo.com Mon Aug 19 21:23:21 2002 From: scott_hamma@yahoo.com (Hamma Scott) Date: Mon, 19 Aug 2002 13:23:21 -0700 (PDT) Subject: [Tutor] dang this is hard In-Reply-To: Message-ID: <20020819202321.8354.qmail@web12808.mail.yahoo.com> I worked with your code and found that the indentation was a little off and I set a variable for the first bit of information This is my result: #welcome print "welcome ryan I just wanted you to have a second calculator!" print "here you can ahose from what you would like o ind the radius of..." print "Type 1 for a rectangle" print "type 2 for a circle" inval = input("Enter 1 or 2:") if inval == 1: height = input("please type height here") width = input ("please type width here") area = height*width print "area = %s" % (area) Hope this helps --- melvin terry wrote: > why wont this work? > > #welcome > print "welcome ryan I just wanted you to have a > second calculator!" > print "here you can ahose from what you would like o > ind the radius of..." > print "Type 1 for a rectangle" > print "type 2 for a circle" > if input == 1: > heigth = input("please type height here") > width = input ("please type width here") > area = height*width > print "find area"Get more from the Web. FREE > MSN Explorer download : http://explorer.msn.com > __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com From glingl@aon.at Mon Aug 19 21:34:47 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 19 Aug 2002 22:34:47 +0200 Subject: [Tutor] Sorting Data References: <004801c247ac$4a08c170$cae68b86@fo5132> Message-ID: <3D615667.2030602@aon.at> Alan Colburn schrieb: >I have a quick, general question. Suppose I have a database of >information--list, tuple, or dictionary--with each element (or value) being >a list, i.e., a list of lists, a tuple or lists, or a dictionary of lists. >Regardless, assume each of these data lists is ordered similarly. list1[0], >list2[0], and list3[0] all represent, for example, a person's first name, >and list1[1], list2[1], and list3[1] all represent a last name. > >What's a typical way to be able to sort the database by any list element? In >the above example, I recognize I could sort by first name simply by using >the .sort() command. (If the database was contained in a variable called >MasterList, I could invoke MasterList.sort().) However, how would you sort >by last name? And what if the lists making up the database had multiple >entries (first name, last name, a date, text notes, etc.)? > >In most spreadsheet programs, a user can simply highlight a column and click >an icon called "Sort" to accomplish the goal I'm asking about. > >Thank you, as always! -- Al > >p.s. I've asked a couple questions to the list during the last few weeks. >Your responses have been very helpful! > > >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > > > > Another way to accomplish this is to provide your own comparison-function as an argument to sort: >>> list = [[1,8],[2,7],[3,6],[0,9]] >>> l = list[:] >>> l.sort() >>> l [[0, 9], [1, 8], [2, 7], [3, 6]] >>> def mycomp(l1,l2): a,b=l1[1],l2[1] if a>> l = list[:] >>> l.sort(mycomp) >>> l [[3, 6], [2, 7], [1, 8], [0, 9]] >>> See for instance: http://www.python.org/doc/current/lib/typesseq-mutable.html Regards, Gregor From aicolburn@yahoo.com Mon Aug 19 21:36:51 2002 From: aicolburn@yahoo.com (Alan Colburn) Date: Mon, 19 Aug 2002 13:36:51 -0700 Subject: [Tutor] Re: Tutor digest, Vol 1 #1859 - 14 msgs References: <20020819200003.9051.59264.Mailman@mail.python.org> Message-ID: <001301c247c0$25fe4930$cae68b86@fo5132> Thanks, Jeff. I understand your explanation; it makes perfect sense to me. Crystal clear. My database(s) are small enough that this will be fine. I'll save dbms (database management system?) for after I retire :-) Thanks again -- Al ----- Original Message ----- From: To: Sent: Monday, August 19, 2002 1:00 PM Subject: Tutor digest, Vol 1 #1859 - 14 msgs > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body 'help' to > tutor-request@python.org > > You can reach the person managing the list at > tutor-admin@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Tutor digest..." > > > Today's Topics: > > 1. RE: Re: HELP (alan.gauld@bt.com) > 2. RE: hi (alan.gauld@bt.com) > 3. building the readline module (Prahlad Vaidyanathan) > 4. Re: building the readline module (Danny Yoo) > 5. Re: re.sub (Gregor Lingl) > 6. Sorting Data (Alan Colburn) > 7. this wont work (melvin terry) > 8. Re: Pythoncard (Stuart Robinson) > 9. RE: this wont work (Alan Trautman) > 10. dang this is hard (melvin terry) > 11. this is hard (melvin terry) > 12. Re: Sorting Data (Jeff Shannon) > 13. Re: this is hard (Danny Yoo) > 14. RE: this is hard (Rob) > > --__--__-- > > Message: 1 > From: alan.gauld@bt.com > To: espo89@msn.com, tutor@python.org > Subject: RE: [Tutor] Re: HELP > Date: Mon, 19 Aug 2002 17:28:31 +0100 > > > I got this working but how do I get it say say > > chose 1 for michael or type 2 for ryan? > > > print "Hi my name is michael and this is the subertrip program" > > print "-------------------------------------------------------" > > print "please pick a name" > > print "1. Michael" > print "2. Ryan" > > > name =3D int(raw_input("enter 1 for michael: ")) > > name =3D int(raw_input("Pick a number(1/2) ")) > if name =3D=3D 1: > print "michael is so cool" > elif: name =3D=3D 2: > print "He is cool but not as cool as MIchael?" > > The next step is to handle invalid input. Try searching > the archives for this group at active state for "menu" > and "error" etc. > > Its all been covered in the last couple of weeks... > > Alan g. > > > --__--__-- > > Message: 2 > From: alan.gauld@bt.com > To: espo89@msn.com, tutor@python.org > Subject: RE: [Tutor] hi > Date: Mon, 19 Aug 2002 17:33:08 +0100 > > > why is this not working? > > Because you are getting your types all miuxed up. > You need to go back and read about the difference > between integers(numbers) and strings(characters) > > It looks like you might be reading Josh's tutor and > I'm sure he covers it somewhere, but alternatively > jump into mine at the topic called "Raw Materials" > and read the first half. Without understanding that > difference you will get into lots of difficulties. > > pass =3D int(raw_input("enter your password: ")) > > You are converting the password into a number > - which doesn't make sense. > > if pass =3D=3D idontknow: > > You are testing the password against a variable which > isn't created yet, I think you should be using a string > (ie surrounded by quotes) > > print "Welcome ryan" > if pass =3D=3D wizard: > print "welcome Michael" > > The second of is indented too far, you need to pull it > back to align with the first if... > > Alan g. > Author of the 'Learning to Program' web site > http://www.freenetpages.co.uk/hp/alan.gauld > > > --__--__-- > > Message: 3 > Date: Mon, 19 Aug 2002 22:11:21 +0530 > From: Prahlad Vaidyanathan > To: Python Tutor ML > Subject: [Tutor] building the readline module > > Hi, > > I've been trying to build Python 2.2 with the readline > module, in order to enable tab-completion, and other such nifty > stuff in the interactive session, but I have so far been > unsuccessful. > > I rummaged through the docs, and then did this. > > - ran the configure script (without arguments) > - edited Modules/Setup, and uncommented the "readline" line > - ran "make" > > But, make dies, saying that the linker (GNU ld) cannot find > "-ltermcap". So, I looked for a libtermcap.a file, and, surely > enough, it wasn't there. > > So, I pulled out my Mandrake 8.0 CD, and decided to install > the relevant RPMS.viz. > > - readline > - readline-devel > - libtermcap2 > > But still, I can't seem to find the libtermcap.a file, and, > as expected, "make" barfs at the same place. I don't know which > package I should install, which has libtermcap.a (assuming that > is where the problem lies), so I decided to ask here, and see if > anyone knew what I am doing wrong. > > Do let me know. Thanks. > > pv. > > -- > Prahlad Vaidyanathan > > Why you say you no bunny rabbit when you have little powder-puff tail? > -- The Tasmanian Devil > > > --__--__-- > > Message: 4 > Date: Mon, 19 Aug 2002 10:16:36 -0700 (PDT) > From: Danny Yoo > To: Prahlad Vaidyanathan > cc: Python Tutor ML > Subject: Re: [Tutor] building the readline module > > > > On Mon, 19 Aug 2002, Prahlad Vaidyanathan wrote: > > > I've been trying to build Python 2.2 with the readline module, in > > order to enable tab-completion, and other such nifty stuff in the > > interactive session, but I have so far been unsuccessful. > > > > I rummaged through the docs, and then did this. > > > > - ran the configure script (without arguments) > > - edited Modules/Setup, and uncommented the "readline" line > > Actually, you shouldn't need to do the uncommenting anymore in > 'Modules/Setup'. Recent versions of Python will, in most cases, > autodetect modules for you when Python is being compiled. > > > > But, make dies, saying that the linker (GNU ld) cannot find > > "-ltermcap". So, I looked for a libtermcap.a file, and, surely enough= , > > it wasn't there. > > > > So, I pulled out my Mandrake 8.0 CD, and decided to install the > > relevant RPMS.viz. > > > > - readline > > - readline-devel > > - libtermcap2 > > > > But still, I can't seem to find the libtermcap.a file, and, as > > expected, "make" barfs at the same place. I don't know which package = I > > should install, which has libtermcap.a (assuming that is where the > > problem lies), so I decided to ask here, and see if anyone knew what = I > > am doing wrong. > > > You may need one more package: > > ### > [dyoo@tesuque dyoo]$ rpm -qf /usr/lib/libtermcap.a > libtermcap-devel-2.0.8-28 > ### > > But this is on a Redhat 7.3 system though, so the package name might be > slightly different on a Linux Mandrake system. If you install the > 'libtermcap-devel' package, that should bring 'libtermcap.a' over to yo= ur > system. > > > Good luck to you! > > > > --__--__-- > > Message: 5 > Date: Mon, 19 Aug 2002 19:29:42 +0200 > From: Gregor Lingl > To: Nicole.Seitz@urz.uni-hd.de > CC: tutor@python.org > Subject: Re: [Tutor] re.sub > > This is a multi-part message in MIME format. > --------------060905000305000409070301 > Content-Type: text/plain; charset=3DISO-8859-1; format=3Dflowed > Content-Transfer-Encoding: 8bit > > Nicole.Seitz@urz.uni-hd.de schrieb: > > >Hi there! > > Today I got the following exception after inserting re.sub("ü","=FC",text) > > > >somewhere in my program. > > > > > >Python 2.2.1 (#34, Apr 9 2002, 19:34:33) [MSC 32 bit (Intel)] on win3= 2 > >... > > File "C:\PROGRA~1\Tools\idle\IOBinding.py", line 154, in writefile > > f.write(chars) > >UnicodeError: ASCII encoding error: ordinal not in range(128) > > > >Can anybody tell my why there's a problem with the German umlaut? > > > > > This is an ugly IDLE-"feature". IDLE uses (and allows) only characters > with ASCII-code < 128 > As the error-message says, Umlaute hav ASCII-codes not in this range: > > >>> map(ord,"=E4=F6=FC=C4=D6=DC=DF") > [228, 246, 252, 196, 214, 220, 223] > >>> > > You may change this by informing IDLE/Python about your local environme= nt. > To this end put the attached file > > sitecustomize.py > > into the Lib-subdirectory of your Python-Directory (standard: > C:\Python22\Lib). > Restart IDLE and the problem will be disappeared. > > If there could arise other new problems because of changing the "local= e" > (see global module-Index, locale.py) I don't know. I didn't encounter any. > > Best wishes > Gregor > > --------------060905000305000409070301 > Content-Type: text/plain; > name=3D"sitecustomize.py" > Content-Transfer-Encoding: 7bit > Content-Disposition: inline; > filename=3D"sitecustomize.py" > > import sys, locale > loc =3D locale.getdefaultlocale() > if loc[1]: > encoding =3D loc[1] > if encoding !=3D "ascii": > sys.setdefaultencoding(encoding) > --------------060905000305000409070301-- > > > > > --__--__-- > > Message: 6 > From: "Alan Colburn" > To: "Python Tutor List" > Date: Mon, 19 Aug 2002 11:14:38 -0700 > Subject: [Tutor] Sorting Data > > I have a quick, general question. Suppose I have a database of > information--list, tuple, or dictionary--with each element (or value) being > a list, i.e., a list of lists, a tuple or lists, or a dictionary of lis= ts. > Regardless, assume each of these data lists is ordered similarly. list1[0], > list2[0], and list3[0] all represent, for example, a person's first nam= e, > and list1[1], list2[1], and list3[1] all represent a last name. > > What's a typical way to be able to sort the database by any list elemen= t? In > the above example, I recognize I could sort by first name simply by usi= ng > the .sort() command. (If the database was contained in a variable calle= d > MasterList, I could invoke MasterList.sort().) However, how would you s= ort > by last name? And what if the lists making up the database had multiple > entries (first name, last name, a date, text notes, etc.)? > > In most spreadsheet programs, a user can simply highlight a column and click > an icon called "Sort" to accomplish the goal I'm asking about. > > Thank you, as always! -- Al > > p.s. I've asked a couple questions to the list during the last few week= s. > Your responses have been very helpful! > > > > --__--__-- > > Message: 7 > From: "melvin terry" > To: "Pythontutor" > Date: Mon, 19 Aug 2002 14:29:38 -0400 > Subject: [Tutor] this wont work > > > ------=3D_NextPart_001_0000_01C2478C.D9719B90 > Content-Type: text/plain; charset=3D"iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > I am thinking of all kinds of things to show to my friends and I'm tryi= ng=3D > to write a program that will say stuff about this guy we don't like he= re=3D > it is but it wont work it always says here is an error on line 12. And= o=3D > y can I make it when people type in there pass it will come up in thes= e =3D > ****? > > print "Hi this is a secret place only those here are members may contin= ue=3D > " > print "what is your password?" > zozo =3D3D raw_input("enter your password: ") > if zozo =3D3D=3D3D "gogo": > print "------------------------------" > print "welcome Michael" > else: > print "Try again!" > if zozo =3D3D=3D3D "zozo": > print "Welcome ryan what would you like to do?" > boo =3D3D raw_input("type 1 for plans on messing up brandon.") > if boo =3D3D=3D3D 1: > print "we will break him up with gina" > elif zozo =3D3D=3D3D "gogo": > print "welcome Michael" > else: > print "Try again!"Get more from the Web. FREE MSN Explorer downloa= d =3D > : http://explorer.msn.com > > ------=3D_NextPart_001_0000_01C2478C.D9719B90 > Content-Type: text/html; charset=3D"iso-8859-1" > Content-Transfer-Encoding: quoted-printable > >
I am think= ing =3D > of all kinds of things to show to my friends and I'm trying to write a = pr=3D > ogram that will say stuff about this guy we don't like here it is but i= t =3D > wont work it always says here is an error on line 12. And o y can I mak= e =3D > it when people type in there pass it will come up in these ****?
= IV> 
print "Hi this is a secret place only those here a= re=3D > members may continue"
print "what is your password?"
zozo =3D3D = raw_=3D > input("enter your password: ")
if zozo =3D3D=3D3D "gogo":
 &= nbsp;&=3D > nbsp; print "------------------------------"
    prin= t&=3D > nbsp;       "welcome Michael"
else:&=3D > nbsp;   print "Try again!"
if zozo =3D3D=3D3D "zozo":
&= nbsp;&=3D > nbsp;  print "Welcome ryan what would you like to do?"
 &n= bs=3D > p;  boo =3D3D raw_input("type 1 for plans on messing up brandon.")=
=3D >    if boo =3D3D=3D3D 1:
     &nbs= p; pri=3D > nt "we will break him up with gina"
elif zozo =3D3D=3D3D "gogo":
=  =3D >    print "welcome Michael"
else:
    pri= nt=3D > "Try again!"




Get = more=3D > from the Web. FREE MSN Explorer download : sn.com'>http://explorer.msn.com

> > ------=3D_NextPart_001_0000_01C2478C.D9719B90-- > > > --__--__-- > > Message: 8 > Subject: Re: [Tutor] Pythoncard > From: Stuart Robinson > To: Danny Yoo > Cc: tutor@python.org > Date: 19 Aug 2002 19:36:49 +0000 > > Danny, > > I had both wx and pythoncard install under site-packages... which is wh= y > I did not understand how wx could work but not pythoncard??? I did also > discover something unusual last night - I tried to run idle for the > first time and it wouldn't run either (if I remember correctly it was > another import error of some description). > > The only other things I can think of which might be significant was tha= t > I was running in usr/local/ rather than than usr/lib (the default > location for python 2.2 in my distro [suse]) > > Anyway I bit the bullet and have abandoned the ActiveState install and > completely reinstalled linux (a bit drastic I know, but hey, my > soundcard now works so I'm happy!) I will stick with the 'normal' pytho= n > install and try to get it all running again under usr/lib > > One other thing: I don't remember running setup.py for either wx or > pythoncard.... I guess I'll find out now! I'll download everything agai= n > and see what makes or breaks ;-) > > Stu > > > On Mon, 2002-08-19 at 07:49, Danny Yoo wrote: > > Hmmm... strange! Let's get some more information. Can you tell us where > > WX and PythonCardPrototype are installed? Absolute pathnames will he= lp. > > > > Python actually uses the 'PYTHONPATH' environmental variable to find where > > more Python modules are located. However, we don't usually need to touch > > this if the modules have been installed with the standard distutils > > 'setup.py'. Does anyone know if wxpython and PythonCard are > > distutils-aware? > > > > > > We'll probably need more details to figure out what's going on. We'l= l get > > to the bottom of this. *grin* > > > > > --__--__-- > > Message: 9 > From: Alan Trautman > To: "'tutor@python.org'" > Subject: RE: [Tutor] this wont work > Date: Mon, 19 Aug 2002 13:46:09 -0500 > > Melvin, > > Just a simple indentation error. Second level items need to be at the s= ame > level to function properly. It also really easy to get wrong as you cut and > paste things. > > > > I am thinking of all kinds of things to show to my friends and I'm tryi= ng to > write a program that will say stuff about this guy we don't like here i= t is > but it wont work it always says here is an error on line 12. And o y ca= n I > make it when people type in there pass it will come up in these ****? > > print "Hi this is a secret place only those here are members may contin= ue" > print "what is your password?" > zozo =3D raw_input("enter your password: ") > if zozo =3D=3D "gogo": > print "------------------------------" > print "welcome Michael" > else: > print "Try again!" > if zozo =3D=3D "zozo": > print "Welcome ryan what would you like to do?" > boo =3D raw_input("type 1 for plans on messing up brandon.") > if boo =3D=3D 1: > ^Add a space in here the indentation is important in python > >That should get it started again:) > > > > print "we will break him up with gina" > elif zozo =3D=3D "gogo": > print "welcome Michael" > else: > print "Try again!" > > > > > Peace > Alan > > > --__--__-- > > Message: 10 > From: "melvin terry" > To: "Pythontutor" > Date: Mon, 19 Aug 2002 15:36:59 -0400 > Subject: [Tutor] dang this is hard > > > ------=3D_NextPart_001_0002_01C24796.41EB2070 > Content-Type: text/plain; charset=3D"iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > why wont this work? > > #welcome > print "welcome ryan I just wanted you to have a second calculator!" > print "here you can ahose from what you would like o ind the radius of.= ..=3D > " > print "Type 1 for a rectangle" > print "type 2 for a circle" > if input =3D3D=3D3D 1: > heigth =3D3D input("please type height here") > width =3D3D input ("please type width here") > area =3D3D height*width > print "find area"Get more from the Web. FREE MSN Explorer downloa= d =3D > : http://explorer.msn.com > > ------=3D_NextPart_001_0002_01C24796.41EB2070 > Content-Type: text/html; charset=3D"iso-8859-1" > Content-Transfer-Encoding: quoted-printable > >
why wont t= his =3D > work?
 
#welcome
print "welcome ryan I ju= st=3D > wanted you to have a second calculator!"
print "here you can ahose = fr=3D > om what you would like o ind the radius of..."
print "Type 1 for a r= ec=3D > tangle"
print "type 2 for a circle"
    if input =3D= 3D=3D > =3D3D 1:
     heigth =3D3D input("please type he= ight h=3D > ere")
     width =3D3D input ("please type width= her=3D > e")
     area =3D3D height*width
  = &nbs=3D > p;  print "find area"


>Get more from the Web. FREE MSN Explorer download : xplorer.msn.com'>http://explorer.msn.com

> > ------=3D_NextPart_001_0002_01C24796.41EB2070-- > > > --__--__-- > > Message: 11 > From: "melvin terry" > To: "Pythontutor" > Date: Mon, 19 Aug 2002 15:46:26 -0400 > Subject: [Tutor] this is hard > > > ------=3D_NextPart_001_0003_01C24797.93E7A1E0 > Content-Type: text/plain; charset=3D"iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > why wont this work? When you type 1 noting happenes > > #welcome > print "welcome ryan I just wanted you to have a second calculator!" > print "here you can ahose from what you would like o ind the rarea of..= ." > input =3D3D raw_input("type 1 for a rectangle") > if input =3D3D=3D3D 1: > =3D20 > heigth =3D3D input("please type height here:") > width =3D3D input ("please type width here:") > area =3D3D height*width > print "The area is" > areaGet more from the Web. FREE MSN Explorer download : http://ex= pl=3D > orer.msn.com > > ------=3D_NextPart_001_0003_01C24797.93E7A1E0 > Content-Type: text/html; charset=3D"iso-8859-1" > Content-Transfer-Encoding: quoted-printable > >
why wont t= his =3D > work? When you type 1 noting happenes
 
#wel= co=3D > me
print "welcome ryan I just wanted you to have a second calculator= !"=3D >
print "here you can ahose from what you would like o ind the rarea = of=3D > .."
input =3D3D raw_input("type 1 for a rectangle")
if input =3D3= D=3D3D =3D > 1:
   
     heigth =3D3D inpu= t("p=3D > lease type height here:")
     width =3D3D input= ("p=3D > lease type width here:")
     area =3D3D height*= widt=3D > h
     print "The area is"
   = &n=3D > bsp; area


Get more from th= e We=3D > b. FREE MSN Explorer download : = http=3D > ://explorer.msn.com

> > ------=3D_NextPart_001_0003_01C24797.93E7A1E0-- > > > --__--__-- > > Message: 12 > Date: Mon, 19 Aug 2002 12:48:45 -0700 > From: "Jeff Shannon" > To: Alan Colburn > CC: Python Tutor List > Subject: Re: [Tutor] Sorting Data > > > Alan Colburn wrote: > > > What's a typical way to be able to sort the database by any list element? > > This depends to some degree on the size of the database. If you have anything > more than a few hundred records, you should probably use some sort of d= bms > that's more reliable than simply lists or dictionaries. However, if yo= ur needs > are small, lists will work fairly well. > > What you need to do to sort your list, is to create a *new* list. Each element > of the new list will be a tuple of two values -- the first one is the contents > of the column you want to sort on, the second one is the *entire* recor= d > (sublist) from the original list. You can then sort the new list, and lastly > pull the records into *another* list in their new order. > > Some quick (untested) code, using list comprehensions: > > def SortByColumn(outerlist, column): > temp =3D [ (record[column], record) for record in outerlist ] > temp.sort() > sortedlist =3D [record[1] for record in temp] > return sortedlist > > This is sometimes known as the "decorate-sort-undecorate" pattern, beca= use > you're "decorating" the original list with the contents of the column t= hat you > want to sort on. > > Jeff Shannon > Technician/Programmer > Credit International > > > > > > > --__--__-- > > Message: 13 > Date: Mon, 19 Aug 2002 12:55:24 -0700 (PDT) > From: Danny Yoo > To: melvin terry > cc: Pythontutor > Subject: Re: [Tutor] this is hard > > > > On Mon, 19 Aug 2002, melvin terry wrote: > > > why wont this work? When you type 1 noting happenes > > > > #welcome > > print "welcome ryan I just wanted you to have a second calculator!" > > print "here you can ahose from what you would like o ind the rarea of..." > > input =3D raw_input("type 1 for a rectangle") > > if input =3D=3D 1: > > heigth =3D input("please type height here:") > > width =3D input ("please type width here:") > > area =3D height*width > > print "The area is", area > > > Hi Melvin, > > > Can you explain why the program uses raw_input() here: > > > input =3D raw_input("type 1 for a rectangle") > > while, later on in the program, it uses the input() function? There's = a > difference between the two functions that's causing the bug in the > program. > > > > Best of wishes! > > > > --__--__-- > > Message: 14 > From: "Rob" > To: "Python Tutor" > Subject: RE: [Tutor] this is hard > Date: Mon, 19 Aug 2002 14:58:49 -0500 > > #welcome > print "welcome ryan I just wanted you to have a second calculator!" > print "here you can ahose from what you would like o ind the rarea of..= ." > input =3D raw_input("type 1 for a rectangle") > if input =3D=3D '1': > > height =3D raw_input("please type height here:") > width =3D raw_input("please type width here:") > area =3D int(height) * int(width) > print "The area is" + str(area) > > I made a few minor changes, including correcting one spelling error > ("heigth"). > > You can use raw_input() to get input from the user, and then specify wh= at > sort of data you want to translate the input into. For instance, you ma= y > want to use int (integer) or float (floating-point) for the math part, = and I > chose int here. > > Also, on the 5th line, I changed 1 to '1', because raw_input() grabs th= e > user's input as a string, which uses quotes. > > Rob > > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf O= f > melvin terry > Sent: Monday, August 19, 2002 2:46 PM > To: Pythontutor > Subject: [Tutor] this is hard > > > why wont this work? When you type 1 noting happenes > > #welcome > print "welcome ryan I just wanted you to have a second calculator!" > print "here you can ahose from what you would like o ind the rarea of..= ." > input =3D raw_input("type 1 for a rectangle") > if input =3D=3D 1: > > heigth =3D input("please type height here:") > width =3D input ("please type width here:") > area =3D height*width > print "The area is" > area > > > > > Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com > > > > > > --__--__-- > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > > End of Tutor Digest From espo89@msn.com Mon Aug 19 21:55:14 2002 From: espo89@msn.com (melvin terry) Date: Mon, 19 Aug 2002 16:55:14 -0400 Subject: [Tutor] hi Message-ID: ------=_NextPart_001_0004_01C247A1.301B08A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable why won't this work? it comes up with the error Traceback (most recent call last): File "C:/Python22/B", line 3, in ? hate =3D input_raw("Enter C if you wish to continue:") NameError: name 'input_raw' is not defined #welcome print "Hi we all hate brandon" hate =3D input_raw("Enter C if you wish to continue:") if hate =3D=3D c: print "Thank you for hating brandon!"Get more from the Web. FREE MSN = Explorer download : http://explorer.msn.com ------=_NextPart_001_0004_01C247A1.301B08A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
why won't this= work? it comes up with the error
 

Traceb= ack (most recent call last):
  File "C:/Python22/B", line 3, in ?=
    hate =3D input_raw("Enter C if you wish to continu= e:")
NameError: name 'input_raw' is not defined
 
 
#welcome
print "Hi we all hate brandon"
ha= te =3D input_raw("Enter C if you wish to continue:")
if hate =3D=3D c:=
   print "Thank you for hating brandon!"

 


Get more from the Web. FR= EE MSN Explorer download : http://exp= lorer.msn.com

------=_NextPart_001_0004_01C247A1.301B08A0-- From tombraider500@yahoo.co.uk Mon Aug 19 21:59:50 2002 From: tombraider500@yahoo.co.uk (Richard Gelling) Date: Mon, 19 Aug 2002 21:59:50 +0100 Subject: [Tutor] re hi Message-ID: <200208192159.50607.tombraider500@yahoo.co.uk> shouldn't 'input_raw' be raw_input? --=20 Registered Linux User: 256848 __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com From glingl@aon.at Mon Aug 19 22:02:46 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 19 Aug 2002 23:02:46 +0200 Subject: [Tutor] hi References: Message-ID: <3D615CF6.6090805@aon.at> melvin terry schrieb: > why won't this work? it comes up with the error > > > Traceback (most recent call last): > File "C:/Python22/B", line 3, in ? > hate = input_raw("Enter C if you wish to continue:") > NameError: name 'input_raw' is not defined > > > #welcome > print "Hi we all hate brandon" > hate = input_raw("Enter C if you wish to continue:") What do you mean with input_raw? Where did you read about input_raw? gl > > if hate == c: > print "Thank you for hating brandon!" > > > > > ------------------------------------------------------------------------ > Get more from the Web. FREE MSN Explorer download : > http://explorer.msn.com From rob@uselesspython.com Mon Aug 19 22:15:06 2002 From: rob@uselesspython.com (Rob) Date: Mon, 19 Aug 2002 16:15:06 -0500 Subject: [Tutor] hi In-Reply-To: Message-ID: > if hate == c: > print "Thank you for hating brandon!" Aww, but Brandon is such a lovely town. Why would anyone actually hate the place? hehe, Rob From kb@kb2.net Mon Aug 19 22:14:59 2002 From: kb@kb2.net (Kyle Babich) Date: Mon, 19 Aug 2002 21:14:59 UT Subject: [Tutor] hi Message-ID: <20020819211459.30B6F93779@server2.fastmail.fm> On Mon, 19 Aug 2002 23:02:46 +0200, "Gregor Lingl" said: > melvin terry schrieb: >=20 > > why won't this work? it comes up with the error > > =20 > > > > Traceback (most recent call last): > > File "C:/Python22/B", line 3, in ? > > hate =3D input_raw("Enter C if you wish to continue:") ^^^^^^^^^^ is where it is ... and it should be raw_input From gus.tabares@verizon.net Mon Aug 19 22:34:20 2002 From: gus.tabares@verizon.net (Gus Tabares) Date: Mon, 19 Aug 2002 17:34:20 -0400 Subject: [Tutor] write to a file Message-ID: Hello, I'm trying write something to a file but I keep on getting this error: Traceback (most recent call last): File "test.py", line 9, in ? os.open("C:\blah.txt", 'w') TypeError: an integer is required I don't see what an integer has to do with anything? Thanks in advance... Gus From python Fri Aug 16 22:45:07 2002 From: python (python) Date: Fri, 16 Aug 2002 14:45:07 -0700 Subject: [Tutor] write to a file In-Reply-To: References: Message-ID: <157394445439.20020816144507@inkedmn.net> it goes something like this: file = file('C:\filename.txt', 'w') x = 'hello, sir' file.write(x) that will write the string x to the file filename.txt best of luck, brett GT> Hello, GT> I'm trying write something to a file but I keep on getting this error: GT> Traceback (most recent call last): GT> File "test.py", line 9, in ? GT> os.open("C:\blah.txt", 'w') GT> TypeError: an integer is required GT> I don't see what an integer has to do with anything? Thanks in advance... GT> Gus GT> _______________________________________________ GT> Tutor maillist - Tutor@python.org GT> http://mail.python.org/mailman/listinfo/tutor From glingl@aon.at Mon Aug 19 22:42:39 2002 From: glingl@aon.at (Gregor Lingl) Date: Mon, 19 Aug 2002 23:42:39 +0200 Subject: [Tutor] write to a file References: Message-ID: <3D61664F.1010606@aon.at> Gus Tabares schrieb: >Hello, > > I'm trying write something to a file but I keep on getting this error: > >Traceback (most recent call last): > File "test.py", line 9, in ? > os.open("C:\blah.txt", 'w') >TypeError: an integer is required > > I don't see what an integer has to do with anything? Thanks in advance... > > imo this comes from using the open function from module os. In the docs about this one reads: open(file, flags[, mode]) Open the file file and set various flags according to flags and possibly its mode according to mode. The default mode is 0777 (octal), and the current umask value is first masked out. Return the file descriptor for the newly opened file. Availability: Macintosh, Unix, Windows. For a description of the flag and mode values, see the C run-time documentation; flag constants (like O_RDONLY and O_WRONLY) are defined in this module too (see below). Note: this function is intended for low-level I/O. For normal usage, use the built-in function open(), which returns a ``file object'' with read() and write() methods (and many more). You certainly wanted to use the builtin function open(): For this see: http://www.python.org/doc/current/lib/built-in-funcs.html gl > > From rickp@telocity.com Mon Aug 19 22:44:36 2002 From: rickp@telocity.com (Rick Pasotto) Date: Mon, 19 Aug 2002 17:44:36 -0400 Subject: [Tutor] write to a file In-Reply-To: References: Message-ID: <20020819214436.GA8720@tc.niof.net> On Mon, Aug 19, 2002 at 05:34:20PM -0400, Gus Tabares wrote: > Hello, > > I'm trying write something to a file but I keep on getting this error: > > Traceback (most recent call last): > File "test.py", line 9, in ? > os.open("C:\blah.txt", 'w') > TypeError: an integer is required > > I don't see what an integer has to do with anything? Thanks in advance... Forget the 'os.' just use open("C:blah.txt",'w'). os.open() returns a file *descriptor* and is different from the builtin open() which returns a file *object* and takes different parameters. -- "Happiness is the interval between periods of unhappiness." -- Don Marquis Rick Pasotto rickp@telocity.com http://www.niof.net From kb@kb2.net Mon Aug 19 22:47:40 2002 From: kb@kb2.net (Kyle Babich) Date: Mon, 19 Aug 2002 21:47:40 UT Subject: [Tutor] write to a file Message-ID: <20020819214740.E420793789@server2.fastmail.fm> On Mon, 19 Aug 2002 17:34:20 -0400, "Gus Tabares" said: > Hello, > =09 > I'm trying write something to a file but I keep on getting this error: >=20 > Traceback (most recent call last): > File "test.py", line 9, in ? > os.open("C:\blah.txt", 'w') > TypeError: an integer is required You probably want: open("c:\blah.txt", "w") Because os.open does require and integer. If I remember right I think it goes something like: os.open("c:\blah.txt", 0777) >=20 > I don't see what an integer has to do with anything? Thanks in advance= ... >=20 >=20 > Gus >=20 > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor >=20 -- Kyle From python Mon Aug 19 22:55:17 2002 From: python (python) Date: Mon, 19 Aug 2002 14:55:17 -0700 Subject: Re[2]: [Tutor] write to a file In-Reply-To: <20020819214436.GA8720@tc.niof.net> References: <20020819214436.GA8720@tc.niof.net> Message-ID: <188395056648.20020819145517@inkedmn.net> Just FYI, in python 2.2, the "open" method for opening a file has been replaced with "file", like this: openfile = file("c:\somefile.htm", 'w') brett RP> On Mon, Aug 19, 2002 at 05:34:20PM -0400, Gus Tabares wrote: >> Hello, >> >> I'm trying write something to a file but I keep on getting this error: >> >> Traceback (most recent call last): >> File "test.py", line 9, in ? >> os.open("C:\blah.txt", 'w') >> TypeError: an integer is required >> >> I don't see what an integer has to do with anything? Thanks in advance... RP> Forget the 'os.' just use open("C:blah.txt",'w'). RP> os.open() returns a file *descriptor* and is different from the builtin RP> open() which returns a file *object* and takes different parameters. From gus.tabares@verizon.net Mon Aug 19 23:10:10 2002 From: gus.tabares@verizon.net (Gus Tabares) Date: Mon, 19 Aug 2002 18:10:10 -0400 Subject: [Tutor] write to a file In-Reply-To: <157394445439.20020816144507@inkedmn.net> Message-ID: Thanks to all who responded, it was more than I was expecting;) Gus -----Original Message----- From: python [mailto:python@inkedmn.net] Sent: Friday, August 16, 2002 5:45 PM To: Gus Tabares Cc: tutor@python.org Subject: Re: [Tutor] write to a file it goes something like this: file = file('C:\filename.txt', 'w') x = 'hello, sir' file.write(x) that will write the string x to the file filename.txt best of luck, brett GT> Hello, GT> I'm trying write something to a file but I keep on getting this error: GT> Traceback (most recent call last): GT> File "test.py", line 9, in ? GT> os.open("C:\blah.txt", 'w') GT> TypeError: an integer is required GT> I don't see what an integer has to do with anything? Thanks in advance... GT> Gus GT> _______________________________________________ GT> Tutor maillist - Tutor@python.org GT> http://mail.python.org/mailman/listinfo/tutor From espo89@msn.com Mon Aug 19 23:17:18 2002 From: espo89@msn.com (melvin terry) Date: Mon, 19 Aug 2002 18:17:18 -0400 Subject: [Tutor] why not? Message-ID: ------=_NextPart_001_0005_01C247AC.A74EEDF0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable why won't this work? print "michael" name =3D raw_input ("what is your name?" ) if name =3D=3D Michael: print "your cool" elif name =3D=3D ryan: print "your not cool"Get more from the Web. FREE MSN Explorer downloa= d : http://explorer.msn.com ------=_NextPart_001_0005_01C247AC.A74EEDF0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
why won't this= work?
 
print "michael"
name =3D raw_input= ("what is your name?" )
if name =3D=3D Michael:
   print= "your cool"
elif name =3D=3D ryan:
   print "your not co= ol"



Get more from the Web.= FREE MSN Explorer download : http:/= /explorer.msn.com

------=_NextPart_001_0005_01C247AC.A74EEDF0-- From aicolburn@yahoo.com Tue Aug 20 00:06:33 2002 From: aicolburn@yahoo.com (Alan Colburn) Date: Mon, 19 Aug 2002 16:06:33 -0700 Subject: [Tutor] Apology Message-ID: <003b01c247d5$0fd44190$cae68b86@fo5132> Sorry for including copies of 14 messages in that last post! :-( --Al Colburn From kb@kb2.net Tue Aug 20 00:41:08 2002 From: kb@kb2.net (Kyle Babich) Date: Mon, 19 Aug 2002 23:41:08 UT Subject: [Tutor] py2exe help Message-ID: <20020819234108.9D10293770@server2.fastmail.fm> I installed py2exe on my win98 system but I'm having problems getting it to work. Here is my setup.py: from distutils.core import setup import py2exe setup(name=3D"abc", scripts=3D["abc.py"], ) And here is my command line: c:\python22\python c:\python22\setup.py py2exe abc.py And the result... invalid command name 'abc.py' I know all of the paths are correct (fyi my system wouldn't recognize it if I just typed in python instead of c:\python22\python), and I am in the name folder as abc.py, so why is the command invalid? Thank you, -- Kyle From kb@kb2.net Tue Aug 20 00:50:56 2002 From: kb@kb2.net (Kyle Babich) Date: Mon, 19 Aug 2002 23:50:56 UT Subject: [Tutor] why not? Message-ID: <20020819235056.3F44E93787@server2.fastmail.fm> On Mon, 19 Aug 2002 18:17:18 -0400, "melvin terry" said: > why won't this work? >=20 > print "michael" > name =3D raw_input ("what is your name?" ) > if name =3D=3D Michael: > print "your cool" > elif name =3D=3D ryan: > print "your not cool"Get more from the Web. FREE MSN Explorer > download : http://explorer.msn.com because you need quotes around Michael and ryan Without the quotes python looks for the Michael and ryan variables. So another way to run the program as is would be to add these two lines before the if/elif statements" Michael =3D "Michael" ryan =3D "ryan" -- Kyle From jeff@ccvcorp.com Tue Aug 20 01:14:21 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Mon, 19 Aug 2002 17:14:21 -0700 Subject: [Tutor] Sorting Data References: <004801c247ac$4a08c170$cae68b86@fo5132> <3D615667.2030602@aon.at> Message-ID: <3D6189DD.877622ED@ccvcorp.com> Gregor Lingl wrote: > > Another way to accomplish this is to provide your own comparison-function > as an argument to sort This is another possibility, but extensive discussion on comp.lang.python some time ago established that, in most cases, it's far more efficient to use the decorate-sort-undecorate pattern. Copying the list is fairly quick (you're only copying references), and if you use the default comparison function, then all of the comparisons are done in built-in compiled (and optimized) C code. If you provide your own comparison function, OTOH, then not only are the comparisons being done in (slower) Python code, but you have an extra (slow) function call into Python for each and every compare that you do -- and the number of compares increases geometrically with the size of the list (I don't recall the exact order of magnitude, but it's definately greater than linear). So the longer the list you're sorting, the more time it takes per item... For particularly short lists, a custom cmp() function may be faster, because it avoids a little bit of memory allocation overhead, but for lists of even moderate length, decorate-sort-undecorate takes the advantage and it only gets more significant as the list gets longer. Jeff Shannon Technician/Programmer Credit International From rob@zoism.org Tue Aug 20 01:45:13 2002 From: rob@zoism.org (Rob Brown-Bayliss) Date: 20 Aug 2002 12:45:13 +1200 Subject: [Edu-sig] Re: [Tutor] Girls, women and Programming (- and Python) In-Reply-To: <5.1.1.6.0.20020806083740.0245ed90@pop.ptld.qwest.net> References: <3D4C73D9.2000704@aon.at> <3D485C3F.3060304@aon.at> <3D4C73D9.2000704@aon.at> <5.1.1.6.0.20020806083740.0245ed90@pop.ptld.qwest.net> Message-ID: <1029804312.3472.21.camel@everglade.zoism.org> On Wed, 2002-08-07 at 03:39, Kirby Urner wrote: > A different question: why is computer programming supposedly > less like loving babies and designing dresses, and more like > breaking things? Based on the above description, I can see why > it might be a priority to get the boys *out* of programming :-D. Havent looked here for a while, hence teh late reply.... It has nothing to do with breaking things (unless your are the type to break things when they don;t go your way) and everything to do with this: Boys and Girls/ Women and Men are different. Celebrate it! Seriously, why does the world think "sexual equality = same as". I dont. I[*] am all for women having equal rights, equal opportunities, but dont turn girls in to boys and boys into girls. celebrate the differences. I read a study about 10-12 years ago, it mentioned simple facts, Women make better Biologists, men make better physicists. There were several other examples. None of that means a man cant be a world class biologist, or even the best, and same about women and physics. Just that in general, taking 1000 men and 1000 women in each filed and comparing skills and knowledge there are differences. Why? Because we are different. Not greater and lesser, just different. Women obviously relate better to biology, the concepts grab their attention perhaps? Who knows, but given a choice I prefer female doctors to male ones any day... On the other hand, men relate to physical things better than women, we have a better understanding of spatial relationships for example. does not mean a women cant be the greatest jet pilot in the world. We could take this concept further, and make it racial. Look at the Olympic sprinters, the great ones. More often than not that are from African racial stock, as opposed to Europeans. The opposite seems to hold for swimming. There are racial differences, does not mean that one race is better, nicer or mare caring about the environment does it? Just that some races run faster in general, one swims faster in general... So back to the girls and programming, yse, there will be girls who like the idea, and are great at it, but dont go pushing all girl;s into it just to satisfy your own ideals... Let them take it or leave it depending on their own desires. But, by all means do make them do an intorduction, cant make a choice with out trying can they? [*] I am in fact a house dad, I look after the kids while lean earns the money. Simply because we dont believe in placing young kids in someones care 8-10 hours a day while we both work and Leanne wanted to make use of her education., -- * * Rob Brown-Bayliss * From rob@zoism.org Tue Aug 20 01:49:42 2002 From: rob@zoism.org (Rob Brown-Bayliss) Date: 20 Aug 2002 12:49:42 +1200 Subject: [Tutor] Girls, women and Programming (- and Python) In-Reply-To: <3D4C73D9.2000704@aon.at> References: <3D485C3F.3060304@aon.at> <3D4C73D9.2000704@aon.at> Message-ID: <1029804581.3474.27.camel@everglade.zoism.org> On Sun, 2002-08-04 at 12:22, Gregor Lingl wrote: > And consequently > 2) How do I get them interested? Which kinds of material, approaches, > examples etc. are appealing to female students? another thought for an introduction to programming, and one that might get a lot of interests is POVray. Kind of like logo was used when I was in school, teaching the very basics (loops, checking one value against another, thinking about the intended result before starting etc). It's quite quick for small simple renderings, free so not a burden to a school etc. Might do quite well for the first few lessons, then take what they have learned and use it with python, getting another lessons in the process, Languages are similar in may respects and that skills from one can be used in another. -- * * Rob Brown-Bayliss * From idiot1@netzero.net Tue Aug 20 02:41:15 2002 From: idiot1@netzero.net (Kirk Bailey) Date: Mon, 19 Aug 2002 21:41:15 -0400 Subject: [Tutor] Error in cgi script having health effects on bloodpresure readings References: Message-ID: <3D619E3B.66A35631@netzero.net> Worth a shot, although I *THOUGHT* I had used that before, and had tried it, I suppose my 10 thumbs could have bungled it. >IF< I upgrade to 2.2, will all my 1.5.2 scripts still work fine, or should I expect to have to fine tune things again? Danny Yoo wrote: > > > Traceback (innermost last): > > File "/www/www.tinylist.org/cgi-bin/TLmemberlister.py", line 125, in ? > > mylist = form.getvalue("listname","") # listname, > > File "/usr/local/lib/python1.5/cgi.py", line 888, in __getattr__ > > raise AttributeError, name > > AttributeError: getvalue > > Hi Kirk, > > Ah! the getvalue() method was only recently added in Python 2.2 as part > of the "Higher Level Interface" of the 'cgi' module: > > http://www.python.org/doc/lib/node296.html > > If you want to stick with Python 1.52, you might be able to use this: > > mylist = form['listname'].value > > ... although this isn't quite equivalent. Is it possible to upgrade to > Python 2.2? > > Hope this helps! > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | KILL spam dead! http://www.scambusters.org/stopspam/#Pledge | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com From glingl@aon.at Tue Aug 20 03:00:19 2002 From: glingl@aon.at (Gregor Lingl) Date: Tue, 20 Aug 2002 04:00:19 +0200 Subject: [Tutor] Sorting Data References: <004801c247ac$4a08c170$cae68b86@fo5132> <3D615667.2030602@aon.at> <3D6189DD.877622ED@ccvcorp.com> Message-ID: <3D61A2B3.9040609@aon.at> Jeff Shannon schrieb: >Gregor Lingl wrote: > > > >>Another way to accomplish this is to provide your own comparison-function >>as an argument to sort >> >> > >This is another possibility, but extensive discussion on comp.lang.python some >time ago established that, in most cases, it's far more efficient to use the >decorate-sort-undecorate pattern. Copying the list is fairly quick (you're only >copying references), and if you use the default comparison function, then all of >the comparisons are done in built-in compiled (and optimized) C code. If you >provide your own comparison function, OTOH, then not only are the comparisons >being done in (slower) Python code, but you have an extra (slow) function call >into Python for each and every compare that you do -- and the number of compares >increases geometrically with the size of the list (I don't recall the exact order >of magnitude, but it's definately greater than linear). So the longer the list >you're sorting, the more time it takes per item... For particularly short lists, >a custom cmp() function may be faster, because it avoids a little bit of memory >allocation overhead, but for lists of even moderate length, >decorate-sort-undecorate takes the advantage and it only gets more significant as >the list gets longer. > >Jeff Shannon >Technician/Programmer >Credit International > > > > Thanks for these considerations. To determine what means "far more efficient" I did a quick and dirty comparison for lists of pairs of random integers up to the length of 100000. I obtained the following results - of course these are only rough approximations as one never knows what happens when on a multitasking - machine ... length quotient of time(sorted with comp-fun/sorted with decorate...) of list testrun 1 testrun 2 testrun 3 5000 2.755 1.722 2.579 10000 1.968 2.015 1.983 20000 2.351 1.334 2.089 50000 1.873 1.669 2.233 100000 1.748 1.857 1.881 So the decorate-sort-undecorate method is clearly faster. OTOH the quotient doesn't seem to depend significantly on the length of the list. Gregor >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > > > > From glingl@aon.at Tue Aug 20 03:11:08 2002 From: glingl@aon.at (Gregor Lingl) Date: Tue, 20 Aug 2002 04:11:08 +0200 Subject: [Tutor] Sorting Data References: <004801c247ac$4a08c170$cae68b86@fo5132> <3D615667.2030602@aon.at> <3D6189DD.877622ED@ccvcorp.com> <3D61A2B3.9040609@aon.at> Message-ID: <3D61A53C.7090905@aon.at> Astonishingly a testrun with a list of 500000 pairs of randomnumbers showed: n=500000 a: 89.5090000629 b: 69.810000062 (seconds on a 400MHz - machine) quotient: 1.28218020317 gl From hmteo@cpak.com.my Tue Aug 20 19:53:07 2002 From: hmteo@cpak.com.my (HM Teo) Date: Tue, 20 Aug 2002 11:53:07 -0700 Subject: [Tutor] help Message-ID: <001901c2487a$dec270d0$0208a8c0@rnd02> This is a multi-part message in MIME format. ------=_NextPart_000_0016_01C24840.262D3940 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello,=20 I am a beginner in Python. I just installed Python in my computer few = days ago. I had read through the Python manual, but still not really = understand about it, feel unguideless, dont know which point i should = start, any suggestion? It is also different to C programming, where every starting line in C = must have include and main...(for my opinion) but i dont either = python is same or not?? Besides that, is it Python can run on Windows 2000 Professional? Since = Dos cannot (This is my opinion, dont know correct or not, please feel = free to correct me if it is wrong. Thanks a lot ------=_NextPart_000_0016_01C24840.262D3940 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello,
I am a beginner in Python. I just = installed Python=20 in my computer few days ago. I had read through the Python manual, but = still not=20 really understand about it, feel unguideless, dont know which point i = should=20 start, any suggestion?
It is also different to C programming, = where every=20 starting line in C must have include<stdio.h> and main...(for my = opinion)=20 but i dont either python is same or=20 not??
Besides that, is it Python can run on = Windows 2000=20 Professional? Since Dos cannot (This is my opinion, dont know correct or = not,=20 please feel free to correct me if it is wrong.
 
Thanks a lot
------=_NextPart_000_0016_01C24840.262D3940-- From slime@vsnl.net Tue Aug 20 03:08:04 2002 From: slime@vsnl.net (Prahlad Vaidyanathan) Date: Tue, 20 Aug 2002 07:38:04 +0530 Subject: [Tutor] building the readline module In-Reply-To: References: <20020819164121.GA25828@localhost.localdomain> Message-ID: <20020820020804.GA6670@localhost.localdomain> Hi, On Mon, 19 Aug 2002 Danny Yoo spewed into the ether: [-- snip --] > You may need one more package: > > ### > [dyoo@tesuque dyoo]$ rpm -qf /usr/lib/libtermcap.a > libtermcap-devel-2.0.8-28 > ### Ahh .. that's the one - libtermcap2-devel. Don't know why I didn't think of that earlier - guess I was just too sleepy :-) Anyway, it works now. Thanks ! pv. -- Prahlad Vaidyanathan Don't smoke the next cigarette. Repeat. From buc40@bemail.org Tue Aug 20 06:03:52 2002 From: buc40@bemail.org (S A) Date: Mon, 19 Aug 2002 22:03:52 -0700 Subject: [Tutor] More Class Help. Message-ID: <200208200503.g7K53qu09430@mail19.bigmailbox.com> Hi Everyone- Let's say I have the following made up class: class MadeUp: def __init__(self, x, y, z): self.x = x self.y = y self.z = z def xData(self, x): ... do some stuf here... def yData(self, y): ... do some stuf here... def zData(self, z): ... do some stuf here... Would this allow a person to pass along the variables (x,y,z) to the the "MadeUp" instance? Would this also allow someone to pass the variables along to each of the class methods? Thanks. SA "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From dyoo@hkn.eecs.berkeley.edu Tue Aug 20 08:45:29 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Tue, 20 Aug 2002 00:45:29 -0700 (PDT) Subject: [Tutor] A little math and Python: Horner's rule [horner's rule / optimization / C extension] Message-ID: [warning: this is just recreational programming: there's nothing of real value in here. *grin* And it's long, so skip when you start yawning.] Hi everyone, I just wanted to share a little Python session I had this evening: There's a very cute math trick involved when one wants to calculate polynomials fairly quickly. For example, let's say we'd like to calculate some 5th degree polynomial along several points. Let's see... ### >>> coeffs = [random.randrange(-42, 42) for i in range(6)] >>> coeffs [-35, -12, -40, -39, -7, -22] ### How random that all those numbers turned up negative! Anyway, let's say that we'd like to write a small program to draw out the a curve for the function: f(x) = -35 - 12x - 40x^2 - 39x^3 - 7x^4 - 27x^5 Doing this by hand would be tedious. But we can write this as a Python function to do the work for us: ### >>> def f(x): ... return -35 - 12*x - 40*x**2 - 39*x**3 - 7*x**4 - 27*x**5 ... >>> f(0) -35 >>> f(0), f(1), f(1.5), f(2) (-35, -160, -515.09375, -1507) ### Ok, cool. That wasn't too difficult. Problem solved. Or is it? One problem we often face is that our programs may be doing too much work. This f() function is doing an awful amount of multiplication, and multiplication can be expensive if we do it a lot. (Matrix multiplication, for example, is at the heart of 3d graphics algorithms, and 3d programmers try to reduce multiplication to a bare minimum if they can.) If we've told Python to calculate x**5, it probably needs to calculate intermediary values, like x**2 and x**3. In all, it looks like we're doing 5+4+3+2+1 == 15 multiplications. It might be good if we could use those intermediate powers of x and reduce the amount of work the poor computer has to do... and it turns out that we can! ### >>> def f2(x): ... return((((-27 * x - 7) * x - 39) * x - 40) * x - 12) * x - 35 ... >>> f2(0), f2(1), f2(1.5), f2(2) (-35, -160, -515.09375, -1507) ### This trick is called "Horner's Rule", and it nests the multiplications within each other to make ever multiplication count. But is it worth it to make this look so hideous? Look at all those parentheses! How much faster is f2(), really, compared to f()? ### >>> sample_points = [x/100.0 for x in range(-10000, 10000)] >>> import time >>> def timing_test(function): ... start_time = time.time() ... for point in sample_points: ... function(point) ... stop_type = time.time() ... return stop_type - start_time ... >>> timing_test(f) 0.099812984466552734 >>> timing_test(f2) 0.052543997764587402 ### Bah! That wasn't worth it at all! That's less than half a second: who cares about that? But what if we up the number of points a bit... say... ### >>> sample_points = [x/100.0 for x in range(-1000000, 1000000)] >>> timing_test(f) 10.047876000404358 >>> timing_test(f2) 5.4270470142364502 >>> sample_points = [x/100.0 for x in range(-10000000, 10000000)] >>> timing_test(f) 120.40663707256317 >>> timing_test(f2) 53.546291947364807 ### That's better. So there is a savings involved, but we have to really push the number of f(x)'s hard before it really becomes economical to know Horner's rule. Out of curiosity, I wanted to see if there was significant improvement if I recoded the horner algorithm in C. I've written an extention module called 'hornerc' which takes in a list of coefficients, as well as the 'x' where we'd like to evaluate the function: ### >>> import hornerc >>> def f3(x): ... return hornerc.horner([-35, -12, -40, -39, -7, -27], x) ... >>> f3(0), f3(1), f3(1.5), f3(2) (-35, -160, -515.09375, -1507) >>> timing_test(f3) 102.27121210098267 ### ??! Wow, that wasn't an improvement at all. In fact, it turned out _worse_ than my Python implementation. Heck, it turned out almost as bad as if I hadn't done that Horner optimization in the first place! What gives? Hmmm... let me check something: ### >>> horner = hornerc.horner >>> l = [-35, -12, -40, -39, -7, -27] >>> def f4(x): ... return horner(l, x) ... >>> f4(0), f4(1), f4(1.5), f4(2) (-35, -160, -515.09375, -1507) >>> timing_test(f4) 64.283614039421082 ### One technique we can use to speed up a function is to reduce the amount of work it does. *grin* In Python, looking up a module function does take some work, as does list construction, so I've pulled both of these outside of the f4() function. f4() is an improvement, but, surprisingly, it's still a bit slower than the native Python implementation f2(). Very odd! I'll have to glare confusedly at my C code and see where I'm doing something stupid. I've placed my 'hornerc' extension here for intrepid souls: http://hkn.eecs.berkeley.edu/~dyoo/python/horner/ One lesson I'm learning from this is that coding in C is not magic fairy dust --- It's possible that just recoding an algorithm in C may even slow things down if we're not careful! Premature optimization is the root of all evil. Still, that was fun. Forgive me for rambling about Horner's rule; one thing just kept leading to another. But I hope this was interesting to someone. *grin* From dyoo@hkn.eecs.berkeley.edu Tue Aug 20 09:14:57 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Tue, 20 Aug 2002 01:14:57 -0700 (PDT) Subject: [Tutor] help In-Reply-To: <001901c2487a$dec270d0$0208a8c0@rnd02> Message-ID: On Tue, 20 Aug 2002, HM Teo wrote: > I am a beginner in Python. I just installed Python in my computer few > days ago. I had read through the Python manual Yikes! If, by the "Python manual" you mean: http://python.org/doc/tut/ then do not read it. I'm serious! *grin* The official Python Tutorial is meant for people who've had prior programming experience in another language --- it is not meant for newcomers to programming. If you feel uncomfortable reading through it, that's a good sign. *grin* Try: http://python.org/doc/Newbies.html which is a much gentler guide to programming. There are several tutorials there that should start from the very beginning; some good ones include Josh Cogliati's tutorial, as well as Alan Gauld's. All of the tutorials there should be pretty good, so feel free to pick and see which one you like best. > It is also different to C programming, where every starting line in C > must have include and main...(for my opinion) but i dont either > python is same or not?? It's actually a similar situation in Python. Python doesn't literally have a 'stdio', but it does have "modules". What this means is that, if someone else has written Python programs, we can use bits and pieces of those programs and reuse them. There's a whole collection of these 'modules' that are packaged under the umbrella term "standard library" --- almost every language has a "standard library" to make common things easier to do. You can take a quick glance at: http://www.python.org/doc/lib/ Don't study it, but just page down quite a bit. All those modules that you see can be used by saying things like "import urllib", after which we can start fiddling around with web pages and URLs. > Besides that, is it Python can run on Windows 2000 Professional? Since > Dos cannot (This is my opinion, dont know correct or not, please feel > free to correct me if it is wrong.) Python will run in Win2k pretty well; many of us here do run Python on Windows, so if you have questions, please feel free to bring them to the Tutor list. To download Python for Win2k, I think you'll just need to get and run "Python-2.2.1.exe", which should be here: http://python.org/2.2.1/ Anyway, hope this answers some of your questions. When you have more questions, or if you just want to talk about Python with others, please feel free to chat on Tutor. Good luck to you! From glide@slingshot.co.nz Tue Aug 20 10:22:41 2002 From: glide@slingshot.co.nz (Graeme Andrew) Date: Tue, 20 Aug 2002 21:22:41 +1200 Subject: [Tutor] A little help with TKinter please ....!! Message-ID: <003601c2482b$353737c0$ec62b4ca@graeme> Hi there ... I am new to TKinter but have managed to write a basic user interface, I however am puzzled as to how to get data out of the class ? See following code. Sorry if this is obvious but I am pretty new to this ..... My interface routine is wrapped up in a class and is started with a main loop call ... ie class Install(Frame): def __init__(self,parent,myFileName): Frame.__init__(self,parent) self.pack() self.data = 0 self.make_widgets(self.filecontents) .... more methods and code here Install(None,"textfile").mainloop() My question is how do I get self.data out of the class and back to the code after the 'mainloop' call ? Many thanks for any help !! Cheers Graeme Andrew New Zealand From python Tue Aug 20 10:41:52 2002 From: python (python) Date: Tue, 20 Aug 2002 02:41:52 -0700 Subject: [Tutor] why not? In-Reply-To: References: Message-ID: <89437458007.20020820024152@inkedmn.net> one reason it may not work is because you have a space or two in this line: name = raw_input ("what is your name?") try it like this: name = raw_input("what is your name?") that should do it best of luck, brett mt> why won't this work? mt> print "michael" mt> name = raw_input ("what is your name?" ) mt> if name == Michael: mt> print "your cool" mt> elif name == ryan: mt> print "your not cool"Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com From glingl@aon.at Tue Aug 20 11:22:11 2002 From: glingl@aon.at (Gregor Lingl) Date: Tue, 20 Aug 2002 12:22:11 +0200 Subject: [Tutor] why not? References: <89437458007.20020820024152@inkedmn.net> Message-ID: <3D621853.4090809@aon.at> python schrieb: >one reason it may not work is because you have a space or two in this line: >name = raw_input ("what is your name?") >try it like this: >name = raw_input("what is your name?") > >that should do it > >best of luck, >brett > > If you had tried it out yourself: >>> name = raw_input ("what is your name? ") what is your name? python >>> name 'python' >>> name = raw_input ( "what is your name? " ) what is your name? brett? >>> name 'brett?' >>> you would have seen that this works and cannot be the cause of the error(s) if you are not sure about something but only think maybe its so or so .... then try it out! .... ans you will know!! gregor From python Tue Aug 20 11:34:11 2002 From: python (python) Date: Tue, 20 Aug 2002 03:34:11 -0700 Subject: Re[2]: [Tutor] why not? In-Reply-To: <3D621853.4090809@aon.at> References: <89437458007.20020820024152@inkedmn.net> <3D621853.4090809@aon.at> Message-ID: <135440597147.20020820033411@inkedmn.net> umm... the reason i said "MIGHT NOT" is because i hadn't tested it (because i didn't have much time at that particular moment). i apologize if i mislead anybody, but i didn't state my response as though it were categorical fact, either. brett GL> python schrieb: >>one reason it may not work is because you have a space or two in this line: >>name = raw_input ("what is your name?") >>try it like this: >>name = raw_input("what is your name?") >> >>that should do it >> >>best of luck, >>brett >> >> GL> If you had tried it out yourself: GL> >>> name = raw_input ("what is your name? ") GL> what is your name? python GL> >>> name GL> 'python' GL> >>> name = raw_input ( "what is your name? " ) GL> what is your name? brett? GL> >>> name GL> 'brett?' GL> >>> GL> you would have seen that this works and cannot be the GL> cause of the error(s) GL> if you are not sure about something but only think maybe GL> its so or so .... then GL> try it out! .... ans you will know!! GL> gregor From scot@possum.in-berlin.de Tue Aug 20 13:42:39 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Tue, 20 Aug 2002 14:42:39 +0200 Subject: [Tutor] write to a file In-Reply-To: <157394445439.20020816144507@inkedmn.net> References: <157394445439.20020816144507@inkedmn.net> Message-ID: <200208201442.39427.scot@possum.in-berlin.de> Hello Gus, > file = file('C:\filename.txt', 'w') > x = 'hello, sir' > file.write(x) In think your supposted to close the file after you're done, too, tho nothing evil seems to happen if you don't (or maybe it is all the Garlic hanging from my monitor). So we'd have: filename = file('myfile.txt', 'w') filename.write('Write this string to file') filename.close() While we're here: Is there any possible problem hat could arise from giving a variable ('file' in this case) the same name as a function ('file', the function formerly know as 'open') ? Y, Scot -- Scot W. Stevenson wrote me on Tuesday, 20. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1524 hours and has a CPU that is falling asleep at a system load of 0.00. From gwatt3@backbonesecurity.com Tue Aug 20 15:55:47 2002 From: gwatt3@backbonesecurity.com (Watt III, Glenn) Date: Tue, 20 Aug 2002 10:55:47 -0400 Subject: [Tutor] linux Message-ID: <94FD5825A793194CBF039E6673E9AFE034D621@bbserver1.backbonesecurity.com> is there a way one can use python to write and then save a new file in linux when it is run any as usual thanx for any help From rickp@telocity.com Tue Aug 20 16:18:43 2002 From: rickp@telocity.com (Rick Pasotto) Date: Tue, 20 Aug 2002 11:18:43 -0400 Subject: [Tutor] write to a file In-Reply-To: <200208201442.39427.scot@possum.in-berlin.de> References: <157394445439.20020816144507@inkedmn.net> <200208201442.39427.scot@possum.in-berlin.de> Message-ID: <20020820151843.GF8720@tc.niof.net> On Tue, Aug 20, 2002 at 02:42:39PM +0200, Scot W. Stevenson wrote: > > While we're here: Is there any possible problem hat could arise from > giving a variable ('file' in this case) the same name as a function > ('file', the function formerly know as 'open') ? Only if you want to use the function a second time. -- "Civilization is the distance man has placed between himself and his excreta." -- Brian Aldiss Rick Pasotto rickp@telocity.com http://www.niof.net From shalehperry@attbi.com Tue Aug 20 16:29:44 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Tue, 20 Aug 2002 08:29:44 -0700 (PDT) Subject: [Tutor] A little math and Python: Horner's rule [horner's r In-Reply-To: Message-ID: > > One technique we can use to speed up a function is to reduce the amount of > work it does. *grin* In Python, looking up a module function does take > some work, as does list construction, so I've pulled both of these outside > of the f4() function. > > f4() is an improvement, but, surprisingly, it's still a bit slower than > the native Python implementation f2(). Very odd! I'll have to glare > confusedly at my C code and see where I'm doing something stupid. > > > I've placed my 'hornerc' extension here for intrepid souls: > > http://hkn.eecs.berkeley.edu/~dyoo/python/horner/ > > > One lesson I'm learning from this is that coding in C is not magic fairy > dust --- It's possible that just recoding an algorithm in C may even slow > things down if we're not careful! Premature optimization is the root of > all evil. > > you went from a simple function with hard coded internals to an abstracted function. What's more f4() depends on a global. For a proper speed comparison you should use a python implementation that looks like your C implementation. starting simply, this is hard coded for a 6 item list. def f5(l, x): return((((l[-6] * x + l[-5]) * x + l[-4]) * x + l[-3]) * x + l[-2]) * x + l[-1] the next step would be an arbitrary list. Then compare the numbers. This should help point out any other overheads. From scot@possum.in-berlin.de Tue Aug 20 16:50:24 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Tue, 20 Aug 2002 17:50:24 +0200 Subject: [Tutor] A little math and Python: Horner's rule In-Reply-To: References: Message-ID: <200208201750.24787.scot@possum.in-berlin.de> Hello Danny, > For example, let's say we'd like to > calculate some 5th degree polynomial along several points. Just when I thought I had strange hobbies =8)... > ... return((((-27 * x - 7) * x - 39) * x - 40) * x - 12) * x - 35 At the risk of asking an amazingly stupid question, this looks like some of the constructs that I used to create in high school to feed my HP 15C calculator that uses an entry format called "reverse Polish notation" (RPN) which you are probably familiar with: You don't type "2 + 3 =" but rather "2 ENTER 4 +" - sounds strange, but after you get used to it, it is faster than anything else. Is this Horner's rule somehow related to RPN, or does it just look that way? I seem to remember a factoid that Forth worked with RPN; is there any Python support? And, to stay on topic, just how hard would it be to change the current algebraic entry system in Python to RPN? You'd need to implement a stack somehow for every operation...maybe as a module that implements the stack as global variables, overrides the mathematical operations, and defines 'enter' and 'last x' commands? [Nostalgic rant: A brief visit to the HP website shows me even their scientific calculators don't have RPN anymore (except in the HP 48 class), which is a damn shame. Fortunately, the old HP made fantastically robust products, so my HP 15C is still going strong even after being dropped, stepped on, and generally abused physically for almost 20 years now. The new stuff just looks flimsy - more like Texas Instruments clones than real HP calculators...ah, the days before shareholder value mania...] Y, Scot -- Scot W. Stevenson wrote me on Tuesday, 20. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1526 hours and has a CPU that is falling asleep at a system load of 0.00. From jeff@ccvcorp.com Tue Aug 20 17:08:08 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Tue, 20 Aug 2002 09:08:08 -0700 Subject: [Tutor] write to a file References: <157394445439.20020816144507@inkedmn.net> <200208201442.39427.scot@possum.in-berlin.de> Message-ID: <3D626968.66BEF0CA@ccvcorp.com> "Scot W. Stevenson" wrote: > While we're here: Is there any possible problem hat could arise from giving > a variable ('file' in this case) the same name as a function ('file', the > function formerly know as 'open') ? What happens is that the new variable "shadows" the old function. This means that any time you use that name ('file', in this case), Python will find the variable and *not* the function. So, if you're trying to call the function, you will likely get a TypeError saying that 'type String is not callable' -- Python can only find the string variable, and the function is hidden. Jeff Shannon Technician/Programmer Credit International From gwatt3@backbonesecurity.com Tue Aug 20 20:55:48 2002 From: gwatt3@backbonesecurity.com (Watt III, Glenn) Date: Tue, 20 Aug 2002 15:55:48 -0400 Subject: [Tutor] write to a file in linux Message-ID: <94FD5825A793194CBF039E6673E9AFE0373F0F@bbserver1.backbonesecurity.com> I am trying to write a script in which i write and save a new file in linux i ran across tutorial that looks kind of out dated but gave me a point in the right direction heres what i have >>> import os >>> wrt =3D os.open("an/interesting/filename.py", "w") Traceback (most recent call last): File "", line 1, in ? TypeError: an integer is required whats the deal i provided the variable wrt. i tried the above with both new filenames and previously existing filenames. anyways after that i plan to save the file and to combine all my emails into one i thought i would include my next steps to have them checked out so here goes=20 >>> p.write('here is the stuff i plan to put inside the newly created file') >>> p.close() ok well there it is hopefully this will actually work Thankx From wilson@visi.com Tue Aug 20 21:06:27 2002 From: wilson@visi.com (Tim Wilson) Date: Tue, 20 Aug 2002 15:06:27 -0500 Subject: [Tutor] write to a file in linux In-Reply-To: <94FD5825A793194CBF039E6673E9AFE0373F0F@bbserver1.backbonesecurity.com> References: <94FD5825A793194CBF039E6673E9AFE0373F0F@bbserver1.backbonesecurity.com> Message-ID: <20020820200627.GE3704@isis.visi.com> On Tue, Aug 20, 2002 at 03:55:48PM -0400, Watt III, Glenn wrote: > I am trying to write a script in which i write and save a new file in > linux i ran across tutorial that looks kind of out dated but gave me a > point in the right direction heres what i have > > >>> import os > > >>> wrt = os.open("an/interesting/filename.py", "w") > > Traceback (most recent call last): > File "", line 1, in ? > TypeError: an integer is required Try this: import os wrt = open("filename", "w") wrt.write('Here is the text to write.') wrt.close() In your example 'wrt' is called a file handle. Any manipulating of the file occurs by specifying the name of the file handle first (See the write command above). You'll see a lot of examples that use 'f' as the file handle name. -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.com W. St. Paul, MN | | http://slashdot.org wilson@visi.com | | http://linux.com From charlie@begeistert.org Tue Aug 20 23:17:23 2002 From: charlie@begeistert.org (Charlie Clark) Date: Tue, 20 Aug 2002 22:17:23 +0000 Subject: [Tutor] Re: Tutor digest, Vol 1 #1863 - 5 msgs In-Reply-To: <20020820160005.11227.73032.Mailman@mail.python.org> References: <20020820160005.11227.73032.Mailman@mail.python.org> Message-ID: <20020820221723.497.1@gormenghast.1029881633.fake> On 2002-08-20 at 16:00:05 [+0000], you wrote: > > file =3D file('C:\filename.txt', 'w') > > x =3D 'hello, sir' > > file.write(x) I may have missed this earlier but "c:\filename.txt" in Python does not equal c:\filename.txt in a windows box. It has to be "c:/filename.txt" or "c:\\filename.txt" Charlie -- Charlie Clark Helmholtzstr. 20 D=1Asseldorf D- 40215 Tel: +49-211-938-5360 GSM: +49-178-782-6226 From buc40@bemail.org Tue Aug 20 20:16:26 2002 From: buc40@bemail.org (S A) Date: Tue, 20 Aug 2002 12:16:26 -0700 Subject: [Tutor] A little help with TKinter please ....!! Message-ID: <200208201916.g7KJGQw26542@mail23.bigmailbox.com> Try returning the value and then assigning it to a variable outside the class. class Pass: >... def __init__(self, x): >... self.x = x >... def new(self): >... y = self.x + 4 >... return y > >>>>x = Pass(4) #create an x instance pass value 4 to instance >>>>y = x.new() >>>>print y >8 >>>> > >This is a very simple example. Hope this helps. >SA "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From python Tue Aug 20 22:00:31 2002 From: python (python) Date: Tue, 20 Aug 2002 14:00:31 -0700 Subject: [Tutor] Re: Tutor digest, Vol 1 #1863 - 5 msgs In-Reply-To: <20020820221723.497.1@gormenghast.1029881633.fake> References: <20020820160005.11227.73032.Mailman@mail.python.org> <20020820221723.497.1@gormenghast.1029881633.fake> Message-ID: <196478183293.20020820140031@inkedmn.net> Hello, i think that it does, here's some code from IDLE: >>> file = open('c:\somestuff.txt', 'w') >>> file.write('hello, this is a test') >>> file.close() >>> file = open('c:\somestuff.txt', 'r') >>> stuff = file.read() >>> print stuff >>> hello, this is a test that seemed to work (i know, using the 'open' command instead of the 'file' command)... brett CC> On 2002-08-20 at 16:00:05 [+0000], you wrote: >> > file = file('C:\filename.txt', 'w') >> > x = 'hello, sir' >> > file.write(x) CC> I may have missed this earlier but "c:\filename.txt" in Python does not CC> equal c:\filename.txt in a windows box. It has to be "c:/filename.txt" or CC> "c:\\filename.txt" CC> Charlie CC> -- CC> Charlie Clark CC> Helmholtzstr. 20 CC> Dsseldorf CC> D- 40215 CC> Tel: +49-211-938-5360 CC> GSM: +49-178-782-6226 CC> _______________________________________________ CC> Tutor maillist - Tutor@python.org CC> http://mail.python.org/mailman/listinfo/tutor -- Best regards, python mailto:python@inkedmn.net From glingl@aon.at Tue Aug 20 22:00:00 2002 From: glingl@aon.at (Gregor Lingl) Date: Tue, 20 Aug 2002 23:00:00 +0200 Subject: [Tutor] A little help with TKinter please ....!! References: <003601c2482b$353737c0$ec62b4ca@graeme> Message-ID: <3D62ADD0.9080506@aon.at> Graeme Andrew schrieb: >Hi there ... > >I am new to TKinter but have managed to write a basic user interface, I >however am puzzled as to how to get data out of the class ? See following >code. Sorry if this is obvious but I am pretty new to this ..... > >My interface routine is wrapped up in a class and is started with a main >loop call ... ie > >class Install(Frame): > def __init__(self,parent,myFileName): > Frame.__init__(self,parent) > self.pack() > self.data = 0 > self.make_widgets(self.filecontents) > > .... more methods and code here > >Install(None,"textfile").mainloop() > >My question is how do I get self.data out of the class and back to the code >after the 'mainloop' call ? > > Although I'm in no way a Tkinter-specialist, I'll try to give some remarks to your question, were it only to help this thread evolve a little more vividly ... I suppose, if you write "after the mainloop-call", you mean the time after this call. (Because code which is written after this call (in the program) will not be executed - The mainloop call causes the program to wait for events and to execute callback-function-calls which are (previously) bound to some widget. Now, if you define in your class a method def callback(self,event): and then bind it (e. g. in the make_widgets-method ) to some widget, like this: widget.bind("", self.callback) or self.bind("", self.callback) it will be executed whenever this event (in this case: left mouse button pressed) occurs. Is it this what you wanted to know? If it helps, please let me know, and if it was useless also ... Gregor You may find some useful links at http://starship.python.net/lib.html and at: http://www.pythonware.com/library/index.htm See especially: http://www.pythonware.com/library/tkinter/introduction/events-and-bindings.htm >Many thanks for any help !! > >Cheers >Graeme Andrew >New Zealand > > > > >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > > > > From Morne" This is a multi-part message in MIME format. ------=_NextPart_000_0048_01C24839.DE8CCB60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Sir=20 Could you please help me with thise task Im new to Python and want to = learn alot more,If you could help me I would very much Like that. How would I create a Python program that takes a text file and counts = the number of lines in the file, the number of words in a line and then produces a summary. The Output must look like this. Enter file name: > testfile.txt LINE# WORDS -------------------- 1 20 words 2 25 words 3 30 words 4 25 words -------------------- Summary: 4 lines, 100 words, Avg: 25 words/line >From Morne ------=_NextPart_000_0048_01C24839.DE8CCB60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

 
 
 
 
 
Hi Sir
 
Could you please help me with thise = task Im new to=20 Python and want to learn alot more,If you could help me I would very = much Like=20 that.
 
 How would I create a Python = program that=20 takes a text file and counts the number of
lines in the file, the = number of=20 words in a line and then produces a
summary.  The Output must = look like=20 this.


Enter file name:
> = testfile.txt


LINE# =20 WORDS
--------------------
1      20=20 words
2      25=20 words
3      30=20 words
4      25=20 words
--------------------
Summary:
4 lines, 100 words, Avg: 25 = words/line

From Morne
 


------=_NextPart_000_0048_01C24839.DE8CCB60-- From aschmidt@nvcc.edu Tue Aug 20 13:10:44 2002 From: aschmidt@nvcc.edu (Schmidt, Allen J.) Date: Tue, 20 Aug 2002 08:10:44 -0400 Subject: [Tutor] Web page capture Message-ID: <47BCBF3251382B45893950D07804082475B206@novamail.nv.cc.va.us> Is it possible to use URLLIB (or something else) to mimic the process of going to a URL, entering a userid and password and saving the resulting page to a file or as a field in a database? I have looked a bit at URLLIB but have not seen any way to enter the authentication stuff. Also how to actually save the html code itself to a file that can be called from a DB and rendered later. Thanks!! -Allen From emile@fenx.com Tue Aug 20 14:56:16 2002 From: emile@fenx.com (Emile van Sebille) Date: Tue, 20 Aug 2002 06:56:16 -0700 Subject: [Tutor] Re: More Class Help. References: <200208200503.g7K53qu09430@mail19.bigmailbox.com> Message-ID: "S A" wrote in message news:200208200503.g7K53qu09430@mail19.bigmailbox.com... > Hi Everyone- > > Let's say I have the following made up class: > > class MadeUp: > def __init__(self, x, y, z): > self.x = x > self.y = y > self.z = z > > def xData(self, x): > ... do some stuf here... > def yData(self, y): > ... do some stuf here... > def zData(self, z): > ... do some stuf here... > > Would this allow a person to pass along the variables (x,y,z) to the the "MadeUp" instance? Yes, if what you mean is: myMadeUpInstance = MadeUp(x,y,z) > Would this also allow someone to pass the variables along to each of the class methods? > The __init__ method saves x,y & z as attributes of self. The other methods can access self. So I suspect what you want is more like: def xData(self): ... do stuff with self.x here ... using self.y and self.z as needed HTH, -- Emile van Sebille emile@fenx.com --------- From mcherm@destiny.com Tue Aug 20 16:25:08 2002 From: mcherm@destiny.com (Michael Chermside) Date: Tue, 20 Aug 2002 11:25:08 -0400 Subject: [Tutor] Re: More Class Help. References: <200208200503.g7K53qu09430@mail19.bigmailbox.com> Message-ID: <3D625F54.30107@destiny.com> S A wrote: > Hi Everyone- > > Let's say I have the following made up class: > > class MadeUp: > def __init__(self, x, y, z): > self.x = x > self.y = y > self.z = z > > def xData(self, x): > ... do some stuf here... > def yData(self, y): > ... do some stuf here... > def zData(self, z): > ... do some stuf here... > > Would this allow a person to pass along the variables (x,y,z) to the the "MadeUp" instance? Yes. They're available as "self.x", "self.y", and "self.z" > Would this also allow someone to pass the variables along to each of the class methods? Yes. They're available as "x", "y", and "z" (although only one is available in each method). -- Michael Chermside From mcherm@destiny.com Tue Aug 20 16:29:15 2002 From: mcherm@destiny.com (Michael Chermside) Date: Tue, 20 Aug 2002 11:29:15 -0400 Subject: [Tutor] Re: A little math and Python: Horner's rule [horner's rule / optimization / C extension] References: Message-ID: <3D62604B.9060602@destiny.com> Danny Yoo wrote: > [...extensive notes on Horner's rule and optimizing Python...] Neat! -- Michael Chermside From python Wed Aug 21 00:15:17 2002 From: python (python) Date: Tue, 20 Aug 2002 16:15:17 -0700 Subject: [Tutor] hELP!!!!!!!!!!!!!!! In-Reply-To: <004b01c24829$1de4fb40$7800a8c0@maxitec.co.za> References: <004b01c24829$1de4fb40$7800a8c0@maxitec.co.za> Message-ID: <35486270083.20020820161517@inkedmn.net> hello, this works: # line/word counter def getStuff(file): info = open(file, 'r') infolines = info.readlines() linenum = 1 for line in infolines: words = line.split(' ') print "Line %d contains %d words" % (linenum, len(words)) linenum += 1 file = raw_input("Enter the filename: ") getStuff(file) best of luck, brett M> Hi Sir M> Could you please help me with thise task Im new to Python and want to learn alot more,If you could help me I would very much Like that. M> How would I create a Python program that takes a text file and counts the number of M> lines in the file, the number of words in a line and then produces a M> summary. The Output must look like this. M> Enter file name: >> testfile.txt M> LINE# WORDS M> -------------------- M> 1 20 words M> 2 25 words M> 3 30 words M> 4 25 words M> -------------------- M> Summary: M> 4 lines, 100 words, Avg: 25 words/line M> From Morne -- Best regards, python mailto:python@inkedmn.net From python Wed Aug 21 00:19:15 2002 From: python (python) Date: Tue, 20 Aug 2002 16:19:15 -0700 Subject: [Tutor] Web page capture In-Reply-To: <47BCBF3251382B45893950D07804082475B206@novamail.nv.cc.va.us> References: <47BCBF3251382B45893950D07804082475B206@novamail.nv.cc.va.us> Message-ID: <48486508263.20020820161915@inkedmn.net> to actually download the html from a site, use urllib, like this: url = "http://www.inkedmn.net/index.htm" x = urllib.urlopen(url) data = x.read() x.close() "data" should be the html from whatever URL you gave it... SAJ> Is it possible to use URLLIB (or something else) to mimic the process of SAJ> going to a URL, entering a userid and password and saving the resulting page SAJ> to a file or as a field in a database? I have looked a bit at URLLIB but SAJ> have not seen any way to enter the authentication stuff. Also how to SAJ> actually save the html code itself to a file that can be called from a DB SAJ> and rendered later. SAJ> Thanks!! SAJ> -Allen SAJ> _______________________________________________ SAJ> Tutor maillist - Tutor@python.org SAJ> http://mail.python.org/mailman/listinfo/tutor -- Best regards, python mailto:python@inkedmn.net From arosado@softhome.net Wed Aug 21 01:50:16 2002 From: arosado@softhome.net (Andres Rosado) Date: Tue, 20 Aug 2002 20:50:16 -0400 Subject: [Tutor] Re: Want something cool Message-ID: <5.1.0.14.0.20020820205007.00bd8aa0@mail.softhome.net> At 12:25 AM 8/19/2002 -0400, you wrote: >I jus started python can some one e mail me something like a cool script? Check Useless Python @ http://www.uselesspython.com/ and the Vaults @ http://py.vaults.ca . Also, you could check pySignature, a random signature program I made. I submitted it to Useless Python (don't know the status) and I (finally) have uploaded to my webpage @ http://andres980.tripod.com/pySignature.html . ----------------------------------- Andres Rosado Email: andresr@despammed.com ICQ: 66750646 Homepage: http://andres980.tripod.com/ Now is the time for drinking; now the time to beat the earth with unfettered foot. -- Quintus Horatius Flaccus (Horace) From dreynolds26@cogeco.ca Wed Aug 21 01:55:57 2002 From: dreynolds26@cogeco.ca (Darren Reynolds) Date: Tue, 20 Aug 2002 20:55:57 -0400 Subject: [Tutor] suitability to task Message-ID: <3D62E51D.6080901@cogeco.ca> just doing some planning work on a project i'm going to be doing for myself, and was wondering if ppl might be able to tell me if python (or another language) would be better suited for it. i'm also not decided yet on what form the data storage is going to take place. the program isn't going to be very complex (mp3 database / indexing), and is going to run in the console as opposed to graphical interface. in essence its operation will be this ... -- will do an 'ls -R /cdrom' (or some other command that will give me recirsive listing of all files and directories on the cd) and re-direct output to a temporary flat-text file -- will name the text file based on user input -- once disc has been read, text file will be processed to read the following information; artist, album, year pf release, # of tracks per album, track names, format, disc "name" (as entered by user ... as all the cds will have consistent layout, program shouldn't have a problem picking these pieces out or knowing when new album listing has started) -- take this information and place it into data storage (both flat-text file storage and mysql have been suggested by friends of mine) -- remove the temporary text file once data has been successfully committed to storage -- will also have options for user to search indexed cds by; artist. album, track name -- will pipe search results to screen (through pager such as less) and indicate to user all criteria matches and which cds the tracks / albums can be found (the user entered "name" for each cd will be used as the indicator as to track location) i don't see this as being terribly complicated to get done, but as i'm no programmer i'm not really sure if python would be ideally suited to a task like this ... or if i'm going to give myself fits trying to get it done ... :) so, if anyone has any in advance "caveats" for me to look out for, or could make any suggestions about data storage ... i'm all "ears" ... :) thanks in advance ... darren From guillermo.fernandez@epfl.ch Wed Aug 21 03:13:36 2002 From: guillermo.fernandez@epfl.ch (Guillermo Fernandez) Date: Wed, 21 Aug 2002 11:43:36 +0930 Subject: [Tutor] A little math and Python: Horner's rule References: <200208201750.24787.scot@possum.in-berlin.de> Message-ID: <3D62F750.68806266@epfl.ch> > Just when I thought I had strange hobbies =8)... > > > ... return((((-27 * x - 7) * x - 39) * x - 40) * x - 12) * x - 35 > > At the risk of asking an amazingly stupid question, this looks like some of > the constructs that I used to create in high school to feed my HP 15C > calculator that uses an entry format called "reverse Polish notation" > (RPN) which you are probably familiar with: You don't type "2 + 3 =" but > rather "2 ENTER 4 +" - sounds strange, but after you get used to it, it is > faster than anything else. Is this Horner's rule somehow related to RPN, > or does it just look that way? Actually it only looks that way. What it do is simply expand the first polynom in order to try to reduce the number of times you multiply x by itself. If you express the same expression without parentesis, you find the polynom -27*x^5-7*x^4-39*x^3-40*x^2-12*x-35 again. But if you have a look to the expression, it still simply an expression that you could express in polish notation. it would be something like: ((((((((((-27 x *) 7 -) x *) 39 -) x *) 40 -) x *) 12 -) x *) 35 -) Parentesis are added for clarity only as one of the good things with polish notations (that I also lve, by the way) is that you don't need parentesis. This expression is equivalent to -27 x * 7 - x * 39 - x * 40 - x * 12 - x * 35 - But if you look at the expression ((((-27 * x - 7) * x - 39) * x - 40) * x - 12) * x - 35 you will notice that the parentesis are needed! Well... I hope its not too unclear... By the way, have you try lisp? If you like recursion and polish notation, it should interest you :-) > [Nostalgic rant: A brief visit to the HP website shows me even their > scientific calculators don't have RPN anymore (except in the HP 48 class), > which is a damn shame. Fortunately, the old HP made fantastically robust > products, so my HP 15C is still going strong even after being dropped, > stepped on, and generally abused physically for almost 20 years now. The > new stuff just looks flimsy - more like Texas Instruments clones than real > HP calculators...ah, the days before shareholder value mania...] I learned to program in the HP48, in a way my first machine :-) Great calculators once you know how to program and use them! Guille From dylan.belsey@baesystems.com Wed Aug 21 03:52:23 2002 From: dylan.belsey@baesystems.com (BELSEY, Dylan) Date: Wed, 21 Aug 2002 12:22:23 +0930 Subject: [Tutor] A little help with TKinter please ....!! Message-ID: <86C3892A0C52D411AF5000A0C9EAA3B96320F0@wtntex1.baea.com.au> Alternatively, you can separate the mainloop call from the object instantiation. Tkinter will ultimately require a root window to hold your frames and it will create this by default if the user does not. So....you 'could' do something like this: from Tkinter import * root = Tk() object_name = Install(root,"textfile") # notice the "root" for parent. object_name.GetData() # Like the function suggested by "SA" in previous posting. # do other stuff. root.mainloop() # mainloop will operate as "Gregor Lingl" posted. This represents one common method of creating/displaying the widgets (in some textbook examples) and I also see that the method you have posted is also used in other examples to create the visuals (I assume that Frame.__init__() will create the root window???). However, if you want to use that method then you will have to do some sort of callbacks as Gregor has explained. HTH, Dylan -----Original Message----- From: Graeme Andrew [mailto:glide@slingshot.co.nz] Sent: Tuesday, 20 August 2002 19:23 To: Tutor@python.org Subject: [Tutor] A little help with TKinter please ....!! Hi there ... I am new to TKinter but have managed to write a basic user interface, I however am puzzled as to how to get data out of the class ? See following code. Sorry if this is obvious but I am pretty new to this ..... My interface routine is wrapped up in a class and is started with a main loop call ... ie class Install(Frame): def __init__(self,parent,myFileName): Frame.__init__(self,parent) self.pack() self.data = 0 self.make_widgets(self.filecontents) .... more methods and code here Install(None,"textfile").mainloop() My question is how do I get self.data out of the class and back to the code after the 'mainloop' call ? Many thanks for any help !! Cheers Graeme Andrew New Zealand _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From wilson@visi.com Wed Aug 21 04:29:52 2002 From: wilson@visi.com (Tim Wilson) Date: Tue, 20 Aug 2002 22:29:52 -0500 Subject: [Tutor] list comprehensions Message-ID: <20020821032952.GA3513@isis.visi.com> Hi everyone, I'm wondering if it's possible to implement the following function using list comprehensions. It's not really a speed issue because it runs in a split second using the built-in dictionary on my Linux box. -Tim def filterLongest(words): """ Filter a list of words for all words that have a length equal to the longest word in the list. Argument: words -- List of words to filter """ l = [] maxLength = 0 for word in words: wordLength = len(word) if wordLength == maxLength: l.append(word) elif wordLength > maxLength: l = [word] maxLength = wordLength return l -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.com W. St. Paul, MN | | http://slashdot.org wilson@visi.com | | http://linux.com From shalehperry@attbi.com Wed Aug 21 04:50:04 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Tue, 20 Aug 2002 20:50:04 -0700 Subject: [Tutor] list comprehensions In-Reply-To: <20020821032952.GA3513@isis.visi.com> References: <20020821032952.GA3513@isis.visi.com> Message-ID: <200208202050.04074.shalehperry@attbi.com> On Tuesday 20 August 2002 08:29 pm, Tim Wilson wrote: > Hi everyone, > > I'm wondering if it's possible to implement the following function usin= g > list comprehensions. It's not really a speed issue because it runs in a > split second using the built-in dictionary on my Linux box. > > -Tim > > def filterLongest(words): > """ > Filter a list of words for all words that have a length equal to th= e > longest word in the list. > > Argument: > words -- List of words to filter > > """ > l =3D [] > maxLength =3D 0 > for word in words: > wordLength =3D len(word) > if wordLength =3D=3D maxLength: > l.append(word) > elif wordLength > maxLength: > l =3D [word] > maxLength =3D wordLength > return l this code actual has a fairly big bug. ['a', 'bb', 'ccc', 'dddd', 'eeeee', ...] given that list each item will end up in the return. You really need to = loop=20 twice. Once to find the longest word then again to find those that are a= t=20 least as big. Or did I misunderstand your comment? For instance given m= y=20 example list above the return list would simply be: ['z' * 26] From buc40@bemail.org Wed Aug 21 05:06:09 2002 From: buc40@bemail.org (S A) Date: Tue, 20 Aug 2002 21:06:09 -0700 Subject: [Tutor] I'm drawing a blank here.. help please Message-ID: <200208210406.g7L469I20384@mail15.bigmailbox.com> Hi Everyone- Arggghhh!!! Ok. Sorry, I had to vent a little frustration there. I've been hammering away at this code for awhile and no matter what I try I get the same error. But first, a little prep for you: I have this module I'm writing that containst the class TextExtractor. The following two defs are the first two methods in the class: def __init__(self, html, t): self.html = html self.t = t def crop(self): story = "(?sx)%s.+%s" % ("", "") newhtml = re.findall(story, self.html) So when I instantiate this class with the values html and t(for time), those values are passed onto self.html and self.t respectively. (self.t will come up in a later class method) So, every time I try to run this program that imports this module or import this module in idle I get the following error: Traceback (most recent call last): File "./fnewsupdate.py", line 3, in ? from update import * File "./update.py", line 63, in ? class TextExtractor: File "./update.py", line 73, in TextExtractor newhtml = re.findall(story, self.html) NameError: name 'story' is not defined When I try to import the module in idle, it imports every class in the module except TextExtractor. Is not story defined as the string "(?sx).+"? If not, what am I doing wrong here? Thanks in advance. SA "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From slime@vsnl.net Wed Aug 21 06:44:05 2002 From: slime@vsnl.net (Prahlad Vaidyanathan) Date: Wed, 21 Aug 2002 11:14:05 +0530 Subject: [Tutor] Re: list comprehensions In-Reply-To: <20020821032952.GA3513@isis.visi.com> References: <20020821032952.GA3513@isis.visi.com> Message-ID: <20020821054405.GA1008@localhost.localdomain> Hi, On Tue, 20 Aug 2002 Tim Wilson spewed into the ether: > Hi everyone, > > I'm wondering if it's possible to implement the following function using > list comprehensions. It's not really a speed issue because it runs in a > split second using the built-in dictionary on my Linux box. Well, if speed is not an issue, this should work : """ def filterLongest(words) : maxlen = max([len(word) for word in words]) return [ w for w in words if len(w) == maxlen ] """ HTH, pv. -- Prahlad Vaidyanathan There will be big changes for you but you will be happy. From valdas.jonikas@if.lt Wed Aug 21 08:44:15 2002 From: valdas.jonikas@if.lt (Valdas Jonikas) Date: Wed, 21 Aug 2002 08:44:15 +0100 Subject: [Tutor] How to copy files from one directory to another? Message-ID: <9CA5BE43F9BD694FB63CC81CF75B0BBA1BE9EB@mariner.sampo.vlan> SGkgYWxsLA0KDQpDb3VsZCB5b3UgcGxlYXNlIGFkdmlzZSBob3cgdG8gY29weQ0KZmlsZVtzXSBm cm9tIG9uZSBkaXJlY3RvcnkgdG8gYW5vdGhlcg0Kd2l0aCBQeXRob24uICh3aW4yayBwbGF0Zm9y bSkNCg0KVE5YLA0KVmFsZGFzDQo= From glingl@aon.at Wed Aug 21 10:05:39 2002 From: glingl@aon.at (Gregor Lingl) Date: Wed, 21 Aug 2002 11:05:39 +0200 Subject: [Tutor] list comprehensions References: <20020821032952.GA3513@isis.visi.com> <200208202050.04074.shalehperry@attbi.com> Message-ID: <3D6357E3.50700@aon.at> Sean 'Shaleh' Perry schrieb: >On Tuesday 20 August 2002 08:29 pm, Tim Wilson wrote: > > >>Hi everyone, >> >>I'm wondering if it's possible to implement the following function using >>list comprehensions. It's not really a speed issue because it runs in a >>split second using the built-in dictionary on my Linux box. >> >>-Tim >> >>def filterLongest(words): >> """ >> Filter a list of words for all words that have a length equal to the >> longest word in the list. >> >> Argument: >> words -- List of words to filter >> >> """ >> l = [] >> maxLength = 0 >> for word in words: >> wordLength = len(word) >> if wordLength == maxLength: >> l.append(word) >> elif wordLength > maxLength: >> l = [word] >> maxLength = wordLength >> return l >> >> > >this code actual has a fairly big bug. > >['a', 'bb', 'ccc', 'dddd', 'eeeee', ...] > >given that list each item will end up in the return. You really need to loop >twice. Once to find the longest word then again to find those that are at >least as big. Or did I misunderstand your comment? For instance given my >example list above the return list would simply be: > >['z' * 26] > > I disagree: >>> tl ['a', 'bb', 'ccc', 'dddd', 'eeeee'] >>> filterLongest(tl) ['eeeee'] >>> filterLongest(tl*4) ['eeeee', 'eeeee', 'eeeee', 'eeeee'] >>> imho this is what is intended. In the above code l collects all the words having length of the longest word encountered so far. If a longer word occurs l is replaced by a new list containing only this one which then may be appended to. And concerning list-comprehension: I only see the possibility to use it, if maxLenght is known. This may for instance determined like this. >>> map(len,tl) [1, 2, 3, 4, 5] >>> max(map(len,tl)) 5 So we get the desired result with >>> [word for word in tl if len(word) == max(map(len,tl))] ['eeeee'] >>> [word for word in tl*4 if len(word) == max(map(len,tl))] ['eeeee', 'eeeee', 'eeeee', 'eeeee'] >>> tl.append("hehee") >>> [word for word in tl if len(word) == max(map(len,tl))] ['eeeee', 'hehee'] >>> Gregor From python Wed Aug 21 10:20:29 2002 From: python (python) Date: Wed, 21 Aug 2002 02:20:29 -0700 Subject: [Tutor] How to copy files from one directory to another? In-Reply-To: <9CA5BE43F9BD694FB63CC81CF75B0BBA1BE9EB@mariner.sampo.vlan> References: <9CA5BE43F9BD694FB63CC81CF75B0BBA1BE9EB@mariner.sampo.vlan> Message-ID: <99522587256.20020821022029@inkedmn.net> hello, check out the shutils module, it's got some copying stuff in it... best of luck, brett VJ> Hi all, VJ> Could you please advise how to copy VJ> file[s] from one directory to another VJ> with Python. (win2k platform) VJ> TNX, VJ> Valdas VJ> ¶? From buc40@bemail.org Wed Aug 21 10:19:48 2002 From: buc40@bemail.org (S A) Date: Wed, 21 Aug 2002 02:19:48 -0700 Subject: [Tutor] How to copy files from one directory to another? Message-ID: <200208210919.g7L9Jmf12506@mail10.bigmailbox.com> T25lIHdheSB3b3VsZCBiZSB0byBvcGVuIHlvdXIgc291cmNlIGZpbGUgYW5kIHRoZW4gb3Bl biB5b3VyIHRhcmdldCBmaWxlIGFuZCB3aXJ0ZSB0aGUgc291cmNlIGZpbGUgdG8gdGhlIHRh cmdldCBmaWxlOg0KDQpGb3IgZXhhbXBsZToNCnNvdXJjZSA9IG9wZW4oInNvbWUgZmlsZSIs ICJyYiIpDQp0YXJnZXQgPSBvcGVuKCJzb21lIEZpbGUyIiwgIndiIikNCnRlbXAgPSBzb3Vy Y2UucmVhZCgpDQp0YXJnZXQud3JpdGUodGVtcCkNCnNvdXJjZS5jbG9zZSgpDQp0YXJnZXQu Y2xvc2UoKQ0KDQpUaGlzIHNlZW1zIGNvbXBsZXgsIHNvIG1heWJlIHNvbWVvbmUgZWxzZSBo YXMgYSBxdWlja2VyIHdheS4gSWYgbm90IHRoZSB0aHJvdyBpdCBpbnRvIGEgZnVuY3Rpb24g Zm9yIHF1aWNrIGFjY2VzcyBlbHN3aGVyZS4NCg0KR29vZCBMdWNrLg0KU0ENCj4gW1R1dG9y XSBIb3cgdG8gY29weSBmaWxlcyBmcm9tIG9uZSBkaXJlY3RvcnkgdG8gYW5vdGhlcj8gIlZh bGRhcyBKb25pa2FzIiA8dmFsZGFzLmpvbmlrYXNAaWYubHQ+ICJQeXRob24gVHV0b3IgKEUt bWFpbCkiIDx0dXRvckBweXRob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Cg== From darnold02@sprynet.com Wed Aug 21 12:17:45 2002 From: darnold02@sprynet.com (Don Arnold) Date: Wed, 21 Aug 2002 06:17:45 -0500 Subject: [Tutor] How to copy files from one directory to another? References: <9CA5BE43F9BD694FB63CC81CF75B0BBA1BE9EB@mariner.sampo.vlan> Message-ID: <002d01c24904$672e2750$2711ba3f@defaultcomp> If you intend to just move files from 1 directory to another instead of actually copying them, os.rename( ) works, also. Don ----- Original Message ----- From: "Valdas Jonikas" To: "Python Tutor (E-mail)" Sent: Wednesday, August 21, 2002 2:44 AM Subject: [Tutor] How to copy files from one directory to another? > Hi all, > > Could you please advise how to copy > file[s] from one directory to another > with Python. (win2k platform) > > TNX, > Valdas > Nfë®–X;! f j)fj b? h From emile@fenx.com Wed Aug 21 13:54:48 2002 From: emile@fenx.com (Emile van Sebille) Date: Wed, 21 Aug 2002 05:54:48 -0700 Subject: [Tutor] Re: I'm drawing a blank here.. help please References: <200208210406.g7L469I20384@mail15.bigmailbox.com> Message-ID: "S A" > > def __init__(self, html, t): > self.html = html > self.t = t > def crop(self): > story = "(?sx)%s.+%s" % ("", "") > newhtml = re.findall(story, self.html) > > So when I instantiate this class with the values html and t(for time), those values are passed onto self.html and self.t respectively. (self.t will come up in a later class method) So, every time I try to run this program that imports this module or import this module in idle I get the following error: > > Traceback (most recent call last): > File "./fnewsupdate.py", line 3, in ? > from update import * > File "./update.py", line 63, in ? > class TextExtractor: > File "./update.py", line 73, in TextExtractor > newhtml = re.findall(story, self.html) > NameError: name 'story' is not defined I'd suspect inconsistent indentation, forcing that line into a different scope where story is not defined. -- Emile van Sebille emile@fenx.com --------- From emile@fenx.com Wed Aug 21 14:09:07 2002 From: emile@fenx.com (Emile van Sebille) Date: Wed, 21 Aug 2002 06:09:07 -0700 Subject: [Tutor] Re: Web page capture References: <47BCBF3251382B45893950D07804082475B206@novamail.nv.cc.va.us> Message-ID: Schmidt, Allen J. > Is it possible to use URLLIB (or something else) to mimic the process of > going to a URL, entering a userid and password and saving the resulting page > to a file or as a field in a database? I have looked a bit at URLLIB but > have not seen any way to enter the authentication stuff. Also how to > actually save the html code itself to a file that can be called from a DB > and rendered later. > One way is to include the userid and passwd in the url: tempfile, msg = urllib.urlretrieve("http://userid:passwd@somewhere.com:8080/required/pag e") which then allows: data = open(tempfile).read() HTH, -- Emile van Sebille emile@fenx.com --------- From gwatt3@backbonesecurity.com Wed Aug 21 15:45:23 2002 From: gwatt3@backbonesecurity.com (Watt III, Glenn) Date: Wed, 21 Aug 2002 10:45:23 -0400 Subject: [Tutor] write to a file in linux (again)! Message-ID: <94FD5825A793194CBF039E6673E9AFE034D623@bbserver1.backbonesecurity.com> -----Original Message----- From: Tim Wilson [mailto:wilson@visi.com] Sent: Tuesday, August 20, 2002 4:06 PM To: Watt III, Glenn Cc: tutor@python.org Subject: Re: [Tutor] write to a file in linux > >Try this: > >import os >wrt =3D open("filename", "w") >wrt.write('Here is the text to write.') >wrt.close() > >In your example 'wrt' is called a file handle. Any manipulating of the >file occurs by specifying the name of the file handle first (See the >write command above). You'll see a lot of examples that use 'f' as the >file handle name. ok i did this and it works in the shell but whenever i implement it in the script im running i get this error Traceback (most recent call last): File "/var/www/backbone/admin/newdesign/papers/cgi/final.py", line 58, in ? newpy =3D open(newpyfile, "w") IOError: [Errno 2] No such file or directory: 'newdesign/papers/cgi/1.py'=20 well of coarse its not a file or directory im creating a new one how do i tell it to create a new one as a script it didnt need any thing extra for the shell just for reference here is the script #!/usr/local/bin/python import cgi import sys import MySQLdb import os connection =3D MySQLdb.Connect(login info) cursor =3D connection.cursor() if query.has_key("accept"): header =3D "Content-type: text/html\n" print header print """ Popsiclestick.com """ else: print "Well that was kind of useless you didn't even decide whether or not to accept" sys.exit(0) if query['accept'].value =3D=3D "Yes": num =3D 1 x =3D "No" while x =3D=3D "No": cursor.execute("select state from newpapers") for link in cursor.fetchall(): if link[0] =3D=3D num: num =3D num + 1 else: x =3D "yes" refname =3D str(num) newpyfile =3D "newdesign/papers/cgi/" + refname + ".py" newpy =3D open(newpyfile, "w") newpage =3D """

Recently submited papers

Name: """+query["title"].value+"""
Web Site: """+query["web"].value+"""
Location: """+query["city"].value+"""
Title: """+query["papertitle"].value+"""

"""+query["cot"].value newpy.write(newpage) newpy.close() newhtmlfile =3D "newdesign/papers/papers/" + refname + ".html" newhtml =3D open(newhtmlfile, "w") newwpage =3D """ """ newhtml.write(newwpage) newpy.close() it goes on from there but this is the import part right now From shalehperry@attbi.com Wed Aug 21 16:28:57 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Wed, 21 Aug 2002 08:28:57 -0700 Subject: [Tutor] list comprehensions In-Reply-To: <3D6357E3.50700@aon.at> References: <20020821032952.GA3513@isis.visi.com> <200208202050.04074.shalehperry@attbi.com> <3D6357E3.50700@aon.at> Message-ID: <200208210828.57678.shalehperry@attbi.com> On Wednesday 21 August 2002 02:05 am, Gregor Lingl wrote: > >given that list each item will end up in the return. You really need = to > > loop twice. Once to find the longest word then again to find those t= hat > > are at least as big. Or did I misunderstand your comment? For insta= nce > > given my example list above the return list would simply be: > > > >['z' * 26] > > I disagree: > >>> tl > > ['a', 'bb', 'ccc', 'dddd', 'eeeee'] > > >>> filterLongest(tl) > > ['eeeee'] > > >>> filterLongest(tl*4) > > ['eeeee', 'eeeee', 'eeeee', 'eeeee'] > > > imho this is what is intended. In the above code l collects all the > words having > length of the longest word encountered so far. If a longer word occurs > l is replaced by a new list containing only this one which then may be > appended to. > You are correct. I would be wary of the performance but there is no bug = as I=20 asserted earlier. From alan.gauld@bt.com Wed Aug 21 17:21:42 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 21 Aug 2002 17:21:42 +0100 Subject: [Tutor] this is hard Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C861@mbtlipnt02.btlabs.bt.co.uk> > why wont this work? When you type 1 noting happenes Quite a subtle problem for a beginner to spot. > input = raw_input("type 1 for a rectangle") > if input == 1: Here you create a name 'input' and make it receive the value returned by raw_input. In so doing you hide the name of the built in function 'input()' so that > heigth = input("please type height here:") you can't call this function now. You say nothing happens? I would have expected you to get an error, p[robably something about callable objects or similar. Try replaving input() with: height = int(raw_input("Type a height here")) Which will convert the users value into an integer. Either that or change the name of your variable above to something other than 'input' - say value? Alan g. From alan.gauld@bt.com Wed Aug 21 17:23:42 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 21 Aug 2002 17:23:42 +0100 Subject: [Tutor] this is hard Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C862@mbtlipnt02.btlabs.bt.co.uk> > Also, on the 5th line, I changed 1 to '1', because > raw_input() grabs the user's input as a string, Aha! The real reason he was getting nothing out. The if block never got executed! Well spotted Rob, I totally missed that. Alan g From rob@uselesspython.com Wed Aug 21 17:37:04 2002 From: rob@uselesspython.com (Rob) Date: Wed, 21 Aug 2002 11:37:04 -0500 Subject: [Tutor] this is hard In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C862@mbtlipnt02.btlabs.bt.co.uk> Message-ID: > > Also, on the 5th line, I changed 1 to '1', because > > raw_input() grabs the user's input as a string, > > Aha! The real reason he was getting nothing out. The > if block never got executed! Well spotted Rob, I totally > missed that. > > Alan g If I were twice the programmer I am, it would've taken me ten times longer to spot it. 3;-> Rob From alan.gauld@bt.com Wed Aug 21 17:35:49 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 21 Aug 2002 17:35:49 +0100 Subject: [Tutor] write to a file Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C864@mbtlipnt02.btlabs.bt.co.uk> > os.open("C:\blah.txt", 'w') > I don't see what an integer has to do with anything? You've had that explained in depth. But there's another problem. Using the '\' character in filenames is not a good thing. Better to use a '/' slash which works just as well but is safer. "C:/blah.txt" If you really must use a '\' use two: "C:\\blah.txt" It makes for a saner life! Alan g. From alan.gauld@bt.com Wed Aug 21 17:51:14 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 21 Aug 2002 17:51:14 +0100 Subject: [Tutor] A little help with TKinter please ....!! Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C865@mbtlipnt02.btlabs.bt.co.uk> > class Install(Frame): > def __init__(self,parent,myFileName): > > Install(None,"textfile").mainloop() > > My question is how do I get self.data out of the class and > back to the code after the 'mainloop' call ? GUI = Install(None,"textfile") GUI.mainloop() print GUI.data However in general you want the GUI to keep running while you access the data. One way to do that is to create the other objects first then pass them as instances into your GUI - rather like you did the filename. Then within the GUI event handlers you camn call methods of the external objects passing them the data they need. This usually turns out to be more reusable than the other way round wherein the external objects need to know about the GUI internals. Without knowing exactly what your GUI does/looks like its hard to be more concrete... HTH, Alan G. From jeff@ccvcorp.com Wed Aug 21 17:54:30 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Wed, 21 Aug 2002 09:54:30 -0700 Subject: [Tutor] I'm drawing a blank here.. help please References: <200208210406.g7L469I20384@mail15.bigmailbox.com> Message-ID: <3D63C5C5.CBC9385@ccvcorp.com> S A wrote: > def __init__(self, html, t): > self.html = html > self.t = t > def crop(self): > story = "(?sx)%s.+%s" % ("", "") > newhtml = re.findall(story, self.html) I notice you have inconsistent indentation for these two methods. That *shouldn't* be an actual error (and you should be getting a SyntaxError instead of a NameError if it was), but it's not terribly good style... > Traceback (most recent call last): > File "./fnewsupdate.py", line 3, in ? > from update import * > File "./update.py", line 63, in ? > class TextExtractor: > File "./update.py", line 73, in TextExtractor > newhtml = re.findall(story, self.html) > NameError: name 'story' is not defined You're sure that you cut&pasted the exact code that you're importing? If so, perhaps you should show us a bit more of the code. Other than the indentation issue, I don't see anything glaringly wrong... However, there's another "bad style" point here -- I see that you're using 'from update import *'. This form of import may seem easier, but it's not generally recommended. It becomes very easy for imported names to shadow each other, leading to strange errors, and it's difficult to track where a particular name originates. There are a few toolkit packages (Tkinter, PIL, and wxPython come to mind) that are specifically designed to be fairly safe to use this way, but they are the exception rather than the rule. I'd suggest going through your program, eliminating the wildcard imports, and using fully qualified names -- i.e., change 'from update import *' to 'import update' and change 'TextExtractor' to 'update.TextExtractor'. I can't think offhand of any way in which a wildcard import could be causing this particular error, but it makes other errors likely (as well as making maintenance more difficult). Jeff Shannon Technician/Programmer Credit International From jeff@ccvcorp.com Wed Aug 21 18:01:06 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Wed, 21 Aug 2002 10:01:06 -0700 Subject: [Tutor] list comprehensions References: <20020821032952.GA3513@isis.visi.com> <200208202050.04074.shalehperry@attbi.com> <3D6357E3.50700@aon.at> Message-ID: <3D63C751.72E8CF54@ccvcorp.com> Gregor Lingl wrote: > >>> [word for word in tl if len(word) == max(map(len,tl))] > ['eeeee'] Note, however, that this is *much* less efficient than the original for-loop code, because it recalculates the maximum length for *each* element of the list. Since finding the max length examines each element of the list, this takes time proportionate to the square of the list length, while the original version is linear. This won't make a noticeable difference for small lists, but will certainly be significant if the list is an entire dictionary file. You can regain linear time for list comprehensions by breaking this into two steps (as Prahlad did). Jeff Shannon Technician/Programmer Credit International From Morne" Hi Brett Its Morne , I just wanna thank you for your helpand let you know that its not a school project "lol" I have done a Visual Basic cource and now I have a Job at a ISP and My boss wants me to get to know Unix Freebsd But he also wants me to get to know python, its a new line of job that im going into now and I raelly want to get to know more the only thing is that when i read from www.python page is that I cant seem to understand, I think I need to go over what parameters are and ......so on all the little thing that I dont know. Well Thanx again"and if you have any other good web page for me to look up :) God bless you and keep you happy >From Morne From Morne" This is a multi-part message in MIME format. ------=_NextPart_000_0085_01C24928.27921600 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Lance E Sloan Hi=20 No this is not a class im taking but my boss , he is a Delphi and Unix = and python expert and he wants me to do this project I have tried some code but cant seem to get started and by friday it = must be done. here is what i have=20 # line/word counter =20 def getStuff(file): info =3D open(file, 'r') infolines =3D info.readlines() linenum =3D 1 for line in infolines: words =3D line.split(' ') print "Line %d contains %d words" % (linenum, len(words)) linenum +=3D 1 file =3D raw_input("Enter the filename: ") getStuff(file) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxx here is what I need to do c I need to reate a Python program that takes a text file and counts the = number of lines in the file, the number of words in a line and then produces a summary. The Output must look like this. Enter file name: > testfile.txt LINE# WORDS -------------------- 1 20 words 2 25 words 3 30 words 4 25 words -------------------- Summary: 4 lines, 100 words, Avg: 25 words/line Please let me know soon Morne ------=_NextPart_000_0085_01C24928.27921600 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Lance E Sloan
Hi
 
No this is not a class im taking but my = boss , he=20 is a Delphi and Unix and python expert and he wants me to do this=20 project
I have tried some code but cant seem to = get started=20 and by friday it must be done.
 
here is what i have
 
# line/word counter 

def=20 getStuff(file):
    info =3D open(file,=20 'r')
    infolines =3D = info.readlines()
   =20 linenum =3D 1
    for line in=20 infolines:
        words =3D = line.split('=20 ')
        print "Line %d contains = %d=20 words" % (linenum, = len(words))
       =20 linenum +=3D 1

file =3D raw_input("Enter the filename:=20 ")
getStuff(file)
 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxx
 
 
here is what I need to do
 

c I need to reate a Python program = that takes a=20 text file and counts the number of
lines in the file, the number of = words in=20 a line and then produces a
summary.  The Output must look like=20 this.


Enter file name:
> = testfile.txt


LINE# =20 WORDS
--------------------
1      20=20 words
2      25=20 words
3      30=20 words
4      25=20 words
--------------------
Summary:
4 lines, 100 words, Avg: 25 = words/line
 
Please let me know soon
Morne

 
------=_NextPart_000_0085_01C24928.27921600-- From aschmidt@nvcc.edu Wed Aug 21 14:43:05 2002 From: aschmidt@nvcc.edu (Schmidt, Allen J.) Date: Wed, 21 Aug 2002 09:43:05 -0400 Subject: [Tutor] Re: Web page capture Message-ID: <47BCBF3251382B45893950D07804082475B20D@novamail.nv.cc.va.us> Thanks to all who helped. I did some more digging and found parts which I used to create this script. It works and dumps my data into a MySQL database. import urllib,MySQLdb,string,re,time curtime=time.localtime(time.time()) fmt='%Y%m%d' ourtimestamp=time.strftime(fmt,curtime) class myURLOpener(urllib.FancyURLopener): def setpasswd(self, user, passwd): self.__user = user self.__passwd = passwd def prompt_user_passwd(self, host, realm): return self.__user, self.__passwd dbc = MySQLdb.connect(host="localhost", db="xxxx", passwd="xxxxx") # here's where we hook up to the database and get a cursor crsr = dbc.cursor() urlopener = myURLOpener() urlopener.setpasswd("username","mypassword") fp = urlopener.open("http://localhost/foldername/pagename.htm") report = fp.read() sql = "insert into dailyreports (report_date, report_content) values ('"+ourtimestamp+"','"+report+"')" x=crsr.execute(sql) crsr.execute('select * from dailyreports') queryresults=crsr.fetchall() for entries in queryresults: report_id = entries[0] report_date = entries[1] report_content = entries[2] -----Original Message----- From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of Emile van Sebille Sent: Wednesday, August 21, 2002 9:09 AM To: tutor@python.org Subject: [Tutor] Re: Web page capture Schmidt, Allen J. > Is it possible to use URLLIB (or something else) to mimic the process of > going to a URL, entering a userid and password and saving the resulting page > to a file or as a field in a database? I have looked a bit at URLLIB but > have not seen any way to enter the authentication stuff. Also how to > actually save the html code itself to a file that can be called from a DB > and rendered later. > One way is to include the userid and passwd in the url: tempfile, msg = urllib.urlretrieve("http://userid:passwd@somewhere.com:8080/required/pag e") which then allows: data = open(tempfile).read() HTH, -- Emile van Sebille emile@fenx.com --------- _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From rab121@york.ac.uk Wed Aug 21 18:08:35 2002 From: rab121@york.ac.uk (Russell Bungay) Date: Wed, 21 Aug 2002 18:08:35 +0100 Subject: [Tutor] suitability to task References: <3D62E51D.6080901@cogeco.ca> Message-ID: <3D63C913.D9A0A29F@york.ac.uk> Darren Reynolds wrote: >just doing some planning work on a project i'm going to be doing for >myself, and was wondering if ppl might be able to tell me if python... Sounds like exactly the sort of thing I would use Python for. >so, if anyone has any in advance "caveats" for me to look out for, or >could make any suggestions about data storage ... i'm all "ears" ... :) I have no sort of particular knowledge on this, but I think size may play a part. If you have lots of records (pardon the pun ;o) then a proper database based system will be probably be more efficient. The problem I see with flat text is that you would need to parse it, but that isn't all that hard... I hope that helps a little, Russell -- Tulips Ate My Socks http://www.bigmaddrongo.com Chair of The York Glee Singers: http://www.gleesingers.co.uk From james2dope@yahoo.com Wed Aug 21 18:09:19 2002 From: james2dope@yahoo.com (james middendorff) Date: Wed, 21 Aug 2002 10:09:19 -0700 (PDT) Subject: [Tutor] help In-Reply-To: <20020821160005.5348.38185.Mailman@mail.python.org> Message-ID: <20020821170919.27286.qmail@web13908.mail.yahoo.com> I am learning Python and using a (even though I dont know vb)Visual Basic books examples to practice things, and the example I am doing right now, looks like this so far #this is a little program to print out names of an #auto dealers departments import sys def view_options(): print "Options" print "'1' Auto Sales" print "'2' Service Center" print "'3' Detail Shop" print "'4' Employment Opportunities" print "'5' To Exit" view_options() Selection = raw_input("Select a number") while Selection != "5": if Selection == '1': print "Family Wagon, Immaculate condition $12,995" view_options() Selection = raw_input("Select a number") elif Selection == "2": print "Lube, oil, filter $25.99" view_options() Selection = raw_input("Select a number") elif Selection == "3": print "Complete Detail $79.99 for most cars" view_options() Selection = raw_input("Select a number") elif Selection == "4": print "Sales position contact Mr. Mann" view_options() Selection = raw_input("Select a number") print "Goodbye" sys.exit() is there any way I could add things, and make them stay for the next time the program is run? ===== "I would kill everyone in this room for a drop of sweet beer." ----Homer Simpson---- __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com From alan.gauld@bt.com Wed Aug 21 18:11:05 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 21 Aug 2002 18:11:05 +0100 Subject: [Tutor] A little math and Python: Horner's rule Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C867@mbtlipnt02.btlabs.bt.co.uk> > the constructs that I used to create in high school to feed my HP 15C > calculator that uses an entry format called "reverse Polish notation" Sharing the nostalhgia - I couldn't afford an HP so used a 'Novus' calculator that was also RPN based. I agree that once you got used to it it was much faster and very powerful - parens were hardly ever needed. Sadly my Novus did not last as long as your HP.... FWIW ISTR that the X windows calculator xcalc can accept a flag that makes it into an HP clone complete with RPN. Or am I hallucinating again? Finally you might find it fun to play with Lisp/Scheme which use a system similar to RPN called prefix notation: (* 3 4) => 12 (+ 5 6 8) => 19 (- 3 (+ 4 8)) => 9 Of course being Lisp(*) parens are everywhere. (*) LISP = Lots of Irrelevant Silly Parentheses... From shalehperry@attbi.com Wed Aug 21 18:21:35 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Wed, 21 Aug 2002 10:21:35 -0700 Subject: [Tutor] suitability to task In-Reply-To: <3D62E51D.6080901@cogeco.ca> References: <3D62E51D.6080901@cogeco.ca> Message-ID: <200208211021.35743.shalehperry@attbi.com> On Tuesday 20 August 2002 05:55 pm, Darren Reynolds wrote: > just doing some planning work on a project i'm going to be doing for > myself, and was wondering if ppl might be able to tell me if python (or > another language) would be better suited for it. i'm also not decided > yet on what form the data storage is going to take place. the program > isn't going to be very complex (mp3 database / indexing), and is going > to run in the console as opposed to graphical interface. in essence it= s > operation will be this ... > easily accomplished in python (-; > -- will do an 'ls -R /cdrom' (or some other command that will give me > recirsive listing of all files and directories on the cd) and re-direct > output to a temporary flat-text file import os.path and look into os.path.walk. > -- will name the text file based on user input > -- once disc has been read, text file will be processed to read the > following information; artist, album, year pf release, # of tracks per > album, track names, format, disc "name" (as entered by user ... as all > the cds will have consistent layout, program shouldn't have a problem > picking these pieces out or knowing when new album listing has started) > -- take this information and place it into data storage (both flat-text > file storage and mysql have been suggested by friends of mine) a db of sort sort (sql or not) is probably a good idea, more on this in a= =20 moment. > -- remove the temporary text file once data has been successfully > committed to storage > -- will also have options for user to search indexed cds by; artist. > album, track name this would be aided by a db backend, most of the hard work would be done = for=20 you. > -- will pipe search results to screen (through pager such as less) and > indicate to user all criteria matches and which cds the tracks / albums > can be found (the user entered "name" for each cd will be used as the > indicator as to track location) > > so, if anyone has any in advance "caveats" for me to look out for, or > could make any suggestions about data storage ... i'm all "ears" ... :) > A sql db has some pros and cons: cons -- * Must be running to use it. This means you lose some cpu and memory. N= ot=20 bad if you use the db for other projects or if it is on another machine. * Must maintain the db. * Must learn about dbs. pros -- * they have solved the storage and efficiencies problems * can output the data to multiple programs / views * flat text can be implemented via the db and even by a separate app * flexibility in general There are other db style approaches that may not require an actual runnin= g db=20 server. From shalehperry@attbi.com Wed Aug 21 18:22:41 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Wed, 21 Aug 2002 10:22:41 -0700 Subject: [Tutor] A little math and Python: Horner's rule In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C867@mbtlipnt02.btlabs.bt.co.uk> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C867@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <200208211022.41414.shalehperry@attbi.com> On Wednesday 21 August 2002 10:11 am, alan.gauld@bt.com wrote: > FWIW ISTR that the X windows calculator xcalc can accept a flag that > makes it into an HP clone complete with RPN. Or am I hallucinating agai= n? > xcalc -rpn. From python Wed Aug 21 18:26:16 2002 From: python (python) Date: Wed, 21 Aug 2002 10:26:16 -0700 Subject: [Tutor] Lance E Sloan"help" In-Reply-To: <008801c24917$66bf8c60$7800a8c0@maxitec.co.za> References: <008801c24917$66bf8c60$7800a8c0@maxitec.co.za> Message-ID: <51551738968.20020821102616@inkedmn.net> hello, i added some stuff to that code, here it is: def getStuff(file): info = open(file, 'r') infolines = info.readlines() linenum = 1 totalwords = 0 for line in infolines: words = line.split(' ') print "Line %d contains %d words" % (linenum, len(words)) linenum += 1 totalwords += len(words) print "Total lines:", linenum - 1 print "Average words per line:", float(totalwords)/linenum - 1 file = raw_input("Enter the filename: ") getStuff(file) and here's what the output looks like: C:\python wordcount.py Enter the filename: gpl.txt ... ... Line 339 contains 15 words Line 340 contains 6 words Line 341 contains 1 words Total lines: 341 Average words per line: 8.88011695906 is that more like what you want? brett M> Lance E Sloan M> Hi M> No this is not a class im taking but my boss , he is a Delphi and Unix and python expert and he wants me to do this project M> I have tried some code but cant seem to get started and by friday it must be done. M> here is what i have M> # line/word counter M> def getStuff(file): M> info = open(file, 'r') M> infolines = info.readlines() M> linenum = 1 M> for line in infolines: M> words = line.split(' ') M> print "Line %d contains %d words" % (linenum, len(words)) M> linenum += 1 M> file = raw_input("Enter the filename: ") M> getStuff(file) M> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx M> here is what I need to do M> c I need to reate a Python program that takes a text file and counts the number of M> lines in the file, the number of words in a line and then produces a M> summary. The Output must look like this. M> Enter file name: >> testfile.txt M> LINE# WORDS M> -------------------- M> 1 20 words M> 2 25 words M> 3 30 words M> 4 25 words M> -------------------- M> Summary: M> 4 lines, 100 words, Avg: 25 words/line M> Please let me know soon M> Morne From alan.gauld@bt.com Wed Aug 21 18:30:42 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 21 Aug 2002 18:30:42 +0100 Subject: [Tutor] write to a file in linux (again)! Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C868@mbtlipnt02.btlabs.bt.co.uk> > ok i did this and it works in the shell but whenever i implement it in > the script im running i get this error > > Traceback (most recent call last): File > "/var/www/backbone/admin/newdesign/papers/cgi/final.py", line 58, in ? > newpy = open(newpyfile, "w") IOError: [Errno 2] No such file or > directory: 'newdesign/papers/cgi/1.py' This is a guess but... Is newdesign/papers/cgi supposed to be a relative path? Or should it really be: /newdesign/papers/cgi Just a thought. > well of coarse its not a file or directory im creating a new > one If the directory doesn't exist python won't create it, it will only create the file itself. If you want to create the path as well you'll need to use something else, probably in the os module... os.mkdirs() looks like the one you would need. HTH, Alan g. From gwatt3@backbonesecurity.com Wed Aug 21 18:42:31 2002 From: gwatt3@backbonesecurity.com (Watt III, Glenn) Date: Wed, 21 Aug 2002 13:42:31 -0400 Subject: [Tutor] write to a file in linux (again)! Message-ID: <94FD5825A793194CBF039E6673E9AFE0373F10@bbserver1.backbonesecurity.com> -----Original Message----- From: alan.gauld@bt.com [mailto:alan.gauld@bt.com] Sent: Wednesday, August 21, 2002 1:31 PM To: Watt III, Glenn; tutor@python.org Subject: RE: [Tutor] write to a file in linux (again)! > >This is a guess but... > >Is=20 > >newdesign/papers/cgi=20 > >supposed to be a relative path? Or should it really be: > >/newdesign/papers/cgi > >Just a thought.=20 > >If the directory doesn't exist python won't=20 >create it, it will only create the file itself. >If you want to create the path as well you'll=20 >need to use something else, probably in the=20 >os module... > >os.mkdirs() looks like the one you would need. > >HTH, > >Alan g. well i appreciate the thought but the path is relative i tried the full path and i got the same error From python Wed Aug 21 18:50:18 2002 From: python (python) Date: Wed, 21 Aug 2002 10:50:18 -0700 Subject: Re[2]: [Tutor] write to a file in linux (again)! In-Reply-To: <94FD5825A793194CBF039E6673E9AFE0373F10@bbserver1.backbonesecurity.com> References: <94FD5825A793194CBF039E6673E9AFE0373F10@bbserver1.backbonesecurity.com> Message-ID: <128553181550.20020821105018@inkedmn.net> does the whole path exist already? python will only create files for you, not directories (unless you use os.mkdir() <-- i think that's what it's called). so, the directory you're trying to create a file in must exist before you run this... brett WIG> -----Original Message----- WIG> From: alan.gauld@bt.com [mailto:alan.gauld@bt.com] WIG> Sent: Wednesday, August 21, 2002 1:31 PM WIG> To: Watt III, Glenn; tutor@python.org WIG> Subject: RE: [Tutor] write to a file in linux (again)! >> >>This is a guess but... >> >>Is >> >>newdesign/papers/cgi >> >>supposed to be a relative path? Or should it really be: >> >>/newdesign/papers/cgi >> >>Just a thought. >> >>If the directory doesn't exist python won't >>create it, it will only create the file itself. >>If you want to create the path as well you'll >>need to use something else, probably in the >>os module... >> >>os.mkdirs() looks like the one you would need. >> >>HTH, >> >>Alan g. WIG> well i appreciate the thought but the path is relative i tried the full WIG> path and i got the same error WIG> _______________________________________________ WIG> Tutor maillist - Tutor@python.org WIG> http://mail.python.org/mailman/listinfo/tutor From alan.gauld@bt.com Wed Aug 21 18:47:48 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 21 Aug 2002 18:47:48 +0100 Subject: [Tutor] help Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C869@mbtlipnt02.btlabs.bt.co.uk> Hi James, > things, and the example I am doing right now, looks > like this so far > > #this is a little program to print out names of an > #auto dealers departments > import sys > def view_options(): > print "Options" > print "'1' Auto Sales" > print "'2' Service Center" > print "'3' Detail Shop" > print "'4' Employment Opportunities" > print "'5' To Exit" > view_options() > > Selection = raw_input("Select a number") > while Selection != "5": > if Selection == '1': > print "Family Wagon, Immaculate condition > $12,995" > view_options() > Selection = raw_input("Select a number") etc.... You could shorten this code quite a bit by using a list or dictionary: options = {"1": ["Auto Sales", "Family Wagon, Immaculate condition"], "2": [ "Service center", "Some other message/price"] "5": [] } Thus to add options you simply edit the options dictionary.... Then write: def view_options(): for option in options.keys(): print option, options[option][0] return raw_input("Pick one") choice = view_options() while choice != '5': print options[choice][1] choice = view_options() print "Bye!" > is there any way I could add things, and make them > stay for the next time the program is run? You bneed to look at file handling and how to write things to a file. Then read the file back in when you start the program. The approach I describe above is ideal for this since you can populate the options dictionary from the file at startup, add items during running and then and write the whole dictionary back out again at the end. HTH Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From gwatt3@backbonesecurity.com Wed Aug 21 19:01:11 2002 From: gwatt3@backbonesecurity.com (Watt III, Glenn) Date: Wed, 21 Aug 2002 14:01:11 -0400 Subject: Re[2]: [Tutor] write to a file in linux (again)! Message-ID: <94FD5825A793194CBF039E6673E9AFE0373F11@bbserver1.backbonesecurity.com> -----Original Message----- From: python [mailto:python@inkedmn.net] Sent: Wednesday, August 21, 2002 1:50 PM To: Watt III, Glenn Cc: tutor@python.org Subject: Re[2]: [Tutor] write to a file in linux (again)! >> >> >>does the whole path exist already? >> >>python will only create files for you, not directories (unless you use >>os.mkdir() <-- i think that's what it's called). >> >>so, the directory you're trying to create a file in must exist before >>you run this... >> >>brett sorry i was careless with my last message i got an error but it wasnt the same now i lack the permissions to run the script which i can change in the linux shell but i am researching how to do throught python i thinks its=20 >>> import os >>> system("chmod +x filename") then open write and close but the problem is i cant change the write permissions before a file exists and i cant write a new file without having permissions i never had this problem before i was always aloud to write files or the files i couldnt write to already existed From jeff@ccvcorp.com Wed Aug 21 19:08:10 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Wed, 21 Aug 2002 11:08:10 -0700 Subject: [Tutor] write to a file in linux (again)! References: <94FD5825A793194CBF039E6673E9AFE0373F11@bbserver1.backbonesecurity.com> Message-ID: <3D63D70A.F85D1FE1@ccvcorp.com> "Watt III, Glenn" wrote: > sorry i was careless with my last message i got an error but it wasnt > the same now i lack the permissions to run the script which i can change > in the linux shell but i am researching how to do throught python i > thinks its > >>> import os > >>> system("chmod +x filename") That should actually be 'os.system(" ...")' > then open write and close but the problem is i cant change the write > permissions before a file exists and i cant write a new file without > having permissions i never had this problem before i was always aloud to > write files or the files i couldnt write to already existed What you need, then, is to change permissions on the *directory* that the files are going into. Jeff Shannon Technician/Programmer Credit International From buc40@bemail.org Wed Aug 21 20:11:35 2002 From: buc40@bemail.org (S A) Date: Wed, 21 Aug 2002 12:11:35 -0700 Subject: [Tutor] I'm drawing a blank here.. help please Message-ID: <200208211911.g7LJBZC21437@mail9.bigmailbox.com> >S A wrote: > >> def __init__(self, html, t): >> self.html = html >> self.t = t >> def crop(self): >> story = "(?sx)%s.+%s" % ("", "") >> newhtml = re.findall(story, self.html) > >I notice you have inconsistent indentation for these two methods. That *shouldn't* be an actual error (and you should be getting a SyntaxError instead of a NameError if it was), but it's not terribly good style... Sorry, the inconsistent indenting is from cut and pasting to this email. It actually looks correct in the code. That is why I can't figure out this error. When I get to my other computer tonight I'll post all of the code. Bassically, the program was written to search awebsite for specific tags and download the the text in between the tags. Thanks. SA "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From buc40@bemail.org Wed Aug 21 20:23:33 2002 From: buc40@bemail.org (S A) Date: Wed, 21 Aug 2002 12:23:33 -0700 Subject: [Tutor] write to a file in linux (again)! Message-ID: <200208211923.g7LJNXa22782@mail9.bigmailbox.com> >Traceback (most recent call last): File >"/var/www/backbone/admin/newdesign/papers/cgi/final.py", line 58, in ? >newpy = open(newpyfile, "w") IOError: [Errno 2] No such file or >directory: 'newdesign/papers/cgi/1.py' > > newpyfile = "newdesign/papers/cgi/" + refname + ".py" > newpy = open(newpyfile, "w") > newpage = """ >

Recently submited papers

> Name: """+query["title"].value+""" >
Web Site: """+query["web"].value+""" >
Location: """+query["city"].value+""" >
Title: """+query["papertitle"].value+""" >

"""+query["cot"].value > newpy.write(newpage) > newpy.close() > newhtmlfile = "newdesign/papers/papers/" + refname + ".html" > newhtml = open(newhtmlfile, "w") > newwpage = """ > > > """ > newhtml.write(newwpage) > newpy.close() > Here is the offending section. When you ran this from the command line, were you already in the correct directory? Because this program uses an incomplete path to the target directory. Therefore, if the script is not run from the root of this path, it will not find the correct directory hence, the error. (I think this is your problem anyways) When the program is run, python treats the directory the script was run in as it's starting point. For example: If you ran this script from /scripts/: The program works from the /scripts directory and looks for newdesign/papers/papers/ in that directory. So if this is not present you will get the error. When writing the file in from the command line, it probably greated the new file in '.' (or current directory) so you did not get the error. Try using absolute path names in your script and see if that fixes the problem, Good Luck. SA "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From buc40@bemail.org Wed Aug 21 20:28:34 2002 From: buc40@bemail.org (S A) Date: Wed, 21 Aug 2002 12:28:34 -0700 Subject: Re[2]: [Tutor] write to a file in linux (again)! Message-ID: <200208211928.g7LJSYT23231@mail9.bigmailbox.com> > >>>> import os >>>> system("chmod +x filename") >then open write and close but the problem is i cant change the write >permissions before a file exists and i cant write a new file without >having permissions i never had this problem before i was always aloud to >write files or the files i couldnt write to already existed This may not be the easiest solution. But you just create the file first. Then you can use the "a" flag when opening to append to the file. Also you can use os.chmod to change the file permissions after you first create the blank file and then append to the file. Good Luck. SA "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From buc40@bemail.org Wed Aug 21 21:01:32 2002 From: buc40@bemail.org (S A) Date: Wed, 21 Aug 2002 13:01:32 -0700 Subject: [Tutor] Lance E Sloan"help" Message-ID: <200208212001.g7LK1Wb25284@mail9.bigmailbox.com> Ok. I'm not Lance , but I'll give it a shot: > ># line/word counter > >def getStuff(file): > info = open(file, 'r') > infolines = info.readlines() > linenum = 1 > for line in infolines: > words = line.split(' ') > print "Line %d contains %d words" % (linenum, len(words)) > linenum += 1 > >file = raw_input("Enter the filename: ") >getStuff(file) > > > >Enter file name: >> testfile.txt > > >LINE# WORDS >-------------------- >1 20 words >2 25 words >3 30 words >4 25 words >-------------------- >Summary: >4 lines, 100 words, Avg: 25 words/line First let's look at why your for loop does not work: 1. import string 2. change the for loop to the following: >>> for lines in infolines: ... word = string.split(lines) ... print "Line %d contains %d words" % (linenum, len(word)) ... linenum += 1 ... Line 1 contains 8 words Line 2 contains 0 words Line 3 contains 1 words Line 4 contains 0 words Line 5 contains 13 words Line 6 contains 5 words Line 7 contains 1 words Line 8 contains 7 words Line 9 contains 0 words Line 10 contains 2 words Line 11 contains 0 words Now the rest is formatting your print and doing some math on lines and words. Make sure you place the print statement for: LINE# WORDS -------------------- -------------------- Summary: 4 lines, 100 words, Avg: 25 words/line Outside of the iteration. And all of the other data can be printed inside the for loop. Hope this helps some. Good Luck. SA "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From buc40@bemail.org Wed Aug 21 21:05:53 2002 From: buc40@bemail.org (S A) Date: Wed, 21 Aug 2002 13:05:53 -0700 Subject: [Tutor] suitability to task Message-ID: <200208212005.g7LK5rd25549@mail9.bigmailbox.com> >There are other db style approaches that may not require an actual running db >server. I would suggest trying Gadfly. It has some "SQL" like commands and is les intrusive than MySQL, therefore alot smaller and easier to use. Plus it is written totally in Python. I've begun to use this for smaller databases. Larger databases though I would stick with SQL(like MySQL or some other commercial brand). Good Luck. "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From buc40@bemail.org Wed Aug 21 21:11:30 2002 From: buc40@bemail.org (S A) Date: Wed, 21 Aug 2002 13:11:30 -0700 Subject: [Tutor] Brett Thanx Message-ID: <200208212011.g7LKBUJ25912@mail9.bigmailbox.com> You should pick up a copy of O'Reilly's "Learning Python". This is what I used to get started. Very well written. And written so a novice could understand. Besides that, enter "python +tutorial" in google and watch what pops up. This will get you going in the right direction. Good Luck. SA "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From buc40@bemail.org Wed Aug 21 21:16:17 2002 From: buc40@bemail.org (S A) Date: Wed, 21 Aug 2002 13:16:17 -0700 Subject: [Tutor] write to a file in linux (again)! Message-ID: <200208212016.g7LKGHo26295@mail9.bigmailbox.com> What are the file permissions for this directory and file? Do you need special permission to write to this directory? SA "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From python Wed Aug 21 21:21:12 2002 From: python (python) Date: Wed, 21 Aug 2002 13:21:12 -0700 Subject: Re[2]: [Tutor] Brett Thanx In-Reply-To: <200208212011.g7LKBUJ25912@mail9.bigmailbox.com> References: <200208212011.g7LKBUJ25912@mail9.bigmailbox.com> Message-ID: <198562236165.20020821132112@inkedmn.net> been writing python code for over a year now, thanks. brett SA> You should pick up a copy of O'Reilly's "Learning Python". This is what I used to get started. Very well written. And written so a novice could understand. SA> Besides that, enter "python +tutorial" in google and watch what pops up. SA> This will get you going in the right direction. SA> Good Luck. SA> SA SA> "I can do everything on my Mac that I used to do on my PC, plus alot more ..." SA> -Me SA> ------------------------------------------------------------ SA> Free, BeOS-friendly email accounts: http://BeMail.org/ SA> BeOS News and Community: http://www.BeGroovy.com/ SA> --------------------------------------------------------------------- SA> Express yourself with a super cool email address from BigMailBox.com. SA> Hundreds of choices. It's free! SA> http://www.bigmailbox.com SA> --------------------------------------------------------------------- SA> _______________________________________________ SA> Tutor maillist - Tutor@python.org SA> http://mail.python.org/mailman/listinfo/tutor From max_ig@yahoo.com Wed Aug 21 21:40:21 2002 From: max_ig@yahoo.com (MIG) Date: Wed, 21 Aug 2002 13:40:21 -0700 (PDT) Subject: [Tutor] what module to use for encrypt passwords???? Message-ID: <20020821204021.84283.qmail@web11301.mail.yahoo.com> I have to do a simple, not extremely secure GUI in tkinter requesting for users and their passwords. My question is what module should I use for encrypt passwords? it has to be a module availabe either in Windows Linux. Thanks, Max __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com From buc40@bemail.org Wed Aug 21 21:41:22 2002 From: buc40@bemail.org (S A) Date: Wed, 21 Aug 2002 13:41:22 -0700 Subject: Re[2]: [Tutor] Brett Thanx Message-ID: <200208212041.g7LKfMj29563@mail1.bigmailbox.com> > python Reply-To: python > "S A" CC: tutor@python.org, fromclay@maxitec.co.za > Re[2]: [Tutor] Brett ThanxDate: Wed, 21 Aug 2002 13:21:12 -0700 > >been writing python code for over a year now, thanks. > >brett Sorry. My message was for Morne. Did not mean to include youin the email. See below: Hi Brett Its Morne , I just wanna thank you for your helpand let you know that its not a school project "lol" I have done a Visual Basic cource and now I have a Job at a ISP and My boss wants me to get to know Unix Freebsd But he also wants me to get to know python, its a new line of job that im going into now and I raelly want to get to know more the only thing is that when i read from www.python page is that I cant seem to understand, I think I need to go over what parameters are and ......so on all the little thing that I dont know. Well Thanx again"and if you have any other good web page for me to look up :) God bless you and keep you happy >From Morne "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From dyoo@hkn.eecs.berkeley.edu Wed Aug 21 22:10:13 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 21 Aug 2002 14:10:13 -0700 (PDT) Subject: [Tutor] A little math and Python: Horner's rule In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C867@mbtlipnt02.btlabs.bt.co.uk> Message-ID: On Wed, 21 Aug 2002 alan.gauld@bt.com wrote: > > the constructs that I used to create in high school to feed my HP 15C > > calculator that uses an entry format called "reverse Polish notation" > > Sharing the nostalhgia - I couldn't afford an HP so used a 'Novus' > calculator that was also RPN based. I agree that once you got > used to it it was much faster and very powerful - parens > were hardly ever needed. > > Sadly my Novus did not last as long as your HP.... > > FWIW ISTR that the X windows calculator xcalc can accept a flag that > makes it into an HP clone complete with RPN. Or am I hallucinating again? > > Finally you might find it fun to play with Lisp/Scheme which > use a system similar to RPN called prefix notation: > > (* 3 4) => 12 > (+ 5 6 8) => 19 > (- 3 (+ 4 8)) => 9 > > Of course being Lisp(*) parens are everywhere. > > (*) LISP = Lots of Irrelevant Silly Parentheses... The parentheses are necessary because the operators in Lisp can take in more than two arguments as values. Your second example shows that, in Lisp, the addition function can take in multiple values --- not just two! If we force our language to only use binary operations, then the parentheses are superfluous, and we can say: * 3 4 ==> (* 3 4) + + 5 6 8 ==> (+ (+ 5 6) 8) - 3 + 4 8 ==> (- 3 (+ 4 8)) and with this restriction, LISP notation turns out to be exactly reversed reverse polish notation. *grin* I think this was called M-Expression syntax. We don't actually have to force every function to have binary arguments, but in order to disambiguate the parentheses, we need to put explicit restrictions on how many arguments a particular function takes in. See: http://www.not-compatible.org/LISP/QA/mexpr.html for more information. Gregory Chaitin uses a variation of this in his version of Lisp: http://www.cs.auckland.ac.nz/CDMTCS/chaitin/lm.html It might make an interesting project to write an RPN calculator in Python. From python Wed Aug 21 22:16:13 2002 From: python (python) Date: Wed, 21 Aug 2002 14:16:13 -0700 Subject: [Tutor] what module to use for encrypt passwords???? In-Reply-To: <20020821204021.84283.qmail@web11301.mail.yahoo.com> References: <20020821204021.84283.qmail@web11301.mail.yahoo.com> Message-ID: <110565537968.20020821141613@inkedmn.net> hello, there's the crypt module, but that's only for Unix... why not write your own encryption algorithm? how secure does this have to be? brett M> I have to do a simple, not extremely secure GUI in tkinter requesting M> for users and their passwords. My question is what module should I use M> for encrypt passwords? it has to be a module availabe either in Windows M> Linux. M> Thanks, M> Max M> __________________________________________________ M> Do You Yahoo!? M> HotJobs - Search Thousands of New Jobs M> http://www.hotjobs.com M> _______________________________________________ M> Tutor maillist - Tutor@python.org M> http://mail.python.org/mailman/listinfo/tutor From aschmidt@fredericksburg.com Wed Aug 21 22:24:59 2002 From: aschmidt@fredericksburg.com (Allen) Date: Wed, 21 Aug 2002 17:24:59 -0400 Subject: [Tutor] what module to use for encrypt passwords???? References: <20020821204021.84283.qmail@web11301.mail.yahoo.com> <110565537968.20020821141613@inkedmn.net> Message-ID: <011b01c24959$373ff2d0$9865fea9@starweb.freelancestar.com> I could use something like this, to. We use UBB for our forum and it uses $crypt in PHP to handle passwords. Now we want to use the user information in other areas of our site (data is in MySQL) to handle user logins. ----- Original Message ----- From: "python" To: "MIG" Cc: Sent: Wednesday, August 21, 2002 5:16 PM Subject: Re: [Tutor] what module to use for encrypt passwords???? > hello, > > there's the crypt module, but that's only for Unix... > > why not write your own encryption algorithm? how secure does this > have to be? > > brett > > M> I have to do a simple, not extremely secure GUI in tkinter requesting > M> for users and their passwords. My question is what module should I use > M> for encrypt passwords? it has to be a module availabe either in Windows > M> Linux. > > M> Thanks, > > > M> Max > > M> __________________________________________________ > M> Do You Yahoo!? > M> HotJobs - Search Thousands of New Jobs > M> http://www.hotjobs.com > > M> _______________________________________________ > M> Tutor maillist - Tutor@python.org > M> http://mail.python.org/mailman/listinfo/tutor > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From marta_andrea@libero.it Wed Aug 21 22:47:53 2002 From: marta_andrea@libero.it (Andrea Valle) Date: Wed, 21 Aug 2002 23:47:53 +0200 Subject: [Tutor] _init_ from manuals In-Reply-To: <3D5FEB8A.6080205@aon.at> Message-ID: Dear all, I am starting with classes. Sorry, maybe something obvious. Reading the html manual I copied this example: >>> class Complex: def _init_(self, realpart, imagpart): self.r=realpart self.i=imagpart >>> x=Complex(3.0,-4.5) But I obtained: Traceback (most recent call last): File "", line 1, in ? x=Complex(3.0,-4.5) TypeError: this constructor takes no arguments A similar behaviour (at least, to me) happens with the following example form a Python book. I copied: >>> class Vector: def _init_(self,a,b): self.a=a self.b=b def stampa(self): print self.a, self.b >>> v1=Vector(2,10) But obtained: Traceback (most recent call last): File "", line 1, in ? v1=Vector(2,10) TypeError: this constructor takes no arguments Any help is much appreciated. Thanks as usual -a- From rickp@telocity.com Wed Aug 21 23:30:48 2002 From: rickp@telocity.com (Rick Pasotto) Date: Wed, 21 Aug 2002 18:30:48 -0400 Subject: [Tutor] _init_ from manuals In-Reply-To: References: <3D5FEB8A.6080205@aon.at> Message-ID: <20020821223048.GL8720@tc.niof.net> On Wed, Aug 21, 2002 at 11:47:53PM +0200, Andrea Valle wrote: > Dear all, > I am starting with classes. Sorry, maybe something obvious. > Reading the html manual I copied this example: > > >>> class Complex: > def _init_(self, realpart, imagpart): > self.r=realpart > self.i=imagpart > > > >>> x=Complex(3.0,-4.5) > > But I obtained: > > Traceback (most recent call last): > File "", line 1, in ? > x=Complex(3.0,-4.5) > TypeError: this constructor takes no arguments The typography in books makes this difficult to see but there should be *two* underscores before and after 'init' so that should be def __init__(self, realpart, imagpart): rather than def _init_(self, realpart, imagpart): -- "Be regular and orderly in your life, that you may be violent and original in your work." -- Clive Barker Rick Pasotto rickp@telocity.com http://www.niof.net From amd@atlas.ucpel.tche.br Wed Aug 21 23:09:25 2002 From: amd@atlas.ucpel.tche.br (=?ISO-8859-1?Q?Aur=E9lio_Magalh=E3es_Dias?=) Date: Wed, 21 Aug 2002 19:09:25 -0300 (BRT) Subject: [Tutor] _init_ from manuals In-Reply-To: Message-ID: On Wed, 21 Aug 2002, Andrea Valle wrote: > Dear all, > I am starting with classes. Sorry, maybe something obvious. > Reading the html manual I copied this example: > > >>> class Complex: > =09def _init_(self, realpart, imagpart): The problem is that init has two underscores instead of one Aur=E9lio. From glingl@aon.at Wed Aug 21 23:31:23 2002 From: glingl@aon.at (Gregor Lingl) Date: Thu, 22 Aug 2002 00:31:23 +0200 Subject: [Tutor] _init_ from manuals References: Message-ID: <3D6414BB.5070501@aon.at> Andrea Valle schrieb: >Dear all, >I am starting with classes. Sorry, maybe something obvious. >Reading the html manual I copied this example: > > > >>>>class Complex: >>>> >>>> > def _init_(self, realpart, imagpart): > self.r=realpart > self.i=imagpart > > > > >>>>x=Complex(3.0,-4.5) >>>> >>>> > >But I obtained: > >Traceback (most recent call last): > File "", line 1, in ? > x=Complex(3.0,-4.5) >TypeError: this constructor takes no arguments > > >A similar behaviour (at least, to me) happens with the following example >form a Python book. I copied: > > >>>>class Vector: >>>> >>>> > def _init_(self,a,b): > self.a=a > self.b=b > def stampa(self): > print self.a, self.b > > > > >>>>v1=Vector(2,10) >>>> >>>> > >But obtained: > >Traceback (most recent call last): > File "", line 1, in ? > v1=Vector(2,10) >TypeError: this constructor takes no arguments > >Any help is much appreciated. >Thanks as usual > >-a- > > > >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > > > > This is because the constructor must have the name __init__(self, ...) with 2 underscores before and after the init. As the interpreter doesn't find such an __init__ it assumes the default-constructor recieving no arguments (and doing nothing). Therefore the error-message. Have a nice night! Gregor From glingl@aon.at Wed Aug 21 23:37:44 2002 From: glingl@aon.at (Gregor Lingl) Date: Thu, 22 Aug 2002 00:37:44 +0200 Subject: [Tutor] A little math and Python: rpn was: Horner's rule References: Message-ID: <3D641637.8020307@aon.at> Danny Yoo schrieb: > > >It might make an interesting project to write an RPN calculator in Python. > > Do you think of something like this: def firstopindex(l): for item in l: if item in ["+","-","*","/"]: return l.index(item) def rpn(inpstr, trace=0): return rpnr(inpstr.split(), trace) def rpnr(s, trace): if trace: print s if len(s) == 1: return s[0] i = firstopindex(s) return rpnr(s[:i-2]+[str(eval(s[i-2]+s[i]+s[i-1]))] + s[i+1:], trace) >>> rpn("1 2 3 4 5 6 + - + 100 * + +") '-397' >>> rpn("1 2 3 4 5 6 + - + 100 * + +", 1) ['1', '2', '3', '4', '5', '6', '+', '-', '+', '100', '*', '+', '+'] ['1', '2', '3', '4', '11', '-', '+', '100', '*', '+', '+'] ['1', '2', '3', '-7', '+', '100', '*', '+', '+'] ['1', '2', '-4', '100', '*', '+', '+'] ['1', '2', '-400', '+', '+'] ['1', '-398', '+'] ['-397'] '-397' quick and dirty late night divertimento! Gregor From marta_andrea@libero.it Wed Aug 21 23:45:42 2002 From: marta_andrea@libero.it (Andrea Valle) Date: Thu, 22 Aug 2002 00:45:42 +0200 Subject: R: [Tutor] _init_ from manuals In-Reply-To: Message-ID: Mmmpf! Thanks to all. Impossible to see. But possible to be specified in books. How to waste 1 hour and a half. best to all -a- From glingl@aon.at Thu Aug 22 00:20:45 2002 From: glingl@aon.at (Gregor Lingl) Date: Thu, 22 Aug 2002 01:20:45 +0200 Subject: [Tutor] A little math and Python: rpn was: Horner's rule References: <3D641637.8020307@aon.at> Message-ID: <3D64204D.4070901@aon.at> Gregor Lingl schrie > > def firstopindex(l): > for item in l: > if item in ["+","-","*","/"]: return l.index(item) > > def rpn(inpstr, trace=0): > return rpnr(inpstr.split(), trace) > > def rpnr(s, trace): > if trace: print s > if len(s) == 1: return s[0] > i = firstopindex(s) > return rpnr(s[:i-2]+[str(eval(s[i-2]+s[i]+s[i-1]))] + s[i+1:], trace) > > quick and dirty late night divertimento! > > Gregor > Suddenly I had the feeling: "What a fool I was!", because I didn't make use of the recursive nature of the stack which is built ba the rpn-calculator. I tried to find a better solution: def rpn(inpstr, trace=0): return rpnr(inpstr.split(), trace) def rpnr(lst, trace): if trace: print lst if len(lst) == 1: return lst[0] if lst[-2] in ["+", "-", "*", "/"]: return str( eval( lst[0] +lst[-1] + rpnr(lst[1:-1],trace)) ) else: return str( eval( rpnr(lst[:-2],trace) + lst[-1] + lst[-2]) ) >>> rpn(s,1) ['1', '2', '3', '*', '+'] ['2', '3', '*'] ['2'] '7' >>> rpn("1 2 3 4 5 6 + - + 100 * + +", 1) ['1', '2', '3', '4', '5', '6', '+', '-', '+', '100', '*', '+', '+'] ['2', '3', '4', '5', '6', '+', '-', '+', '100', '*', '+'] ['3', '4', '5', '6', '+', '-', '+', '100', '*'] ['3', '4', '5', '6', '+', '-', '+'] ['4', '5', '6', '+', '-'] ['5', '6', '+'] ['5'] '-397' >>> Now, I feel still not fully satisfied! But it's too late to continue now Best wishes, Gregor From glingl@aon.at Thu Aug 22 01:01:30 2002 From: glingl@aon.at (Gregor Lingl) Date: Thu, 22 Aug 2002 02:01:30 +0200 Subject: [Tutor] A little math and Python: rpn was: Horner's rule References: <3D641637.8020307@aon.at> <3D64204D.4070901@aon.at> Message-ID: <3D6429DA.5070007@aon.at> Gregor Lingl schrieb: > > I tried to find a better solution: > > def rpn(inpstr, trace=0): > return rpnr(inpstr.split(), trace) > > def rpnr(lst, trace): > if trace: print lst > if len(lst) == 1: return lst[0] > if lst[-2] in ["+", "-", "*", "/"]: > return str( eval( lst[0] +lst[-1] + rpnr(lst[1:-1],trace)) ) > else: > return str( eval( rpnr(lst[:-2],trace) + lst[-1] + lst[-2]) ) > Maybe this one is clearer: # evaluation of an rpn-string def rpn(inpstr, trace=0): return rpnr(inpstr.split(), trace) def rpnr(lst, trace): if trace: print lst if len(lst) == 1: return lst[0] if lst[-2] in ["+", "-", "*", "/"]: num1, num2, op = lst[0:1], lst[1:-1], lst[-1] else: num1, num2, op = lst[:-2], lst[-2:-1], lst[-1] return str(eval (rpnr(num1,trace) + op + rpnr(num2,trace)) ) From glingl@aon.at Thu Aug 22 02:07:31 2002 From: glingl@aon.at (Gregor Lingl) Date: Thu, 22 Aug 2002 03:07:31 +0200 Subject: [Tutor] A little math and Python: rpn References: <3D641637.8020307@aon.at> <3D64204D.4070901@aon.at> <3D6429DA.5070007@aon.at> Message-ID: <3D643953.2010700@aon.at> ... or would you prefer this approach? class RPN_Tree: def __init__(self, rpnlist): if len(rpnlist) == 1: self.node = rpnlist[0] self.left = None self.right = None else: self.node = rpnlist[-1] if rpnlist[-2] in ["+","-","*","/"]: self.left = RPN_Tree(rpnlist[0:1]) self.right = RPN_Tree(rpnlist[1:-1]) else: self.left = RPN_Tree(rpnlist[:-2]) self.right = RPN_Tree(rpnlist[-2:-1]) def evalTree(rpntree): if rpntree.node not in ["+","-","*","/"]: return rpntree.node else: return str(eval(evalTree(rpntree.left) + rpntree.node + evalTree(rpntree.right))) def rpn(st): return evalTree(RPN_Tree(st.split())) Gregor From buc40@bemail.org Thu Aug 22 02:26:28 2002 From: buc40@bemail.org (S A) Date: Wed, 21 Aug 2002 18:26:28 -0700 Subject: [Tutor] Here is the whole script I'm having issues with. Message-ID: <200208220126.g7M1QSx03932@mail11.bigmailbox.com> Hi Everyone- As promised, I would send the whole script I'm having trouble with to see if someone else can figure out what is going wrong here: import re import urllib, urllister import sys import os import StringIO import htmllib import formatter import string class Html: def __init__(self, address): self.address = address #connection def connect(self): sock = urllib.urlopen("http://" + address) #parse main doc def parser(self): parser = urllister.URLLister() parser.feed(self.sock.read()) parser.close() self.sock.close() #search main doc for story links def linkSearch(self): source = self.parser.urls link = r'''\/story\/0,\d+,6\d+,\d+,00\.html''' sch = re.findall(link, string.join(source)) sch = string.join(sch) return sch #compare story links to "news.fox" def compare(self): t = time.strftime("%j_%H%M%S_%Y", time.localtime()) folder_contents = os.listdir("/Users/montana/News/Fox/") l = len(folder_contents) for i in folder_contents: if i[-3:] == "fox": newsin = open("/Users/montana/News/Fox/"+i, "rb") newsfile = newsin.read() if self.sch != newsin: print "News is being updated ..." else: print "Nothing to update. Bye." exit newsout = open("/Users/montana/News/Fox/news"+t+".fox", "wb") newsout.write(self.sch) newsout.close() #from story links, download story files def stories(self): sch = string.split(self.sch) l = len(sch) for i in range(l): lsock = urllib.open(self.address + sch[i], "rb") links = lsock.read() lsock.close() return links output = open(sch[i].html, "wb") output.write(string.join(self.links)) output.close() class TextExtractor: def __init__(self, html, t): self.html = html self.t = t #search and crop text from html # def crop(self, start="", end=""): # story = '(?sx)%s.+%s' % (start, end) def crop(self): story = "(?sx)%s.+%s" % ("", "") newhtml = re.findall(story, self.html) #format text from html def text(self): data = StringIO.StringIO() fmt = formatter.AbstractFormatter(formatter.DumbWriter(data)) parser = htmllib.HTMLParser(fmt) parser.feed("".join(self.html)) text = data.getvalue() #save fromatted text to final file def finalSave(self): final = open(self.address + self.t + ".news", "ab") final.append(self.text) final.close() Any weird indenting is due solely to this email program. I went through the script already to check indentation. Ok. When importing this module in idle I get the following error: Python 2.2.1 (#1, 07/27/02, 23:05:03) [GCC Apple devkit-based CPP 6.02] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import update Traceback (most recent call last): File "", line 1, in ? File "update.py", line 63, in ? class TextExtractor: File "update.py", line 72, in TextExtractor newhtml = re.findall(story, self.html) NameError: name 'story' is not defined >>> I can't figure out why it is saying that story is not defined when it is clearly defined in the script. Any ideas? Sorry if this is long. Thanks. SA "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From cmhowe@patriot.net Thu Aug 22 03:45:32 2002 From: cmhowe@patriot.net (Charles M Howe) Date: Wed, 21 Aug 2002 22:45:32 -0400 Subject: [Tutor] Issuing Linux commands Message-ID: <3D64504C.9F8BD642@patriot.net> Is there a way to issue Linux commands -- ls, mkdir, mv, cp, mc, ..., from within python? Charles m Howe From buc40@bemail.org Thu Aug 22 03:38:11 2002 From: buc40@bemail.org (S A) Date: Wed, 21 Aug 2002 19:38:11 -0700 Subject: [Tutor] Issuing Linux commands Message-ID: <200208220238.g7M2cBs26899@mail12.bigmailbox.com> Try: import commands print commands.getoutput("ls") This will run the ls command and print it's output to your shell. I think this runs the commands through zsh? To see more: dir(commands) Then see what each part does by: help(commands."whatever") (substituting whatever for the class method of course. Hope this helps. SA > Charles M Howe tutor@python.org [Tutor] Issuing Linux commandsDate: Wed, 21 Aug 2002 22:45:32 -0400 > >Is there a way to issue Linux commands -- ls, mkdir, mv, cp, mc, ..., >from within python? > >Charles m Howe > > > >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From lists@shrestha.net.np Thu Aug 22 04:06:06 2002 From: lists@shrestha.net.np (Ashish Shrestha) Date: Thu, 22 Aug 2002 08:51:06 +0545 Subject: [Tutor] help References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C869@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <3D64551E.309@shrestha.net.np> alan.gauld@bt.com wrote: > You could shorten this code quite a bit by using a list or dictionary: > > options = {"1": ["Auto Sales", "Family Wagon, Immaculate condition"], > "2": [ "Service center", "Some other message/price"] > "5": [] > } > > Thus to add options you simply edit the options dictionary.... > > Then write: > > def view_options(): > for option in options.keys(): > print option, options[option][0] > return raw_input("Pick one") > > choice = view_options() > while choice != '5': > print options[choice][1] > choice = view_options() > print "Bye!" > > >>is there any way I could add things, and make them >>stay for the next time the program is run? > > > You bneed to look at file handling and how to write things to > a file. Then read the file back in when you start the program. > > The approach I describe above is ideal for this since you > can populate the options dictionary from the file at startup, > add items during running and then and write the whole dictionary > back out again at the end. > For saving the stuffs to the file, you can look at pickle module which may be simpler than working with your own file format! Ashish Shrestha jid: axhixh@jabber.org From pretiest80@yahoo.com Thu Aug 22 04:10:11 2002 From: pretiest80@yahoo.com (preety zinta) Date: Wed, 21 Aug 2002 20:10:11 -0700 (PDT) Subject: [Tutor] Please! Message-ID: <20020822031011.38429.qmail@web14810.mail.yahoo.com> --0-271808793-1029985811=:38209 Content-Type: text/plain; charset=us-ascii Please don't send anymore questions or mailling list to my inbox. Thank you! --------------------------------- Do You Yahoo!? HotJobs, a Yahoo! service - Search Thousands of New Jobs --0-271808793-1029985811=:38209 Content-Type: text/html; charset=us-ascii Please don't send anymore questions or mailling list to my inbox. Thank you!



Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs --0-271808793-1029985811=:38209-- From lists@shrestha.net.np Thu Aug 22 04:14:40 2002 From: lists@shrestha.net.np (Ashish Shrestha) Date: Thu, 22 Aug 2002 08:59:40 +0545 Subject: [Tutor] what module to use for encrypt passwords???? References: <20020821204021.84283.qmail@web11301.mail.yahoo.com> Message-ID: <3D645720.9000007@shrestha.net.np> since passwords only require one way function (that is you don't have to decrypt them) you can use md5 that is available in all platform. look at md5 module. org password ->md5 ->md5 digest of org password to test take the entered password -> md5 -> md5 of entered password then compare the md5 digests of these two! ashish shrestha From glingl@aon.at Thu Aug 22 07:57:02 2002 From: glingl@aon.at (Gregor Lingl) Date: Thu, 22 Aug 2002 08:57:02 +0200 Subject: [Tutor] A little math and Python: rpn - my last one References: <3D641637.8020307@aon.at> <3D64204D.4070901@aon.at> <3D6429DA.5070007@aon.at> <3D643953.2010700@aon.at> Message-ID: <3D648B3E.8050300@aon.at> my last version, this time a practical calculator: >>> def rpn(): stack=[] while 1: item = raw_input("> ") if item in ["+","-","*","/"]: res=str(eval(stack[-2]+item+stack[-1])) print res stack[-2:]=[res] elif item == "": break else: stack.append(item) >>> rpn() > 3 > 4 > + 7 > 6 > + 13 > 12 > * 156 > 6 > / 26.0 > >>> Thanks for your patience Gregor P.S.: Do you still think, Danny was right, when he wrote It might make an interesting project to write an RPN calculator in Python. From buc40@bemail.org Thu Aug 22 07:09:26 2002 From: buc40@bemail.org (S A) Date: Wed, 21 Aug 2002 23:09:26 -0700 Subject: [Tutor] Issuing Linux commands Message-ID: <200208220609.g7M69QA12372@mail21.bigmailbox.com> My Bad. Try: import os os.system("ls") Good Luck. SA "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From valdas.jonikas@if.lt Thu Aug 22 09:22:24 2002 From: valdas.jonikas@if.lt (Valdas Jonikas) Date: Thu, 22 Aug 2002 09:22:24 +0100 Subject: [Tutor] How to copy files from one directory to another? Message-ID: <9CA5BE43F9BD694FB63CC81CF75B0BBA1B2472@mariner.sampo.vlan> TWFueSB0aGFua3MsIGl0IHdvcmtzIDopDQoNClZhbGRhcw0KDQoNCj4gLS0tLS1PcmlnaW5hbCBN ZXNzYWdlLS0tLS0NCj4gRnJvbTogRG9uIEFybm9sZCBbbWFpbHRvOmRhcm5vbGQwMkBzcHJ5bmV0 LmNvbV0NCj4gU2VudDogV2VkbmVzZGF5LCBBdWd1c3QgMjEsIDIwMDIgMTI6MTggUE0NCj4gVG86 IFZhbGRhcyBKb25pa2FzOyBQeXRob24gVHV0b3IgKEUtbWFpbCkNCj4gU3ViamVjdDogUmU6IFtU dXRvcl0gSG93IHRvIGNvcHkgZmlsZXMgZnJvbSBvbmUgZGlyZWN0b3J5IHRvIGFub3RoZXI/DQo+ IA0KPiANCj4gSWYgeW91IGludGVuZCB0byBqdXN0IG1vdmUgZmlsZXMgZnJvbSAxIGRpcmVjdG9y eSB0byBhbm90aGVyIA0KPiBpbnN0ZWFkIG9mDQo+IGFjdHVhbGx5IGNvcHlpbmcgdGhlbSwgb3Mu cmVuYW1lKCApIHdvcmtzLCBhbHNvLg0KPiANCj4gRG9uDQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNz YWdlLS0tLS0NCj4gRnJvbTogUyBBIFttYWlsdG86YnVjNDBAYmVtYWlsLm9yZ10NCj4gU2VudDog V2VkbmVzZGF5LCBBdWd1c3QgMjEsIDIwMDIgMTA6MjAgQU0NC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mlsZXMgZnJvbSBvbmUgZGlyZWN0 b3J5IHRvIGFub3RoZXI/DQo+IA0KPiANCj4gPiBIaSBhbGwsDQo+ID4NCj4gPiBDb3VsZCB5b3Ug cGxlYXNlIGFkdmlzZSBob3cgdG8gY29weQ0KPiA+IGZpbGVbc10gZnJvbSBvbmUgZGlyZWN0b3J5 IHRvIGFub3RoZXINCj4gPiB3aXRoIFB5dGhvbi4gKHdpbjJrIHBsYXRmb3JtKQ0KPiA+DQo+ID4g VE5YLA0KPiA+IFZhbGRhcw0KPiA+IE5m666WWDsaIX8gZg8gailman8gYj8gaA0KPiANCj4gDQo+ IA0K From lonetwin@yahoo.com Thu Aug 22 09:45:17 2002 From: lonetwin@yahoo.com (lonetwin) Date: Thu, 22 Aug 2002 14:15:17 +0530 Subject: [Tutor] Embedding C Message-ID: <20020822084518.AE6842F415@mercury.sapatmt> Greeting all ye gentle Pythoneers, Almost a year after I first touched Python, I fell am now ready to dabble in experiments with emmbedding C in Python (I assume that is how one describes the task of using/calling C functions through Python). However, before I do this, I thought I'd drop by and ask a few questions. You see although I do (or did -- waaay back) know how to program in C, I am a bit apprehensive to start with the official Python Documentation on the topic (although I intend to do it eventually). I would really appreciate it if someone could either point me to a resource to or give me a small example of calling C functions through Python. like for example passing "Hello World !" to a print_this() function from a hello.c file. ....I guess Usless Python too could make use of such small examples. Peace Steve -- What does education often do? It makes a straight cut ditch of a free meandering brook. -- Henry David Thoreau From glide@slingshot.co.nz Thu Aug 22 10:44:26 2002 From: glide@slingshot.co.nz (Graeme Andrew) Date: Thu, 22 Aug 2002 21:44:26 +1200 Subject: [Tutor] Python Multilingual Requirement Message-ID: <006601c249c0$97cc6ae0$4063b4ca@graeme> Hi All, First thanks to those who helped me out with my Tkinter Class problems, I now have a reasonably reusable user interface. (Phew !! ... I'm slowly climbing that Python learning curve ) I was wondering who out there has written 'Multilingual' python scripts with TKinter as the GUI interface ? I need to be able to display both chinese and english versions of my screens and would like this to be available at runtime ....any ideas on a good way to achieve this ? Mank thanks Regards Graeme Andrew New Zealand From alan.gauld@bt.com Thu Aug 22 12:04:16 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 22 Aug 2002 12:04:16 +0100 Subject: Re[2]: [Tutor] write to a file in linux (again)! Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C86D@mbtlipnt02.btlabs.bt.co.uk> > python will only create files for you, not directories (unless you use > os.mkdir() <-- i think that's what it's called). I suspect he wants os.mkdirs() mkdir makes one directory. mkdirs creates a full path. os.mkdirs("/a/b/c") creates a,b and c directories. os.mkdir("/a/b/c") generates an error unless /a/b already exists. Of course there is a potential for some really strange paths to be created accidentally, but in this case it seems safe.... Alan G. From alan.gauld@bt.com Thu Aug 22 13:45:21 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 22 Aug 2002 13:45:21 +0100 Subject: [Tutor] what module to use for encrypt passwords???? Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C86E@mbtlipnt02.btlabs.bt.co.uk> > I have to do a simple, not extremely secure GUI in tkinter requesting > for users and their passwords. My question is what module should I use > for encrypt passwords? it has to be a module availabe either > in Windows & Linux. It depends on what these are for. If you want to actually access the user ID and password for the OS then trying to write a portable solution will be "challenging". The passwords are stored in different places, in different formats and without a standard API. If OTOH you only want to implement user security for your own applications then its relatively easy to do. Simply find a crypt() function. Store the encrypted password in a file somewhere. Next time the user enters their password encrypt it and compare the two encrypted forms. If they are the same then the user gets access. There are lots of encrypting functions you can use depending on the level of security. One of thec simplest(and least secure!) is to shift the bits of the characters circularly by N(often 3) bits. Not secure but easy to implement and portable over ASCII/UTF-8 systems. OTOH if you want full security you might have to write a wrapper around the native OS crypt() functions. But be aware that these are not portable across platforms. indeed they may not even be portable on the same platform across countries since many places have limits on the allowed strength of encryption (don't want to make it too hard for the feds to crack the code, do we?! :-) HTH, Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Thu Aug 22 13:47:23 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 22 Aug 2002 13:47:23 +0100 Subject: [Tutor] _init_ from manuals Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C86F@mbtlipnt02.btlabs.bt.co.uk> > >>> class Complex: > def _init_(self, realpart, imagpart): Thats 2 underscores on each side: __init__() not _init_() Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Thu Aug 22 13:53:52 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 22 Aug 2002 13:53:52 +0100 Subject: [Tutor] Here is the whole script I'm having issues with. Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C870@mbtlipnt02.btlabs.bt.co.uk> > class Html: > def __init__(self, address): > self.address = address > #connection > def connect(self): > sock = urllib.urlopen("http://" + address) I'll assume the missing indentation is a fluke of your mailer or something.... You are assigning to 'sock' but its local to the method. If you want sock to be available within the objkect you must assign to self.sock > def parser(self): > parser = urllister.URLLister() > parser.feed(self.sock.read()) > parser.close() > self.sock.close() Which you correctly use here, but have never assigned(ie created!) However you also assign to parser which again is local to the method. You should use self.parser. > def linkSearch(self): > source = self.parser.urls You access it here but it doesnt exist... I'll go back and look at the actual error you get but I thought this was worth pointing out separately. Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Thu Aug 22 14:02:11 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 22 Aug 2002 14:02:11 +0100 Subject: [Tutor] Here is the whole script I'm having issues with. Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C871@mbtlipnt02.btlabs.bt.co.uk> > class TextExtractor: > def __init__(self, html, t): ... > def crop(self): > story = "(?sx)%s.+%s" % ("", "") > newhtml = re.findall(story, self.html) > Any weird indenting is due solely to this email program. I > went through the script already to check indentation. Ok. OK, I'll take your word for it. > When importing this module in idle I get the following error: > >>> import update > Traceback (most recent call last): > File "", line 1, in ? > File "update.py", line 63, in ? > class TextExtractor: > File "update.py", line 72, in TextExtractor > newhtml = re.findall(story, self.html) > NameError: name 'story' is not defined I don't understand it either but since storty is a local variable why not try putting the string directly into the findall() and see if it works: def crop(self): newhtml = re.findall("(?sx)%s.+%s" % ("", ""), self.html) It might throw up something extra? Or even work! :-) Alan g. From ajs@ix.netcom.com Thu Aug 22 14:41:11 2002 From: ajs@ix.netcom.com (Arthur) Date: Thu, 22 Aug 2002 09:41:11 -0400 Subject: [Tutor] Error handling resource needed References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C871@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <018201c249e1$943118b0$9865fea9@arthur> I am looking for some tutorial level, but hopefully fairly thorough resource on exception handling in Python. Surprisingly hard to dig up. Have the 1200 page book Programming Python, e.g., which surprisingly has next to nothing on the subject - at least that I can locate. Tips appreciated. Art From scot@possum.in-berlin.de Thu Aug 22 16:00:59 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Thu, 22 Aug 2002 17:00:59 +0200 Subject: [Tutor] A little math and Python: rpn - my last one In-Reply-To: <3D648B3E.8050300@aon.at> References: <3D643953.2010700@aon.at> <3D648B3E.8050300@aon.at> Message-ID: <200208221700.59832.scot@possum.in-berlin.de> Hello Gregor, > my last version, this time a practical calculator: /Herrlich!/. I wonder if it might be better to go back to one of your earlier versions, the one with the class, tho, because after playing around with my calculator for a while I remembered all kinds of other cute features I'd forgotten that might work better as methods: 1. The stack has a limited size, and when an entry hits the top slot, the value will keep cascading down - uh, I'm not explaining this very well, am I - what I mean is that if you do 234 ENTER ENTER ENTER you can then just keep hitting '+' and it keeps adding 234 to the value. 2. There is a "Last X" register that lets you do clever things by recalling the value of the accumulator (or X register or what it is called) before the last operation. 3. The "R arrow down key" will rotate thru the stack 4. The "x<>y" key will let you exchange the X and Y registers, in other words, the last item in the stack and the one above it. Yes, this is all icing, I know. But it was fun to have =8). Unfortunately, I'm going to be away from my computer for a few days, but I'll see if I can come up with some real code suggestions anyway... Y, Scot -- Scot W. Stevenson wrote me on Thursday, 22. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1573 hours and has a CPU that is falling asleep at a system load of 0.04. From scot@possum.in-berlin.de Thu Aug 22 15:52:55 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Thu, 22 Aug 2002 16:52:55 +0200 Subject: [Tutor] Error handling resource needed In-Reply-To: <018201c249e1$943118b0$9865fea9@arthur> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C871@mbtlipnt02.btlabs.bt.co.uk> <018201c249e1$943118b0$9865fea9@arthur> Message-ID: <200208221652.55057.scot@possum.in-berlin.de> Hello Arthur, > Have the 1200 page book Programming Python, e.g., > which surprisingly has next to nothing on the subject - > at least that I can locate. O'Reilly talks about exceptions in the companion book "Learning Python" (Mark Lutz and David Ascher) in Chapter 7 starting on page 194, which is probably why their "Programming Python" doesn't have too much on it. Note both books are somewhat dated by now, "Learning" slightly less so because the core toolset isn't changing quite as fast. Unless, of course, it happens to involve division. Or list comprehension. Or generators. Or - Anyway, if you want to stick with O'Reilly, there is new book out called the "Python Cookbook" (Alex Martelli and David Ascher), which I am reading a few pages a day on public transport. It has some very good explanations of how to use exceptions using the "Easier to Ask Forgiveness than Permission" (EAFP) approach that I hadn't seen anywhere else so far, but of course it is not a systematic introduction. You'd have to hunt and peck thru the examples. [Note: I'm not far enough into the book to feel comfortable enough to recommend it to anybody yet (all cliches aside, Berlin public transport is terribly efficient), but the 36 pages I have read so far have been very enlightening on many things Pythonic, and of course it includes all too rare examples of commented Python 2.2 code. Looks like a good one so far.] Y, Scot -- Scot W. Stevenson wrote me on Thursday, 22. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1573 hours and has a CPU that is falling asleep at a system load of 0.01. From alan.gauld@bt.com Thu Aug 22 16:28:09 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 22 Aug 2002 16:28:09 +0100 Subject: [Tutor] Issuing Linux commands Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C873@mbtlipnt02.btlabs.bt.co.uk> > Is there a way to issue Linux commands -- ls, mkdir, mv, cp, mc, ..., > from within python? You can use the os.system() call or the popen() functions or the commands module. All of these execute the command as a separate process. However things like mkdir, mv, cp etc are often better done within a script using Python equivalent commands. (Better => faster, less memory etc) See the documentation for: glob os os.path for many common commands that exist as Python functions. Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Thu Aug 22 16:34:48 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Thu, 22 Aug 2002 16:34:48 +0100 Subject: [Tutor] Error handling resource needed Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C874@mbtlipnt02.btlabs.bt.co.uk> > I am looking for some tutorial level, but hopefully fairly > thorough resource on exception handling in Python. My tutor has "Tutorial level" but doesn't really cover things like creating your own exception classes very much. Equally it doesn't cover use of the traceback module which might be considered part of exception handling. It does show how to use exceptions both responding to them and generating them. Also how to escalate them through the code stack levels. Might do as a start... Once you've covered that, if you have specific questions why not ask here? Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From csmith@blakeschool.org Thu Aug 22 17:05:03 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Thu, 22 Aug 2002 11:05:03 -0500 Subject: [Tutor] Re: reverse a number (was no subject) Message-ID: >--On Friday, August 9, 2002 5:39 PM +0530 Anand Ramakrishna > wrote: >> I am having a strange problem with my python code for reversing a >> number. I tried it on a few combinations and works fine with most of >them >> except when the number starts in '1'. If I give input as 123 it reverses >> and displays as 442. If I give input as 12 it reverses and displays as >> 12. Where as if I give any other number, it reverses properly and >> displays the correct result. The code is pasted below. > >I don't know what's wrong with the math in your attempt. I didn't try to >figure it out, as it sounds like this problem is more easily solved using >strings: > > > >print 'This program accepts a number and then reverses it' ># The int() here may be unneccessary as we convert back to a string next, ># but it does help remove nondigits and leading zeroes. >number = int(raw_input("Enter a number = ")) > >numString = str(number) > ># There's probably a more clever way to do this part. How about converting the number to a list and then reversing the elements now: m=list(str(int(number))) m.reverse() numString=''.join(m) #this is your reversed number as a string > >newnumString = '' >for n in numString: > newnumString = n + newnumString > >newnum = int(newnumString) >print 'The reversed number is ', newnum From shalehperry@attbi.com Thu Aug 22 17:21:00 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Thu, 22 Aug 2002 09:21:00 -0700 Subject: [Tutor] Re: reverse a number (was no subject) In-Reply-To: References: Message-ID: <200208220921.01004.shalehperry@attbi.com> On Thursday 22 August 2002 09:05 am, Christopher Smith wrote: > ># There's probably a more clever way to do this part. > > How about converting the number to a list and then reversing the elemen= ts > now: > > =09m=3Dlist(str(int(number))) > =09m.reverse() > =09numString=3D''.join(m) #this is your reversed number as a string > or the old school C way (-: >>> l =3D [] >>> n =3D 321 >>> while n: =2E.. l.append(n % 10) =2E.. n /=3D 10 =2E..=20 >>> l [1, 2, 3] From kavinmehta@softhome.net Thu Aug 22 17:53:05 2002 From: kavinmehta@softhome.net (kavinmehta@softhome.net) Date: Thu, 22 Aug 2002 10:53:05 -0600 Subject: [Tutor] unsubscribe me Message-ID: plz remove me from the mailing list thamking you From terjeja@hotmail.com Thu Aug 22 19:26:25 2002 From: terjeja@hotmail.com (Terje Johan Abrahamsen) Date: Thu, 22 Aug 2002 18:26:25 +0000 Subject: [Tutor] wxPython crash Message-ID: I have installed the wxPython with my Activestate Python. Then I look in the documentation to learn it. When I try the first example: from wxPython.wx import * class MyApp(wxApp): def OnInit(self): frame = wxFrame(NULL, -1, "Hello from wxPython") frame.Show(true) self.SetTopWindow(frame) return true app = MyApp(0) app.MainLoop() Python just closes. No warnings, no errors, no nothing. It just closes. However, if I remove the "app = MyApp(0)" line, I get just an exception raised, so I assume that that must be where the problem is. What can this be caused by? _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com From buc40@bemail.org Thu Aug 22 20:49:45 2002 From: buc40@bemail.org (S A) Date: Thu, 22 Aug 2002 12:49:45 -0700 Subject: [Tutor] Here is the whole script I'm having issues with. Message-ID: <200208221949.g7MJnjY25860@mail8.bigmailbox.com> Ok. I was wrong. Actually, bbedit let me down. All the indentation looked correct when I loaded the file in bbedit. However, a quick chek with vi showed that the indentation was indeed off on the line story. I fixed it and now the classes load. > >> class Html: >> def __init__(self, address): >> self.address = address >> #connection >> def connect(self): >> sock = urllib.urlopen("http://" + address) > >I'll assume the missing indentation is a fluke of your >mailer or something.... > >You are assigning to 'sock' but its local to the method. >If you want sock to be available within the objkect you >must assign to self.sock Yes. I thought this might leave the class alittle more versatile for future use. With another script I make an instance; x = Html("some address here") Then I can just run: x.connect() afterwards and the connect method runs. Actually, If I run an instance of the las method in the class, all of the methods in the class are run. So if I add self to the method variables as you suggest and run: x = Html("some address here") Will the whole class run straight through? This may be simpler than what I was doing. Also, now that I have re-edited the script, would it be Ok to post for everyone to check out? Is anyone even interested in this script? Thanks. SA "I can do everything on my Mac that I used to do on my PC, plus alot more ..." -Me ------------------------------------------------------------ Free, BeOS-friendly email accounts: http://BeMail.org/ BeOS News and Community: http://www.BeGroovy.com/ --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com --------------------------------------------------------------------- From purplebo@babylonia.flatirons.org Thu Aug 22 22:34:32 2002 From: purplebo@babylonia.flatirons.org (Chris Avery) Date: Thu, 22 Aug 2002 15:34:32 -0600 Subject: [Tutor] Checking file existance Message-ID: <20020822153432.A17731@babylonia.flatirons.org> Hello all. I need to write some code that checks if a file exists. If it exists, the program continues, but if it doesn't, it get's created. I'm thinking of an if statement like if file exists: run rest of program else: create file. I just don't know how to check if the file's there. Regards, Chris -- +++++++++++++++++++ Chris Avery, KC0KTH +++++++++++++++++++ From rob@uselesspython.com Thu Aug 22 22:40:48 2002 From: rob@uselesspython.com (Rob) Date: Thu, 22 Aug 2002 16:40:48 -0500 Subject: [Tutor] Checking file existance In-Reply-To: <20020822153432.A17731@babylonia.flatirons.org> Message-ID: Take a look at the os module and os.path in the Python docs. Rob > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > Chris Avery > Sent: Thursday, August 22, 2002 4:35 PM > To: tutor@python.org > Subject: [Tutor] Checking file existance > > > Hello all. > I need to write some code that checks if a file exists. If it > exists, the program continues, but if it doesn't, it get's > created. I'm thinking of an if statement like > if file exists: > run rest of program > else: > create file. > > I just don't know how to check if the file's there. > > Regards, > Chris > -- > +++++++++++++++++++ > Chris Avery, KC0KTH > +++++++++++++++++++ > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From shalehperry@attbi.com Thu Aug 22 22:38:48 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Thu, 22 Aug 2002 14:38:48 -0700 Subject: [Tutor] Checking file existance In-Reply-To: <20020822153432.A17731@babylonia.flatirons.org> References: <20020822153432.A17731@babylonia.flatirons.org> Message-ID: <200208221438.48290.shalehperry@attbi.com> On Thursday 22 August 2002 02:34 pm, Chris Avery wrote: > Hello all. > I need to write some code that checks if a file exists. If it exists, = the > program continues, but if it doesn't, it get's created. I'm thinking o= f an > if statement like if file exists: > =09run rest of program > else: > =09create file. > > I just don't know how to check if the file's there. > > Regards, > Chris import os.path if os.path.exists(filename): print "found it" look at the docs for os.path there are a lot of useful functions in there= =2E From tescoil@ilbbs.com Fri Aug 23 02:03:18 2002 From: tescoil@ilbbs.com (Tesla Coil) Date: Thu, 22 Aug 2002 20:03:18 -0500 Subject: [Tutor] Card Tricks! Message-ID: <3D6589D6.640CBB45@ilbbs.com> Requires: http://gurno.com/adam/cards Last entry in the changelog is 6.30.2000, and comment in the "war" demo regards an uncorrected bug -- one of those pre-Useless Python examples of "no one expects to find it scattered off on your URL anyway." Whatta shame, it has so much Useless potential. One such problem here, but each attempt I've made at it slams into one or another index error. At this point, I'd be pleased to see something that *begins* to work: #!/usr/bin/python # AccSov.py - Solve Accordian solitaire, or, # give it a good whack anyhow. # # All cards are dealt to a single list. # # Cards may be moved to delete the card one or three # positions to the left only if the same rank or suit. # # Objective is to reduce the list to a single card. import cards def Spread(): deck = cards.card_deck() deck.populate() deck.shuffle() accordian = deck.deal(1, 52) return accordian[0] acc = Spread() From dylan.belsey@baesystems.com Fri Aug 23 01:07:04 2002 From: dylan.belsey@baesystems.com (BELSEY, Dylan) Date: Fri, 23 Aug 2002 09:37:04 +0930 Subject: FW: [Tutor] Error handling resource needed Message-ID: <86C3892A0C52D411AF5000A0C9EAA3B96320F4@wtntex1.baea.com.au> -----Original Message----- From: BELSEY, Dylan Sent: Friday, 23 August 2002 10:01 To: 'Arthur' Subject: RE: [Tutor] Error handling resource needed www.python.org/doc/tut/node10.html www.python.org/doc/lib/module-exceptions.html -----Original Message----- From: Arthur [mailto:ajs@ix.netcom.com] Sent: Thursday, 22 August 2002 23:41 To: tutor@python.org Subject: [Tutor] Error handling resource needed I am looking for some tutorial level, but hopefully fairly thorough resource on exception handling in Python. Surprisingly hard to dig up. Have the 1200 page book Programming Python, e.g., which surprisingly has next to nothing on the subject - at least that I can locate. Tips appreciated. Art _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From dman@dman.ddts.net Fri Aug 23 03:21:31 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Thu, 22 Aug 2002 22:21:31 -0400 Subject: [Tutor] Re: IOError exception handling In-Reply-To: References: Message-ID: <20020823022131.GC2054@dman.ddts.net> --gr/z0/N6AeWAPJVB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jul 28, 2002 at 04:33:22PM -0700, Allyn Weaks wrote: | Python 2.1 until I can get 2.2.1 installed properly (linux 7.1), but Linux is only at version 2.5. if you follow Linus' development work. | Can one get a more detailed error back than IOError? I'm counting | lines in files that may or may not exist, and if one doesn't exist, I | can set the number of lines to zero and continue with the rest. But, | if the file can't be opened because of any other problem, such as a | permission error, I want it to bail with whatever error message is | appropriate (preferably without handling each and every case.) Use os.path.exists() to first query the existance of a file. Then only attempt to open it if it exists. HTH, -D --=20 The crucible for silver and the furnace for gold, but the Lord tests the heart. Proverbs 17:3 =20 http://dman.ddts.net/~dman/ --gr/z0/N6AeWAPJVB Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1lnCsACgkQO8l8XBKTpRRg2wCfRy/wIes+B9ceTpJQjYqV9Kjw SxcAoJCBRk7NbrKLoz5zC0dXSOCTGrop =xXxN -----END PGP SIGNATURE----- --gr/z0/N6AeWAPJVB-- From dman@dman.ddts.net Fri Aug 23 03:20:04 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Thu, 22 Aug 2002 22:20:04 -0400 Subject: [Tutor] Re: A few comparative perl/python questions In-Reply-To: <20020728221532.915536D9EF@www.fastmail.fm> References: <20020728221532.915536D9EF@www.fastmail.fm> Message-ID: <20020823022004.GB2054@dman.ddts.net> --IrhDeMKUP4DT/M7F Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jul 28, 2002 at 10:15:32PM +0000, Kyle Babich wrote: | I just have a few Perl-to-Python questions: |=20 | Does python have anything like Perl's || die Yeah, just don't catch the exception and python will "die" (after printing out the stack trace). You don't need to do anything special to die after an error. | flock(), or seek() | functions?=20 Yes -- these are actually part of the libc on your system. The seek() is a method on file objects. I'm not sure where flock() is, but I'm quite sure it is available (on systems where it exists). The alternative to flock() is fctl(). On some systems the two locks are independent, and on others they are the same lock. File locking is quite a mess, really. | (What are they?) seek() lets you move the current position in a file. flock() attempts to acquire an *advisory* lock on the file. I emphasize 'advisory' because it doesn't prevent a malicious or otherwise misbehaving program from manipulating the file. | If Python doesn't have something like flock(), what happens what | multiple scripts are trying to write to one file at the same time? The same thing that happens with it :-). If a program, say 'cat', doesn't attempt to flock() the file first, or if it ignores it when it isn't given a lock, then you have an nice race condition and the results are quite unpredictable. -D --=20 You have heard the saying that if you put a thousand monkeys in a room with= a thousand typewriters and waited long enough, eventually you would have a ro= om full of dead monkeys. (Scott Adams - The Dilbert principle) =20 http://dman.ddts.net/~dman/ --IrhDeMKUP4DT/M7F Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1lm9QACgkQO8l8XBKTpRRmygCfdKPvsSXw8u4SVxHkuFyNd3bK r/4AnRA4f5cB5gvvsi+nMk2EwulURIB4 =z8MM -----END PGP SIGNATURE----- --IrhDeMKUP4DT/M7F-- From dman@dman.ddts.net Fri Aug 23 03:06:01 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Thu, 22 Aug 2002 22:06:01 -0400 Subject: [Tutor] Re: wxPython crash In-Reply-To: References: Message-ID: <20020823020601.GA2054@dman.ddts.net> --SLDf9lqlvOQaIe6s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 22, 2002 at 06:26:25PM +0000, Terje Johan Abrahamsen wrote: | I have installed the wxPython with my Activestate Python. Then I look in= =20 | the documentation to learn it. When I try the first example: |=20 | from wxPython.wx import * |=20 | class MyApp(wxApp): | def OnInit(self): | frame =3D wxFrame(NULL, -1, "Hello from wxPython") | frame.Show(true) | self.SetTopWindow(frame) | return true |=20 | app =3D MyApp(0) | app.MainLoop() This works for me. (Python 2.1 and wxGTK/wxPython 2.2 on Debian) | Python just closes. No warnings, no errors, no nothing. It just closes.= =20 | However, if I remove the "app =3D MyApp(0)" line, I get just an exception= =20 | raised, so I assume that that must be where the problem is. What can this= =20 | be caused by? Could be a problem with your system -- were python, wxwindows, and wxpython all compiled with the same compiler and linked against the same versions of shared libraries? What sort of system are you using? If it's a unix system, does running 'ulimit -c unlimited' beforehand cause a core dump to be generated? HTH, -D --=20 Better a little with righteousness than much gain with injustice. Proverbs 16:8 =20 http://dman.ddts.net/~dman/ --SLDf9lqlvOQaIe6s Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1lmIkACgkQO8l8XBKTpRRdYQCfZFM7O2cWf2HY6LRzaaeuVIs9 r+wAmwe78v01RQTfSyHaPwAMXRRI7qtv =mAzl -----END PGP SIGNATURE----- --SLDf9lqlvOQaIe6s-- From dylan.belsey@baesystems.com Fri Aug 23 00:39:15 2002 From: dylan.belsey@baesystems.com (BELSEY, Dylan) Date: Fri, 23 Aug 2002 09:09:15 +0930 Subject: [Tutor] Embedding C Message-ID: <86C3892A0C52D411AF5000A0C9EAA3B96320F2@wtntex1.baea.com.au> Hi, I have been dabbling a bit in this field trying to embed the python interpreter in C++ and then calling back into C++ functions from the python interpreter (commonly called extending). You may want to look up SWIG (on Google), a very handy tool for building interfaces between the two languages (it was purpose built initially for C and now accommodates quite a bit of C++). There is quite a bit of info about (again recommend searching google) and in the python docs. I found this link very useful after I understood some of the concepts. It initially talks about embedding but then goes on to describe building extension modules: http://www.faqts.com/knowledge_base/view.phtml/aid/5325/fid/245 The book "Professional Linux Programming - Neil Matthew and Richard Stones et al.", Chapter 17 is also a source I used, although it can get heavy going (for me that is), as you read further. HTH Dylan -----Original Message----- From: lonetwin [mailto:lonetwin@yahoo.com] Sent: Thursday, 22 August 2002 18:45 To: tutor@python.org Subject: [Tutor] Embedding C Greeting all ye gentle Pythoneers, Almost a year after I first touched Python, I fell am now ready to dabble in experiments with emmbedding C in Python (I assume that is how one describes the task of using/calling C functions through Python). However, before I do this, I thought I'd drop by and ask a few questions. You see although I do (or did -- waaay back) know how to program in C, I am a bit apprehensive to start with the official Python Documentation on the topic (although I intend to do it eventually). I would really appreciate it if someone could either point me to a resource to or give me a small example of calling C functions through Python. like for example passing "Hello World !" to a print_this() function from a hello.c file. ....I guess Usless Python too could make use of such small examples. Peace Steve -- What does education often do? It makes a straight cut ditch of a free meandering brook. -- Henry David Thoreau _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From dman@dman.ddts.net Fri Aug 23 03:34:48 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Thu, 22 Aug 2002 22:34:48 -0400 Subject: ***SA:06.40*** [Tutor] How secure is the mail module? In-Reply-To: <200208181456.g7IEu9O08168@mail22.bigmailbox.com> References: <200208181456.g7IEu9O08168@mail22.bigmailbox.com> Message-ID: <20020823023448.GD2054@dman.ddts.net> --fOHHtNG4YXGJ0yqR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 18, 2002 at 07:56:09AM -0700, S A wrote: | Hi Everyone- |=20 | Does anyone know how secure the mail Module is when sending | usernames and passwords to mail servers? Same as anything else. | Is it just sending plain text? Yep. Read the RFC(s) that detail the AUTH extension to ESMTP for the details. There are 3 methods -- PLAIN, LOGIN, CRAM-MD5. For PLAIN, take the username and password, separate them with a NUL character and base64-encode the data. base64 encoding is easily reversible. For LOGIN there is a "chat" sequence whereby the server sends a prompt and the client sends the data. It is more-or-less plain text (it might be base64 encoded, but I don't know for sure). CRAM-MD5 is the most secure because the server sends a one-time "cookie" which the client combines with the username/password and sends only the md5 hash of that combination back to the server. md5 is a one-way operation (unlike base64). The server does the same combination and compares its result. The problem with this method is the server must have access to the password in cleartext (in particular no md5-crypted shadow passwords or PAM). | Is there a way to make sure data is being securely sent to the mail | server? You can use the CRAM-MD5 AUTH method, if you set up the server to handle it (with the downsides it introduces). Alternatively you can use SSL or "STARTTLS", if you set up the server to handle it. -D --=20 He who walks with the wise grows wise, but a companion of fools suffers harm. Proverbs 13:20 =20 http://dman.ddts.net/~dman/ --fOHHtNG4YXGJ0yqR Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1ln0gACgkQO8l8XBKTpRS3TQCfU3CbkpSYCm/sOcZespJm07Bt Ei8AnAom9bQaRvKp7+hEMi3w1+b7cscZ =KxwX -----END PGP SIGNATURE----- --fOHHtNG4YXGJ0yqR-- From dylan.belsey@baesystems.com Fri Aug 23 01:14:13 2002 From: dylan.belsey@baesystems.com (BELSEY, Dylan) Date: Fri, 23 Aug 2002 09:44:13 +0930 Subject: [Tutor] wxPython crash Message-ID: <86C3892A0C52D411AF5000A0C9EAA3B96320F5@wtntex1.baea.com.au> Not familiar with wxPython but you may want to try putting the code in a script file and run from the prompt (you may already be doing this!). This will usually make visual any errors that are occurring. I don't understand why you need to pass "0" to the MyApp class as it appears that its initialisation function does not accept any outside parameters....suggest trying: app = MyApp() # Without the zero ..... and see how you go. Having not seen the example in context, I may be completely off target here, but I hope this helps. Dylan -----Original Message----- From: Terje Johan Abrahamsen [mailto:terjeja@hotmail.com] Sent: Friday, 23 August 2002 04:26 To: tutor@python.org Subject: [Tutor] wxPython crash I have installed the wxPython with my Activestate Python. Then I look in the documentation to learn it. When I try the first example: from wxPython.wx import * class MyApp(wxApp): def OnInit(self): frame = wxFrame(NULL, -1, "Hello from wxPython") frame.Show(true) self.SetTopWindow(frame) return true app = MyApp(0) app.MainLoop() Python just closes. No warnings, no errors, no nothing. It just closes. However, if I remove the "app = MyApp(0)" line, I get just an exception raised, so I assume that that must be where the problem is. What can this be caused by? _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From idiot1@netzero.net Fri Aug 23 06:05:58 2002 From: idiot1@netzero.net (Kirk Bailey) Date: Fri, 23 Aug 2002 01:05:58 -0400 Subject: [Tutor] unsubscribe me References: Message-ID: <3D65C2B6.7678E70@netzero.net> No. You do it. Gee, if you examine all the message, ANY message in this list, from the very top to the very bottom, VERY CAREFULLY, you MIGHT discover something you missed. If that fails, write me and I sill slip you a clue. BUT TRY FIRST. Ah, gee, am I being too nasty? Everyone, am I being overly naughty with this person? kavinmehta@softhome.net wrote: > > plz remove me from the mailing list > thamking you > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | KILL spam dead! http://www.scambusters.org/stopspam/#Pledge | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com From scot@possum.in-berlin.de Fri Aug 23 06:00:00 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Fri, 23 Aug 2002 07:00:00 +0200 Subject: [Tutor] Checking file existance In-Reply-To: <200208221438.48290.shalehperry@attbi.com> References: <20020822153432.A17731@babylonia.flatirons.org> <200208221438.48290.shalehperry@attbi.com> Message-ID: <200208230700.00814.scot@possum.in-berlin.de> Hi there, > import os.path > > if os.path.exists(filename): > print "found it" There seems to be a second way: import os if os.access(filename, os.F_OK): print "found it" os.access will also let you test for read, write, and execute permissions. No idea why this is duplicated, but there you go. Y, Scot -- Scot W. Stevenson wrote me on Friday, 23. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1588 hours and has a CPU that is falling asleep at a system load of 0.07. From d@aufbix.org Fri Aug 23 06:59:59 2002 From: d@aufbix.org (D) Date: Fri, 23 Aug 2002 07:59:59 +0200 Subject: [Tutor] Checking file existance In-Reply-To: <200208221438.48290.shalehperry@attbi.com> References: <20020822153432.A17731@babylonia.flatirons.org> <200208221438.48290.shalehperry@attbi.com> Message-ID: <200208230759.59054.d@aufbix.org> On Thursday 22 August 2002 23:38, Sean 'Shaleh' Perry wrote: > import os.path > > if os.path.exists(filename): > print "found it" if os.path.exists(filename) =3D=3D 1: # exists if os.path.exists(filename =3D=3D 0: # does not alternative: os.path.isfile or os.path.isdir regards, damir --=20 BOFH excuse #195: We only support a 28000 bps connection. From rnd@onego.ru Fri Aug 23 07:14:30 2002 From: rnd@onego.ru (Roman Suzi) Date: Fri, 23 Aug 2002 10:14:30 +0400 (MSD) Subject: [Tutor] Checking file existance In-Reply-To: <200208230759.59054.d@aufbix.org> Message-ID: On Fri, 23 Aug 2002, D wrote: > On Thursday 22 August 2002 23:38, Sean 'Shaleh' Perry wrote: > > > import os.path > > > > if os.path.exists(filename): > > print "found it" > > if os.path.exists(filename) == 1: # exists > if os.path.exists(filename == 0: # does not > > alternative: os.path.isfile or os.path.isdir A better alternative: os.access(filename, os.F_OK) > regards, > damir > > Sincerely yours, Roman A.Suzi -- - Petrozavodsk - Karelia - Russia - mailto:rnd@onego.ru - From glide@slingshot.co.nz Fri Aug 23 09:34:41 2002 From: glide@slingshot.co.nz (Graeme Andrew) Date: Fri, 23 Aug 2002 20:34:41 +1200 Subject: [Tutor] Another TKinter question .... Message-ID: <003a01c24a7f$ffbbe080$3434130a@graeme> Hi All, I am building a python install program that runs on a variety of platforms and in different environments. Depending on the availability of a suitable graphical client ... ie MS windows or a X windows client it will display a GUI interface. My question is how can I test to see if a suitable GUI client is available ? If it is not then my user interface should display in text mode. Is there a particular exception to test for when trying to build the Tkinter object or is there a more subtle way of testing for a suitable client ? Any suggestions most appreciated !! Regards Graeme Andrew New Zealand From python@keep-trying.com Fri Aug 23 14:00:24 2002 From: python@keep-trying.com (richard) Date: Fri, 23 Aug 2002 14:00:24 +0100 Subject: [Tutor] Newbie-Getting input from a text entry Message-ID: <5.1.0.14.0.20020823133640.009f05e0@192.168.5.1> Greetings, I am trying to retrieve a value from a text box. However I am unable to do so as I cannot find the correct method to retrieve the value. When I run the script the GUI is created fine. The problem occurs when you press the button to retrieve the value. I get an error which I think is saying that the get() method is not valid, however it is what is used in the examples I have been looking at and these have worked. I just do not understand why the value cannot be assigned. Any help appreciated. Richard Error Message: Exception in Tkinter callback Traceback (most recent call last): File "C:\PYTHON22\lib\lib-tk\Tkinter.py", line 1292, in __call__ return apply(self.func, args) File "C:\Python22\fmna4.py", line 29, in add print self.code.get() AttributeError: 'NoneType' object has no attribute 'get' Script: # import modules to be used from Tkinter import * import Pmw class GUI: def __init__(self): ###################################################################### self.root = Tk() self.root.title('FMNA - Add/Amend/Delete') self.root.option_add('*Entry*background', 'lightblue') self.root.option_add('*font', ('verdana', 10, 'bold')) Label(self.root, text='Code').grid(row=0, sticky=W) self.code=Pmw.EntryField(self.root).grid(row=0, column=1,padx=6, pady=2) Button(self.root, text='Quit', command=self.quit).grid(row=13, column=0, columnspan=2) Button(self.root, text='Add', command=self.add).grid(row=13, column=3, columnspan=2) def quit(self): import sys sys.quit def add(self): print self.code.get() myGUI = GUI() #myGUI.root.mainloop() ----------------------------------------- Python 2.2 Platform Win32 From lsloan@umich.edu Fri Aug 23 14:36:08 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Fri, 23 Aug 2002 09:36:08 -0400 Subject: [Tutor] Re: reverse a number (was no subject) In-Reply-To: References: Message-ID: <15178534.1030095368@[10.0.1.4]> --On Thursday, August 22, 2002 11:05 AM -0500 Christopher Smith wrote: >-- Lance E Sloan wrote: >># There's probably a more clever way to do this part. >> newnumString = '' >> for n in numString: >> newnumString = n + newnumString > > How about converting the number to a list and then reversing the elements > now: > > m=list(str(int(number))) > m.reverse() > numString=''.join(m) #this is your reversed number as a string Thanks! That's exactly what I was trying to think of. I thought it was a string method. -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From lsloan@umich.edu Fri Aug 23 14:49:17 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Fri, 23 Aug 2002 09:49:17 -0400 Subject: [Tutor] Re: reverse a number (was no subject) In-Reply-To: <200208220921.01004.shalehperry@attbi.com> References: <200208220921.01004.shalehperry@attbi.com> Message-ID: <15225863.1030096157@[10.0.1.4]> --On Thursday, August 22, 2002 9:21 AM -0700 Sean 'Shaleh' Perry wrote: >> How about converting the number to a list and then reversing the elements >> now: >> >> m=list(str(int(number))) >> m.reverse() >> numString=''.join(m) #this is your reversed number as a string >> > > or the old school C way (-: > >>>> l = [] >>>> n = 321 >>>> while n: > ... l.append(n % 10) > ... n /= 10 > ... >>>> l > [1, 2, 3] Sure. And while we're in that neighborhood, we might as well be even more C-like and leave out the list: >>> n = 321 >>> m = 0 >>> while n: ... m = m * 10 + n % 10 ... n /= 10 ... >>> m 123 -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From darnold02@sprynet.com Fri Aug 23 15:22:43 2002 From: darnold02@sprynet.com (Don Arnold) Date: Fri, 23 Aug 2002 09:22:43 -0500 Subject: [Tutor] Newbie-Getting input from a text entry References: <5.1.0.14.0.20020823133640.009f05e0@192.168.5.1> Message-ID: <002d01c24ab0$8cad43a0$0411ba3f@defaultcomp> The problem is that the geometry managers (pack, place, and grid) return None instead of the object they're acting on. You'll want to instantiate your widget, then grid() it separately: self.code=Pmw.EntryField(self.root) self.grid(row=0, column=1,padx=6, pady=2) Don ----- Original Message ----- From: "richard" To: Sent: Friday, August 23, 2002 8:00 AM Subject: [Tutor] Newbie-Getting input from a text entry > Greetings, > > I am trying to retrieve a value from a text box. However I am unable to do > so as I cannot > find the correct method to retrieve the value. When I run the script the > GUI is created fine. The problem occurs when you press the button to > retrieve the value. I get an error which I think is saying that the get() > method is not valid, however it is what is used in the examples I have been > looking at and these have worked. I just do not understand why the value > cannot be assigned. > > Any help appreciated. > > Richard > > > Error Message: > > Exception in Tkinter callback > Traceback (most recent call last): > File "C:\PYTHON22\lib\lib-tk\Tkinter.py", line 1292, in __call__ > return apply(self.func, args) > File "C:\Python22\fmna4.py", line 29, in add > print self.code.get() > AttributeError: 'NoneType' object has no attribute 'get' > > Script: > > # import modules to be used > from Tkinter import * > import Pmw > > class GUI: > def __init__(self): > ###################################################################### > self.root = Tk() > self.root.title('FMNA - Add/Amend/Delete') > self.root.option_add('*Entry*background', 'lightblue') > self.root.option_add('*font', ('verdana', 10, 'bold')) > > Label(self.root, text='Code').grid(row=0, sticky=W) > self.code=Pmw.EntryField(self.root).grid(row=0, column=1,padx=6, > pady=2) > > Button(self.root, text='Quit', command=self.quit).grid(row=13, > column=0, columnspan=2) > Button(self.root, text='Add', command=self.add).grid(row=13, > column=3, columnspan=2) > > def quit(self): > import sys > sys.quit > > def add(self): > print self.code.get() > > myGUI = GUI() > #myGUI.root.mainloop() > > ----------------------------------------- > Python 2.2 > Platform Win32 > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor From lsloan@umich.edu Fri Aug 23 15:48:28 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Fri, 23 Aug 2002 10:48:28 -0400 Subject: [Tutor] complex numbers: j vs. i Message-ID: <15438905.1030099708@[10.0.1.4]> I skimmed the Python documentation for a reason why the letter "j" is used to represent the imaginary part of complex numbers rather than the letter "i". I didn't find anything. In fact, I didn't see anything that mentioned either letter. Perhaps I didn't look at the right document. I was reading "Python Reference Manual" . Does anybody know why "j" is used? I'm guessing that either "i" caused a conflict or that the Dutch word for "imaginary" starts with "j". -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From rob@uselesspython.com Fri Aug 23 15:57:06 2002 From: rob@uselesspython.com (Rob) Date: Fri, 23 Aug 2002 09:57:06 -0500 Subject: [Tutor] complex numbers: j vs. i In-Reply-To: <15438905.1030099708@[10.0.1.4]> Message-ID: If I recall correctly, j is commonly used in engineering notation, so it would be more familiar to someone who already used it in their own equations. Rob > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > Lance E Sloan > Sent: Friday, August 23, 2002 9:48 AM > To: tutor@python.org > Subject: [Tutor] complex numbers: j vs. i > > > I skimmed the Python documentation for a reason why the letter > "j" is used > to represent the imaginary part of complex numbers rather than the letter > "i". I didn't find anything. In fact, I didn't see anything that > mentioned either letter. Perhaps I didn't look at the right document. I > was reading "Python Reference Manual" > . > > Does anybody know why "j" is used? I'm guessing that either "i" caused a > conflict or that the Dutch word for "imaginary" starts with "j". > > -- > Lance E Sloan > Web Services, Univ. of Michigan: Full-service Web and database design, > development, and hosting. Specializing in Python & Perl CGIs. > http://websvcs.itd.umich.edu/ - "Putting U on the Web" > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From rickp@telocity.com Fri Aug 23 16:21:21 2002 From: rickp@telocity.com (Rick Pasotto) Date: Fri, 23 Aug 2002 11:21:21 -0400 Subject: [Tutor] Newbie-Getting input from a text entry In-Reply-To: <5.1.0.14.0.20020823133640.009f05e0@192.168.5.1> References: <5.1.0.14.0.20020823133640.009f05e0@192.168.5.1> Message-ID: <20020823152121.GQ8720@tc.niof.net> On Fri, Aug 23, 2002 at 02:00:24PM +0100, richard wrote: > Greetings, > > I am trying to retrieve a value from a text box. However I am unable to do > so as I cannot > find the correct method to retrieve the value. When I run the script the > GUI is created fine. The problem occurs when you press the button to > retrieve the value. I get an error which I think is saying that the get() > method is not valid, however it is what is used in the examples I have been > looking at and these have worked. I just do not understand why the value > cannot be assigned. > > Any help appreciated. Here is your error: self.code=Pmw.EntryField(self.root).grid(row=0, column=1,padx=6,pady=2) self.code contains the return value of grid() instead of the entry field. You need to separate the calls: self.code=Pmw.EntryField(self.root) self.code.grid(row=0, column=1,padx=6,pady=2) > Error Message: > > Exception in Tkinter callback > Traceback (most recent call last): > File "C:\PYTHON22\lib\lib-tk\Tkinter.py", line 1292, in __call__ > return apply(self.func, args) > File "C:\Python22\fmna4.py", line 29, in add > print self.code.get() > AttributeError: 'NoneType' object has no attribute 'get' > > Script: > > # import modules to be used > from Tkinter import * > import Pmw > > class GUI: > def __init__(self): > ###################################################################### > self.root = Tk() > self.root.title('FMNA - Add/Amend/Delete') > self.root.option_add('*Entry*background', 'lightblue') > self.root.option_add('*font', ('verdana', 10, 'bold')) > > Label(self.root, text='Code').grid(row=0, sticky=W) > self.code=Pmw.EntryField(self.root).grid(row=0, column=1,padx=6, > pady=2) > > Button(self.root, text='Quit', command=self.quit).grid(row=13, > column=0, columnspan=2) > Button(self.root, text='Add', command=self.add).grid(row=13, > column=3, columnspan=2) > > def quit(self): > import sys > sys.quit > > def add(self): > print self.code.get() > > myGUI = GUI() > #myGUI.root.mainloop() > > ----------------------------------------- > Python 2.2 > Platform Win32 > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- "Seek simplicity, and distrust it." -- Alfred North Whitehead Rick Pasotto rickp@telocity.com http://www.niof.net From jeff@ccvcorp.com Fri Aug 23 17:07:56 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Fri, 23 Aug 2002 09:07:56 -0700 Subject: [Tutor] wxPython crash References: <86C3892A0C52D411AF5000A0C9EAA3B96320F5@wtntex1.baea.com.au> Message-ID: <3D665DDC.1C850208@ccvcorp.com> "BELSEY, Dylan" wrote: > [...] I don't > understand why you need to pass "0" to the MyApp class as it appears that > its initialisation function does not accept any outside > parameters....suggest trying: > app = MyApp() # Without the zero wxApp accepts an optional argument that affects how stdout is directed. I can never remember the details of what the respective results of passing nothing, 0, or 1 are (try them all and see!), but I do know that passing a filename causes stdout to be redirected to that file. Usually when I'm debugging a wxPython application that crashes, I'll redirect stdout to a file so that I can conveniently see the tracebacks. Jeff Shannon Technician/Programmer Credit International From lsloan@umich.edu Fri Aug 23 19:17:05 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Fri, 23 Aug 2002 14:17:05 -0400 Subject: [Tutor] unsubscribe me In-Reply-To: <3D65C2B6.7678E70@netzero.net> References: <3D65C2B6.7678E70@netzero.net> Message-ID: <15639664.1030112225@[10.0.1.4]> --On Friday, August 23, 2002 1:05 AM -0400 Kirk Bailey wrote: > Ah, gee, am I being too nasty? Everyone, am I being overly naughty with > this person? No. Maybe you're being sarcastic and brusque, but that may inspire the recipient to pay attention! Isn't the subscription info included at the end of the messages and in the headers, too? (I'm subscribed to the digest version of the list and what I see may be different than a non-digest subscription.) Actually, what you're doing, Kirk, is "teaching a man to fish." He'll never forget how to unsubscribe from a mailing list again! ;) I would like to suggest to the tutor list admin(s) (is that Danny?) that if possible, configure the listserver to forward messages to tutor-request@python.org if the subject line includes "subscribe" or "unsubscribe" and not much else. -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From dman@dman.ddts.net Fri Aug 23 19:59:37 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Fri, 23 Aug 2002 14:59:37 -0400 Subject: [Tutor] Re: complex numbers: j vs. i In-Reply-To: <15438905.1030099708@[10.0.1.4]> References: <15438905.1030099708@[10.0.1.4]> Message-ID: <20020823185937.GA10885@dman.ddts.net> --cNdxnHkX5QqsyA0e Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 23, 2002 at 10:48:28AM -0400, Lance E Sloan wrote: | I skimmed the Python documentation for a reason why the letter "j" is use= d=20 | to represent the imaginary part of complex numbers rather than the letter= =20 | "i". I didn't find anything. In fact, I didn't see anything that=20 | mentioned either letter. Perhaps I didn't look at the right document. I= =20 | was reading "Python Reference Manual"=20 | . |=20 | Does anybody know why "j" is used? I'm guessing that either "i" caused a= =20 | conflict or that the Dutch word for "imaginary" starts with "j". Rob has part of the answer -- mathematicians use 'i' but engineers use 'j' (because 'i' was already taken). A long time ago Guido asked people (on comp.lang.python, aka python-list@lists.python.org) to hash out the pros and cons of using each letter, and both were equally reasonable. So he decided on one of them. -D --=20 Running Windows is kinda like playing blackjack: User stays on success, reboots on failure =20 http://dman.ddts.net/~dman/ --cNdxnHkX5QqsyA0e Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1mhhgACgkQO8l8XBKTpRReswCeL93vwUvwAkMXi7a3e9tSgFOT rmgAn1W70YaZqXJmQVyHSPds+yysWI1m =kSQj -----END PGP SIGNATURE----- --cNdxnHkX5QqsyA0e-- From jchilders_98@yahoo.com Fri Aug 23 20:11:04 2002 From: jchilders_98@yahoo.com (J. Childers) Date: Fri, 23 Aug 2002 12:11:04 -0700 (PDT) Subject: [Tutor] Lost Modules? Message-ID: <20020823191104.36599.qmail@web13902.mail.yahoo.com> Hi, I am at my wits end trying to learn Python. When I create a module ("mymod.py") and then try to import it, Python tells me it cannot find a module of that name. "Import can't find module, or can't find name in module: No module named mymod" Yet it is there, in the directory named in os.getcwd(). What the heck am I doing wrong? This behavior is consistent for any modules I create. Arg! Jeff __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From terjeja@hotmail.com Fri Aug 23 15:53:46 2002 From: terjeja@hotmail.com (Terje Johan Abrahamsen) Date: Fri, 23 Aug 2002 14:53:46 +0000 Subject: [Tutor] Re: wxPython crash Message-ID: >From: Derrick 'dman' Hudson >To: tutor@python.org >Subject: [Tutor] Re: wxPython crash >Date: Thu, 22 Aug 2002 22:06:01 -0400 > >On Thu, Aug 22, 2002 at 06:26:25PM +0000, Terje Johan Abrahamsen wrote: >| I have installed the wxPython with my Activestate Python. Then I look in >| the documentation to learn it. When I try the first example: >| >| from wxPython.wx import * >| >| class MyApp(wxApp): >| def OnInit(self): >| frame = wxFrame(NULL, -1, "Hello from wxPython") >| frame.Show(true) >| self.SetTopWindow(frame) >| return true >| >| app = MyApp(0) >| app.MainLoop() > >This works for me. (Python 2.1 and wxGTK/wxPython 2.2 on Debian) > >| Python just closes. No warnings, no errors, no nothing. It just closes. >| However, if I remove the "app = MyApp(0)" line, I get just an exception >| raised, so I assume that that must be where the problem is. What can this >| be caused by? > >Could be a problem with your system -- were python, wxwindows, and >wxpython all compiled with the same compiler and linked against the >same versions of shared libraries? What sort of system are you using? >If it's a unix system, does running 'ulimit -c unlimited' beforehand >cause a core dump to be generated? I am running Win2000 and ActiveState Python 2.2.1. I did think of the possibility of something wrong with my installation, so I downloaded the program again, and ran the repair function in the installing. However, it didn't change anything. I haven't done anything else to Python. It all comes exactly as standard out of the "package". From rob@uselesspython.com Fri Aug 23 20:24:33 2002 From: rob@uselesspython.com (Rob) Date: Fri, 23 Aug 2002 14:24:33 -0500 Subject: [Tutor] Lost Modules? In-Reply-To: <20020823191104.36599.qmail@web13902.mail.yahoo.com> Message-ID: Can you describe a few more details of what you're trying to do and how you're trying to go about it? Are you trying to import modules from within IDLE, from the command prompt, or within a saved source file? Can you show an example of the source code where you're trying to import? Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > J. Childers > Sent: Friday, August 23, 2002 2:11 PM > To: tutor@python.org > Subject: [Tutor] Lost Modules? > > > Hi, > > I am at my wits end trying to learn Python. When I create a > module ("mymod.py") and then try to > import it, Python tells me it cannot find a module of that name. > > "Import can't find module, or can't find name in module: No module > named mymod" > > Yet it is there, in the directory named in os.getcwd(). What the > heck am I doing wrong? This > behavior is consistent for any modules I create. Arg! > > Jeff > > __________________________________________________ > Do You Yahoo!? > Yahoo! Finance - Get real-time stock quotes > http://finance.yahoo.com > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From max_ig@yahoo.com Fri Aug 23 20:46:51 2002 From: max_ig@yahoo.com (MIG) Date: Fri, 23 Aug 2002 12:46:51 -0700 (PDT) Subject: [Tutor] Lost Modules? In-Reply-To: <20020823191104.36599.qmail@web13902.mail.yahoo.com> Message-ID: <20020823194651.61731.qmail@web11304.mail.yahoo.com> Jeff, Are you using IDLE (python GUI)??? If you are, right-click the file in the windows explorer and choose EDIT, then press crtl-F5. That's it. Max --- "J. Childers" wrote: > Hi, > > I am at my wits end trying to learn Python. When I create a module > ("mymod.py") and then try to > import it, Python tells me it cannot find a module of that name. > > "Import can't find module, or can't find name in module: No module > named mymod" > > Yet it is there, in the directory named in os.getcwd(). What the heck > am I doing wrong? This > behavior is consistent for any modules I create. Arg! > > Jeff > > __________________________________________________ > Do You Yahoo!? > Yahoo! Finance - Get real-time stock quotes > http://finance.yahoo.com > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From printers@sendme.cz Fri Aug 23 21:05:16 2002 From: printers@sendme.cz (A) Date: Fri, 23 Aug 2002 22:05:16 +0200 Subject: [Tutor] Paradox Message-ID: <3D66B19C.26283.248EF93@localhost> Hi, Is there a module for using Paradox (.DB) files with Python? Thanks for help Ladislav From max_ig@yahoo.com Fri Aug 23 21:20:43 2002 From: max_ig@yahoo.com (MIG) Date: Fri, 23 Aug 2002 13:20:43 -0700 (PDT) Subject: [Tutor] python users in Argentina Message-ID: <20020823202043.9139.qmail@web11306.mail.yahoo.com> I'm not sure if it is the right list, but anyways, is there any python user in Buenos Aires, Argentina (besides me)?? Max __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From gus.tabares@verizon.net Sat Aug 24 01:30:34 2002 From: gus.tabares@verizon.net (Gus Tabares) Date: Fri, 23 Aug 2002 20:30:34 -0400 Subject: [Tutor] Lost Modules? In-Reply-To: <20020823191104.36599.qmail@web13902.mail.yahoo.com> Message-ID: Hello, What is your PYTHONPATH set to? Gus -----Original Message----- From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of J. Childers Sent: Friday, August 23, 2002 3:11 PM To: tutor@python.org Subject: [Tutor] Lost Modules? Hi, I am at my wits end trying to learn Python. When I create a module ("mymod.py") and then try to import it, Python tells me it cannot find a module of that name. "Import can't find module, or can't find name in module: No module named mymod" Yet it is there, in the directory named in os.getcwd(). What the heck am I doing wrong? This behavior is consistent for any modules I create. Arg! Jeff __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From wilson@visi.com Sat Aug 24 02:57:47 2002 From: wilson@visi.com (Tim Wilson) Date: Fri, 23 Aug 2002 20:57:47 -0500 Subject: [Tutor] binary vs. linear search Message-ID: <20020824015746.GA15477@isis.visi.com> Hi everyone, I was looking through my brand-new, still-shiny copy of the Python Cookbook tonight and discovered a very short little algorithm for doing a binary search (p. 46). I've been playing around with a python module that's useful for solving word puzzles of the type you hear on NPR's Weekend Edition Sunday (with Will Shortz). I had the idea that some of these puzzles would make excellent assignments for my beginning programming students. A recent one required finding a six-letter word that after moving the first letter to the end and finding a new word and then moving the front letter to the back again would make another new word. There are a couple such words. To solve this with Python I loaded the dictionary from my Linux system into a Python list (45,392 words), pulled out all the six-letter words (6,175 of them), moved the letters, and checked to see if the altered words existed in the dictionary list. After discovering the binary search algorithm I decided to compare its performance to my first attempt. (For testing purposes I moved only one letter, producing a larger list to check against the dictionary.) Here are the two algorithms: def isWord(word, wordList): # binary search wordList.sort() item_insert_point = bisect.bisect(wordList, word) is_present = wordList[item_insert_point-1:item_insert_point] == [word] if is_present: return 1 return 0 def isWord(word, wordList): # regular python search if word in wordList: return 1 return 0 The results for looking for 6,175 words in a list of 45,392 words are: binary: 3m 25s regular: 2m 58s I was surprised to find the binary search slower in this case. Can anyone explain why? -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.com W. St. Paul, MN | | http://slashdot.org wilson@visi.com | | http://linux.com From shalehperry@attbi.com Sat Aug 24 03:06:16 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Fri, 23 Aug 2002 19:06:16 -0700 Subject: [Tutor] binary vs. linear search In-Reply-To: <20020824015746.GA15477@isis.visi.com> References: <20020824015746.GA15477@isis.visi.com> Message-ID: <200208231906.16787.shalehperry@attbi.com> On Friday 23 August 2002 06:57 pm, Tim Wilson wrote: > > Here are the two algorithms: > > def isWord(word, wordList): # binary search > wordList.sort() > item_insert_point =3D bisect.bisect(wordList, word) > is_present =3D wordList[item_insert_point-1:item_insert_point] =3D=3D > [word] > if is_present: > return 1 > return 0 > > > def isWord(word, wordList): # regular python search > if word in wordList: > return 1 > return 0 > > > The results for looking for 6,175 words in a list of 45,392 words are: > > binary: 3m 25s > regular: 2m 58s > > I was surprised to find the binary search slower in this case. Can > anyone explain why? > The binary search does more work. You call list.sort(), bisect() and eve= n do=20 a list splice. To make it truly fair passing the two functions a sorted=20 list. From wilson@visi.com Sat Aug 24 04:11:06 2002 From: wilson@visi.com (Tim Wilson) Date: Fri, 23 Aug 2002 22:11:06 -0500 Subject: [Tutor] binary vs. linear search In-Reply-To: <200208231906.16787.shalehperry@attbi.com> References: <20020824015746.GA15477@isis.visi.com> <200208231906.16787.shalehperry@attbi.com> Message-ID: <20020824031106.GA17846@isis.visi.com> On Fri, Aug 23, 2002 at 07:06:16PM -0700, Sean 'Shaleh' Perry wrote: > On Friday 23 August 2002 06:57 pm, Tim Wilson wrote: > > > > Here are the two algorithms: > > > > def isWord(word, wordList): # binary search > > wordList.sort() > > item_insert_point = bisect.bisect(wordList, word) > > is_present = wordList[item_insert_point-1:item_insert_point] == > > [word] > > if is_present: > > return 1 > > return 0 > > > > > > def isWord(word, wordList): # regular python search > > if word in wordList: > > return 1 > > return 0 > > > > > > The results for looking for 6,175 words in a list of 45,392 words are: > > > > binary: 3m 25s > > regular: 2m 58s > > > > I was surprised to find the binary search slower in this case. Can > > anyone explain why? > > > > The binary search does more work. You call list.sort(), bisect() and even do > a list splice. To make it truly fair passing the two functions a sorted > list. Thanks Sean. I removed the wordList.sort() from the binary search function and the time for execution dropped to just over 1 sec.!!!! Yikes! Now that I think about it, the time to sort a 6,175 item list 6,175 times is signficant. Duh. As long as I make sure I pass a sorted list to the function, the performance gain over the regular linear search is impressive to say the least. -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.com W. St. Paul, MN | | http://slashdot.org wilson@visi.com | | http://linux.com From tim.one@comcast.net Sat Aug 24 06:36:12 2002 From: tim.one@comcast.net (Tim Peters) Date: Sat, 24 Aug 2002 01:36:12 -0400 Subject: [Tutor] binary vs. linear search In-Reply-To: <20020824031106.GA17846@isis.visi.com> Message-ID: [Tim Wilson] > Thanks Sean. I removed the wordList.sort() from the binary search > function and the time for execution dropped to just over 1 sec.!!!! > Yikes! Now that I think about it, the time to sort a 6,175 item list > 6,175 times is signficant. The real mystery there should have been why the aggregate sorting time didn't take minutes instead of seconds. There's a reason for that: list.sort() first checks to see whether the list is already sorted, and gets out with only len(list)-1 compares if it is. That's why it didn't kill you; it only needed to do a full-blown sort the first time you called it. > Duh. As long as I make sure I pass a sorted list to the function, the > performance gain over the regular linear search is impressive to say > the least. It should go very much faster to make the words the keys of a Python dict, e.g. words = {} for w in wordList: words[w] = 1 Then to find out later whether a word w was in the original wordList, you just need to see whether words.has_key(w) is true. On average, doing has_key takes a small and constant time independent of how many words there are. Binary search takes time proportional to log_base_2(number_of_words), which is much slower as the number of words grows despite how efficient binary search is compared to brute-force searching. From printers@sendme.cz Sat Aug 24 08:47:05 2002 From: printers@sendme.cz (A) Date: Sat, 24 Aug 2002 09:47:05 +0200 Subject: [Tutor] Re: Paradox Message-ID: <3D675619.28439.A7111@localhost> Hi, Is there a module for using Paradox (.DB) files with Python? Thanks for help Ladislav From omikhail@bus.ucf.edu Wed Aug 21 19:56:54 2002 From: omikhail@bus.ucf.edu (O. Mikhail) Date: Wed, 21 Aug 2002 14:56:54 -0400 Subject: [Tutor] HELP In-Reply-To: <20020821185903.30416.10824.Mailman@mail.python.org> Message-ID: <5.1.0.14.2.20020821145416.02ad4880@pop3.norton.antivirus> HELP I am installing (for the fourth time) mailman on Linux 7.3 I think that the problem is that I do not know how groups/ownership works. Can someone please send a detailed STEP-BY-STEP installation procedure for non-advanced users. Specifically at each step, I should logging as whom when installing, when creating the list... Your help is greatly appreciated. Thanks O. Mikhail From Morne" This is a multi-part message in MIME format. ------=_NextPart_000_006C_01C249E1.B93C4800 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi could one or 2 of you help me with this I have gotten this far I = havnt got the hang of python yet but am working on it . Here it goes: def getStuff(file) info =3D open(file,"r") infolines =3D info.readlines() for line in infolines: word =3D string.split(lines) print"Line %d contains %d words" % (linenum,len(word)) linenum +=3D 1 totalwords +=3D len(words) print "Total lines:", linenum - 1 print "Average words per line:", float(totalwords)/linenum - 1 file =3D raw_input("Enter the filename: ") getStuff(file) Here is what I want it to do it takes a text file and counts the number = of lines in the file, the number of words in a line and then produces a summary. The Output must look like this. Enter file name: > testfile.txt LINE# WORDS -------------------- 1 20 words 2 25 words 3 30 words 4 25 words -------------------- Summary: 4 lines, 100 words, Avg: 25 words/line =20 Can you pease let me know if this is right and if not "what the errors = are and how to fix them I have until tomorrow and then my boss wants me to show him what I know = he has given me 5 days to do this and I used python for the first time = on Monday. And I will be asking you all alot more questions. Thanx From morne ------=_NextPart_000_006C_01C249E1.B93C4800 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi could one or 2 of you help me with = this I have=20 gotten this far I havnt got the hang of python yet but am working on it=20 .
 
Here it goes:
 
def getStuff(file)
     info =3D=20 open(file,"r")
     infolines =3D=20 info.readlines()
    for line in=20 infolines:
    word =3D=20 string.split(lines)
   print"Line %d = contains %d words"=20 % (linenum,len(word))
   linenum +=3D = 1
   totalwords +=3D=20 len(words)
    print "Total lines:", linenum -=20 1
    print "Average words per line:",=20 float(totalwords)/linenum - 1
file =3D raw_input("Enter the filename: = ")
getStuff(file)

Here is what I want it to do it takes a = text file=20 and counts the number of
lines in the file, the number of words in a = line and=20 then produces a
summary.  The Output must look like=20 this.


Enter file name:
> = testfile.txt


LINE# =20 WORDS
--------------------
1      20=20 words
2      25=20 words
3      30=20 words
4      25=20 words
--------------------
Summary:
4 lines, 100 words, Avg: 25 = words/line
 
 
 
Can you pease let me know if this is = right and if=20 not "what the errors are and how to fix them
I have until tomorrow and then my boss = wants me to=20 show him what I know he has given me 5 days to do this and I used python = for the=20 first time on Monday. And I will be asking you all alot more=20 questions.
 
Thanx From=20 morne
------=_NextPart_000_006C_01C249E1.B93C4800-- From richard@keep-trying.com Fri Aug 23 19:55:55 2002 From: richard@keep-trying.com (Richard Grosse) Date: Fri, 23 Aug 2002 19:55:55 +0100 Subject: [Tutor] Newbie-Getting input from a text entry Message-ID: <5.1.0.14.0.20020823195542.009f00d0@192.168.5.1> Thanks for your help folks. Did not realise that the geometry managers did this despite spending the past day reading through several TK/Python docs. Oh well. Prompt replies appreciated. Best Regards Richard At 09:22 23/08/02 -0500, you wrote: >The problem is that the geometry managers (pack, place, and grid) return >None instead of the object they're acting on. You'll want to instantiate >your widget, then grid() it separately: > >self.code=Pmw.EntryField(self.root) >self.grid(row=0, column=1,padx=6, pady=2) > >Don > >----- Original Message ----- >From: "richard" >To: >Sent: Friday, August 23, 2002 8:00 AM >Subject: [Tutor] Newbie-Getting input from a text entry > > > > Greetings, > > > > I am trying to retrieve a value from a text box. However I am unable to do > > so as I cannot > > find the correct method to retrieve the value. When I run the script the > > GUI is created fine. The problem occurs when you press the button to > > retrieve the value. I get an error which I think is saying that the get() > > method is not valid, however it is what is used in the examples I have >been > > looking at and these have worked. I just do not understand why the value > > cannot be assigned. > > > > Any help appreciated. > > > > Richard > > > > > > Error Message: > > > > Exception in Tkinter callback > > Traceback (most recent call last): > > File "C:\PYTHON22\lib\lib-tk\Tkinter.py", line 1292, in __call__ > > return apply(self.func, args) > > File "C:\Python22\fmna4.py", line 29, in add > > print self.code.get() > > AttributeError: 'NoneType' object has no attribute 'get' > > > > Script: > > > > # import modules to be used > > from Tkinter import * > > import Pmw > > > > class GUI: > > def __init__(self): > > ###################################################################### > > self.root = Tk() > > self.root.title('FMNA - Add/Amend/Delete') > > self.root.option_add('*Entry*background', 'lightblue') > > self.root.option_add('*font', ('verdana', 10, 'bold')) > > > > Label(self.root, text='Code').grid(row=0, sticky=W) > > self.code=Pmw.EntryField(self.root).grid(row=0, column=1,padx=6, > > pady=2) > > > > Button(self.root, text='Quit', command=self.quit).grid(row=13, > > column=0, columnspan=2) > > Button(self.root, text='Add', command=self.add).grid(row=13, > > column=3, columnspan=2) > > > > def quit(self): > > import sys > > sys.quit > > > > def add(self): > > print self.code.get() > > > > myGUI = GUI() > > #myGUI.root.mainloop() > > > > ----------------------------------------- > > Python 2.2 > > Platform Win32 > > > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > http://mail.python.org/mailman/listinfo/tutor From arosado@softhome.net Sun Aug 25 02:16:14 2002 From: arosado@softhome.net (Andres Rosado) Date: Sat, 24 Aug 2002 21:16:14 -0400 Subject: [Tutor] Re: complex numbers: j vs. i Message-ID: <5.1.0.14.0.20020824211611.00bc3a88@mail.softhome.net> At 12:00 PM 8/23/2002 -0400, you wrote: >If I recall correctly, j is commonly used in engineering notation, so it >would be more familiar to someone who already used it in their own >equations. This is especially true in electric engineering. The current is represented with the letter `i', so using `i' for complex number will make things more difficult to understand. ----------------------------------- Andres Rosado Email: andresr@despammed.com ICQ: 66750646 Homepage: http://andres980.tripod.com/ If the designers of X-window built cars, there would be no fewer than five steering wheels hidden about the cockpit, none of which followed the same principles -- but you'd be able to shift gears with your car stereo. Useful feature, that. -- From the programming notebooks of a heretic, 1990. From idiot1@netzero.net Sun Aug 25 06:20:17 2002 From: idiot1@netzero.net (Kirk Bailey) Date: Sun, 25 Aug 2002 01:20:17 -0400 Subject: [Tutor] books arrived Message-ID: <3D686911.234852A6@netzero.net> I ordered, and just received, Python Web Programming, and Learning Python. MAYBE next month I can pony up the shekels geveldt to purchase either Programming Python or Python Essential Reference. -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | KILL spam dead! http://www.scambusters.org/stopspam/#Pledge | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com From idiot1@netzero.net Sun Aug 25 07:01:40 2002 From: idiot1@netzero.net (Kirk Bailey) Date: Sun, 25 Aug 2002 02:01:40 -0400 Subject: [Tutor] Re: complex numbers: j vs. i References: <5.1.0.14.0.20020824211611.00bc3a88@mail.softhome.net> Message-ID: <3D6872C4.4437F0B8@netzero.net> CAPITAL 'i' is current. 'I' I=E/R (ohm's law) 'i' is used for indexing. hmmm. and here I have idle open. >>> >>> i="index" >>> I="'current'" >>> >>> i 'index' >>> I "'current'" >>> ok, it senses CASE, so it would seem that using I should be fine, but i will cause much potential grief, possibly. Andres Rosado wrote: > > At 12:00 PM 8/23/2002 -0400, you wrote: > >If I recall correctly, j is commonly used in engineering notation, so it > >would be more familiar to someone who already used it in their own > >equations. > > This is especially true in electric engineering. The current is represented > with the letter `i', so using `i' for complex number will make things more > difficult to understand. > > ----------------------------------- > Andres Rosado > Email: andresr@despammed.com > ICQ: 66750646 > Homepage: http://andres980.tripod.com/ > > If the designers of X-window built cars, there would be no fewer than five > steering wheels hidden about the cockpit, none of which followed the same > principles -- but you'd be able to shift gears with your car stereo. Useful > feature, that. > -- From the programming notebooks of a heretic, 1990. > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | KILL spam dead! http://www.scambusters.org/stopspam/#Pledge | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com From python Sun Aug 25 19:34:16 2002 From: python (python) Date: Sun, 25 Aug 2002 11:34:16 -0700 Subject: [Tutor] books arrived In-Reply-To: <3D686911.234852A6@netzero.net> References: <3D686911.234852A6@netzero.net> Message-ID: <70901471896.20020825113416@inkedmn.net> Kirk, i've got both programming python and python essential reference. if you've got a pretty good handle on python's syntax and modules, then go with Programming Python, as it's got more large, "real-world" examples in it that deal with GUI's and Networking. python essential reference is basically the documentation on the website with a bit more info and different examples... brett KB> I ordered, and just received, Python Web Programming, and Learning KB> Python. MAYBE next month I can pony up the shekels geveldt to purchase KB> either Programming Python or Python Essential Reference. From recumbentjoe@zianet.com Sun Aug 25 17:13:42 2002 From: recumbentjoe@zianet.com (Joe) Date: 25 Aug 2002 12:13:42 -0400 Subject: [Tutor] Hi All In-Reply-To: <006f01c249d0$f89d9fa0$7800a8c0@maxitec.co.za> References: <006f01c249d0$f89d9fa0$7800a8c0@maxitec.co.za> Message-ID: <1030292023.3310.4.camel@localhost.localdomain> #!/usr/bin/python # Wordcount.py # Program to count both lines and words in a text file. # suggested by Joe Richey # 8/25/02 # import sys import string from string import * filename="" filename=raw_input("Enter the filename :") if len(filename)<1 : sys.exit() #set up int and strings space needed wordcount=0 linecount=0 totalwords=0 linelist="" wordlist="" totallines=0 f=file(filename,"r") #Open file as needed linelist=f.readlines() #Get everything into a list totallines=len(linelist) #get how many lines in file print"\nLINE# WORDS" print"------------\n\n" while linecount <= totallines-1: wordlist=split(linelist[linecount]) print"%d %d words" % (linecount+1,len(wordlist)) totalwords=totalwords+len(wordlist) linecount=linecount+1 print"------------" print "Summary:" print "%d lines, %d words, Avg: %d words/line" %(totallines,totalwords,(totalwords/totallines)) I'm also new at Python, but maybe more then one week. The above code seems to work ok for me here. Its totally new from yours as I wasn't sure where you were going with yours. Hope it does not confuse you too much and you will need to work on the Average routine at the end (i used a int and you wanted a float) Joe On Thu, 2002-08-22 at 07:42, Morne wrote: > Hi could one or 2 of you help me with this I have gotten this far I havnt got the hang of python yet but am working on it . > > Here it goes: > > def getStuff(file) > info = open(file,"r") > infolines = info.readlines() > for line in infolines: > word = string.split(lines) > print"Line %d contains %d words" % (linenum,len(word)) > linenum += 1 > totalwords += len(words) > print "Total lines:", linenum - 1 > print "Average words per line:", float(totalwords)/linenum - 1 > file = raw_input("Enter the filename: ") > getStuff(file) > > > Here is what I want it to do it takes a text file and counts the number of > lines in the file, the number of words in a line and then produces a > summary. The Output must look like this. > > > Enter file name: > > testfile.txt > > > LINE# WORDS > -------------------- > 1 20 words > 2 25 words > 3 30 words > 4 25 words > -------------------- > Summary: > 4 lines, 100 words, Avg: 25 words/line > > > > > Can you pease let me know if this is right and if not "what the errors are and how to fix them > I have until tomorrow and then my boss wants me to show him what I know he has given me 5 days to do this and I used python for the first time on Monday. And I will be asking you all alot more questions. > > Thanx From morne From jfrichey@zianet.com Sun Aug 25 17:58:59 2002 From: jfrichey@zianet.com (Joe) Date: 25 Aug 2002 12:58:59 -0400 Subject: [Tutor] Hi All In-Reply-To: <006f01c249d0$f89d9fa0$7800a8c0@maxitec.co.za> References: <006f01c249d0$f89d9fa0$7800a8c0@maxitec.co.za> Message-ID: <1030294740.3546.2.camel@localhost.localdomain> #!/usr/bin/python # Wordcount.py # Program to count both lines and words in a text file. # suggested by Joe Richey # 8/25/02 # import sys import string from string import * filename="" filename=raw_input("Enter the filename :") if len(filename)<1 : sys.exit() #set up int and strings space needed wordcount=0 linecount=0 totalwords=0 linelist="" wordlist="" totallines=0 f=file(filename,"r") #Open file as needed linelist=f.readlines() #Get everything into a list totallines=len(linelist) #get how many lines in file print"\nLINE# WORDS" print"------------\n\n" while linecount <= totallines-1: wordlist=split(linelist[linecount]) print"%d %d words" % (linecount+1,len(wordlist)) totalwords=totalwords+len(wordlist) linecount=linecount+1 print"------------" print "Summary:" print "%d lines, %d words, Avg: %d words/line" %(totallines,totalwords,(totalwords/totallines)) I'm also new at Python, but maybe more then one week. The above code seems to work ok for me here. Its totally new from yours as I wasn't sure where you were going with yours. Hope it does not confuse you too much and you will need to work on the Average routine at the end (i used a int and you wanted a float) Joe On Thu, 2002-08-22 at 07:42, Morne wrote: > Hi could one or 2 of you help me with this I have gotten this far I havnt got the hang of python yet but am working on it . > > Here it goes: > > def getStuff(file) > info = open(file,"r") > infolines = info.readlines() > for line in infolines: > word = string.split(lines) > print"Line %d contains %d words" % (linenum,len(word)) > linenum += 1 > totalwords += len(words) > print "Total lines:", linenum - 1 > print "Average words per line:", float(totalwords)/linenum - 1 > file = raw_input("Enter the filename: ") > getStuff(file) > > > Here is what I want it to do it takes a text file and counts the number of > lines in the file, the number of words in a line and then produces a > summary. The Output must look like this. > > > Enter file name: > > testfile.txt > > > LINE# WORDS > -------------------- > 1 20 words > 2 25 words > 3 30 words > 4 25 words > -------------------- > Summary: > 4 lines, 100 words, Avg: 25 words/line > > > > > Can you pease let me know if this is right and if not "what the errors are and how to fix them > I have until tomorrow and then my boss wants me to show him what I know he has given me 5 days to do this and I used python for the first time on Monday. And I will be asking you all alot more questions. > > Thanx From morne From lists@shrestha.net.np Mon Aug 26 02:34:48 2002 From: lists@shrestha.net.np (Ashish Shrestha) Date: Mon, 26 Aug 2002 07:19:48 +0545 Subject: [Tutor] Re: complex numbers: j vs. i References: <5.1.0.14.0.20020824211611.00bc3a88@mail.softhome.net> <3D6872C4.4437F0B8@netzero.net> Message-ID: <3D6985B8.6000408@shrestha.net.np> Kirk Bailey wrote: > CAPITAL 'i' is current. > 'I' > I=E/R (ohm's law) > 'i' is used for indexing. hmmm. and here I have idle open. > > Time variant parameters are represented by lowercase letters. So ac current is represented by 'i'. Ashish Shrestha From erikprice@mac.com Mon Aug 26 03:59:38 2002 From: erikprice@mac.com (Erik Price) Date: Sun, 25 Aug 2002 22:59:38 -0400 Subject: [Tutor] Python Cookbook Message-ID: I think the Perl Cookbook is great. So what's the verdict on the Python equivalent? Normally I try to read a book for an hour or two in the store to get a feel for whether or not I'll like it. I have to admit I haven't spent that much time with this offering, but it's also written by many contributors, so even then it might be difficult to get a grasp of the book overall. Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From idiot1@netzero.net Mon Aug 26 05:04:29 2002 From: idiot1@netzero.net (Kirk Bailey) Date: Mon, 26 Aug 2002 00:04:29 -0400 Subject: [Tutor] books arrived References: <3D686911.234852A6@netzero.net> <70901471896.20020825113416@inkedmn.net> Message-ID: <3D69A8CD.9A6D349@netzero.net> Syntax is ok, but the modules I need to study more. and alas, I am stuck for the time being with 1.5.2, my hardware guru says we would have to upgrade critter to handle the new version. python wrote: > > Kirk, > > i've got both programming python and python essential reference. if > you've got a pretty good handle on python's syntax and modules, then > go with Programming Python, as it's got more large, "real-world" > examples in it that deal with GUI's and Networking. > > python essential reference is basically the documentation on the > website with a bit more info and different examples... > > brett > > KB> I ordered, and just received, Python Web Programming, and Learning > KB> Python. MAYBE next month I can pony up the shekels geveldt to purchase > KB> either Programming Python or Python Essential Reference. -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | KILL spam dead! http://www.scambusters.org/stopspam/#Pledge | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com From dyoo@hkn.eecs.berkeley.edu Mon Aug 26 08:06:49 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 26 Aug 2002 00:06:49 -0700 (PDT) Subject: [Tutor] Python Cookbook In-Reply-To: Message-ID: On Sun, 25 Aug 2002, Erik Price wrote: > I think the Perl Cookbook is great. > > So what's the verdict on the Python equivalent? Normally I try to read > a book for an hour or two in the store to get a feel for whether or not > I'll like it. I have to admit I haven't spent that much time with this > offering, but it's also written by many contributors, so even then it > might be difficult to get a grasp of the book overall. I think it's pretty good; have you had a chance to look at the sample Chapter 1 yet? http://www.oreilly.com/catalog/pythoncook/chapter/index.html As a warning: I'm not a disinterested party in my endorsement. *grin* There's a lot of good material in the book, including Chapter 17 on Algorithms. When I have a chance, I'd love to take a closer look at 17.16 "Converting Numbers to Rationals via Farey Fractions". (Offtopic apology: Please forgive me for being so unresponsive to the list the past week; I've been trying to catch up with work.) Best of wishes to you! From alan.gauld@bt.com Mon Aug 26 11:57:55 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 26 Aug 2002 11:57:55 +0100 Subject: [Tutor] Here is the whole script I'm having issues with. Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C87A@mbtlipnt02.btlabs.bt.co.uk> > However, a quick chek with vi showed that the indentation was > indeed off on the line story. I fixed it and now the classes load. Ah! Thats a relief. > >> class Html: > >> def __init__(self, address): > >> def connect(self): > x.connect() afterwards and the connect method runs. Actually, > If I run an instance of the las method in the class, all of > the methods in the class are run. I assume thats a deliberate design decision on your part? ie You wrote a method to excercise all of the other methods? > So if I add self to the method variables as you suggest and run: > x = Html("some address here") > Will the whole class run straight through? Not sure what you mean by the whole class running straight through. The class definition will run through without any difference. When you call a method the data within that method will be stored within the instances. What else do you think might happen? > Also, now that I have re-edited the script, would it be Ok to > post for everyone to check out? Is anyone even interested in > this script? Assuming its not thousands odf lines long then yes that seems to be an accepted process. Of course hoew many take time to read it all will be variable... Alan g. PS. Catching up on 4 digests so this may be dealt with already... From alan.gauld@bt.com Mon Aug 26 12:07:45 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 26 Aug 2002 12:07:45 +0100 Subject: [Tutor] Newbie-Getting input from a text entry Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C87B@mbtlipnt02.btlabs.bt.co.uk> > I am trying to retrieve a value from a text box. I don't think you are.... > print self.code.get() > AttributeError: 'NoneType' object has no attribute 'get' Says that self.code is a 'nonetype' object, not a text box. > self.code=Pmw.EntryField(self.root).grid(row=0,... You are storing the retirn value from the grid method in self.code. But the return is none. You need to separate the steps: self.code = Pmw.EntryFoeld(self.root) self.code.grid(....) IMHO Its a shame the layout manager metjods don't return self but they don't so you have to use a two stage approach if you want to keep a handle to the widget... HTH, Alan g From alan.gauld@bt.com Mon Aug 26 12:12:21 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 26 Aug 2002 12:12:21 +0100 Subject: [Tutor] complex numbers: j vs. i Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C87C@mbtlipnt02.btlabs.bt.co.uk> > I skimmed the Python documentation for a reason why the > letter "j" is used to represent the imaginary part of > complex numbers > Does anybody know why "j" is used? I'm guessing that either > "i" caused a conflict or that the Dutch word for > "imaginary" starts with "j". I think its because in engineering as opposed to math the letter 'j' is always used for complex numbers. This is (I assume) because 'i' was already defined to mean something else in engineering. For example in Electrical Engineering the expression V = 5i means V is 5 times the instantaneous current. HTH, Alan g. From alan.gauld@bt.com Mon Aug 26 13:01:02 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 26 Aug 2002 13:01:02 +0100 Subject: [Tutor] Lost Modules? Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C880@mbtlipnt02.btlabs.bt.co.uk> > I am at my wits end trying to learn Python. When I create a > module ("mymod.py") and then try to > import it, Python tells me it cannot find a module of that name. Are you by any chance doing: import mymod.py ??? If so change it to: import mymod Python adds the .py automagically. Otherwise the likely explanation is a path issue and you may need to modify sys.path or set the PYTHONPATH environment variable. But my guess is the wrong import name as above... Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From thomi@thomi.imail.net.nz Mon Aug 26 13:13:16 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Tue, 27 Aug 2002 00:13:16 +1200 Subject: [Tutor] Lost Modules? In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C880@mbtlipnt02.btlabs.bt.co.uk> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C880@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <20020827001316.35d21991.thomi@thomi.imail.net.nz> heres two files, in the SAME directory, the first is the module, the second is the file: --------------------------- #!/usr/bin/python def test(): echo "blah blah blah" ------------------------------------- ---------------------------- import sys import os sys.path.append(os.getcwd()) import mymod mymod.test() echo "see?" ----------------------------------- Note that i HAVE NOT tested this, so it may not work... don't blame me if it blows up your computer, car, house, dog, or any other posseson -- "Avoid the Gates of Hell. Use Linux" Thomi Richards, thomi@imail.net.nz From alan.gauld@bt.com Mon Aug 26 13:25:05 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 26 Aug 2002 13:25:05 +0100 Subject: [Tutor] binary vs. linear search Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C881@mbtlipnt02.btlabs.bt.co.uk> > The results for looking for 6,175 words in a list of 45,392 words are: > > binary: 3m 25s > regular: 2m 58s > > I was surprised to find the binary search slower in this case. Can > anyone explain why? Binary search is good for finding 1 item in a sorted list without scanning the entire list. But you are looking for all items matching a certain criteria, for that you need to dfo a scan so binary search is unlikely to be effective. Even if you sorted by word length first it would only be effective to use binary search to find any single entry, not the whole block of 6 char words. So far as the binary search is concerned all of the 6 char words are the same so finding any of them is good enough. You would need to keep searching until there were none left. By contrast you can extract them all in a single sweep without even sorting first... As ever its a metter of selecting the most appropriate tool for the task at hand. Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld Alan g. From erikprice@mac.com Mon Aug 26 13:42:35 2002 From: erikprice@mac.com (Erik Price) Date: Mon, 26 Aug 2002 08:42:35 -0400 Subject: [Tutor] Python Cookbook In-Reply-To: Message-ID: <4C3FDDF8-B8F1-11D6-B10B-00039351FE6A@mac.com> On Monday, August 26, 2002, at 03:06 AM, Danny Yoo wrote: > I think it's pretty good; have you had a chance to look at the sample > Chapter 1 yet? > > http://www.oreilly.com/catalog/pythoncook/chapter/index.html > > As a warning: I'm not a disinterested party in my endorsement. *grin* Well, in that first chapter, David Ascher's opening commentary includes the following quote, that I need help with: """ My favorite recent language features are list comprehensions and the new applicability of the * and ** tokens to function calls as well as to function definitions. List comprehensions have clearly become wildly successful, if the authors of this volume are representative of the Python community at large, and have largely demoted the map and filter built-in functions. Less powerful, but equally elegant, are * and **. Since Python 2.0, the oft-quoted recipe: def method(self, argument, *args, **kw): # Do something with argument apply(callable, args, kw) can now be done much more elegantly as: def method(self, argument, *args, **kw): # Do something with argument callable(*args, *kw) """ This must be a new form of callable(), because in my copy of Python Essential Reference (for 2.1), callable() takes one parameter argument that is an object. I understood what map() and filter() do, but why are list comprehensions better? FWIW, I don't really know exactly what a list comprehension is, only that PER says that the following map(function, alist) can be better written using list comprehension as [function(x) for x in alist] -- why? Thanks for any thoughts that anyone can contribute. Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From alan.gauld@bt.com Mon Aug 26 13:32:19 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 26 Aug 2002 13:32:19 +0100 Subject: [Tutor] binary vs. linear search Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C882@mbtlipnt02.btlabs.bt.co.uk> > 6,175 times is signficant. Duh. As long as I make sure I pass a sorted > list to the function, the performance gain over the regular linear > search is impressive to say the least. How does it compare with a list comprehension or filter: sixes = filter(lambda w: len(w) == 6, wordlist) Should pull out the six letter words without sorting. Then sorting sixes and using the binary search on that list to find the specific word should be fast. The combined approach should be faster than using binary search for both functions (I suspect)? Alan g. From Jaco.Smuts@za.didata.com Mon Aug 26 13:42:26 2002 From: Jaco.Smuts@za.didata.com (Jaco.Smuts@za.didata.com) Date: Mon, 26 Aug 2002 14:42:26 +0200 Subject: [Tutor] urlparse question Message-ID: Hello there I am busy writing a small app to extract keywords (amongst other things) from search engine referer urls stored in a mysql database (using apache mod_log_sql). 1 - Please tell me if I'm re-inventing the wheel. 2 - If not , what I'm struggling with is to get the differnet url querystring parameters, what am I missing ? example: the url is http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=utf-8&q=south+africa+trav el+cape+town using urlparse I can get urlValue[0] = 'http' urlValue[1] = 'www.google.com' urlValue[2] = '/search' urlValue[3] = '' urlValue[4] = 'hl=en&lr=&ie=UTF-8&oe=utf-8&q=south+africa+travel+cape+town' urlValue[5] = '' What I'm looking for is a way (using a library, not regex if possible) to parse out of urlValue[4] hl='en' lr='' ie='UTF-8&oe=utf-8' q='south+africa+travel+cape+town' Any ideas ? Thanks in advance Jaco Smuts This message contains information intended solely for the addressee, which is confidential or private in nature and subject to legal privilege. If you are not the intended recipient, you may not peruse, use, disseminate, distribute or copy this message or any file attached to this message. Any such unauthorised use is prohibited and may be unlawful. If you have received this message in error, please notify the sender immediately by e-mail, facsimile or telephone and thereafter delete the original message from your machine. Furthermore, the information contained in this message, and any attachments thereto, is for information purposes only and may contain the personal views and opinions of the author, which are not necessarily the views and opinions of Dimension Data (South Africa) (Proprietary) Limited or is subsidiaries and associated companies ("Dimension Data"). Dimension Data therefore does not accept liability for any claims, loss or damages of whatsoever nature, arising as a result of the reliance on such information by anyone. Whilst all reasonable steps are taken to ensure the accuracy and integrity of information transmitted electronically and to preserve the confidentiality thereof, Dimension Data accepts no liability or responsibility whatsoever if information or data is, for whatsoever reason, incorrect, corrupted or does not reach its intended destination. From Blake.Garretson@dana.com Mon Aug 26 13:54:35 2002 From: Blake.Garretson@dana.com (Blake.Garretson@dana.com) Date: Mon, 26 Aug 2002 08:54:35 -0400 Subject: [Tutor] Re: complex numbers: j vs. i Message-ID: Kirk Bailey Wrote: >CAPITAL 'i' is current. >'I' >I=E/R (ohm's law) >'i' is used for indexing. hmmm. and here I have idle open. > >>>> >>>> i="index" >>>> I="'current'" Um, no. Not true. In engineering circles (especially electrical engineering), I/i is always current, regardless of case. Capital I is often used when writing equations, but lower case i is also used just as often, and is probably more frequently seen when diagramming Kirchhoff's current law. Since i is sacred, j was substituted for i in complex numbers. Electrical engineering calculations favor complex numbers because you can represent sinusoidal signals as complex numbers and eliminate the need for solving differential equations. Blake Garretson From erikprice@mac.com Mon Aug 26 14:17:02 2002 From: erikprice@mac.com (Erik Price) Date: Mon, 26 Aug 2002 09:17:02 -0400 Subject: [Tutor] urlparse question In-Reply-To: Message-ID: <1C36D9F5-B8F6-11D6-B10B-00039351FE6A@mac.com> On Monday, August 26, 2002, at 08:42 AM, Jaco.Smuts@za.didata.com wrote: > using urlparse I can get > > urlValue[0] = 'http' > urlValue[1] = 'www.google.com' > urlValue[2] = '/search' > urlValue[3] = '' > urlValue[4] = > 'hl=en&lr=&ie=UTF-8&oe=utf-8&q=south+africa+travel+cape+town' > urlValue[5] = '' > > What I'm looking for is a way (using a library, not regex if possible) > to > parse out of urlValue[4] > hl='en' > lr='' > ie='UTF-8&oe=utf-8' > q='south+africa+travel+cape+town' > > Any ideas ? qsDict = {} for pair in urlValue[4].split('&'): pair = pair.split('=') qsDict[pair[0]] = pair[1] This doesn't use a library, but it doesn't use regexes either, so it shouldn't be too slow. Still, there's probably a more elegant solution using lambdas or list comprehensions, but I'm still waiting to hear back on another thread so I can figure out how to use them! :) Erik PS: are you sure you wanted the "ie" variable to be "UTF-8&oe=utf-8", or was that a typo? Because my solution won't know that it should do that.... -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From alan.gauld@bt.com Mon Aug 26 14:03:31 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 26 Aug 2002 14:03:31 +0100 Subject: [Tutor] Python Cookbook Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C886@mbtlipnt02.btlabs.bt.co.uk> > I understood what map() and filter() do, but why are list > comprehensions better? 'Better' is a subjective term in most cases. Comprehensions do have a couple of advantages: 1) consistency, the one construct can do all that map.filter etc do 2) there are some things that you can do with comprehensions that are either impossible or very cumbersome using map/filter etc. > map(function, alist) > > can be better written using list comprehension as > > [function(x) for x in alist] I'm not sure I agree that the LC is better here, personally I think map is easier to read and understand(I nearly said comprehend! :-) but certainly they both do the same job and, I suspect, have virtually identical performance. Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From yduppen@xs4all.nl Mon Aug 26 14:54:55 2002 From: yduppen@xs4all.nl (Yigal Duppen) Date: Mon, 26 Aug 2002 15:54:55 +0200 Subject: [Tutor] Python Cookbook In-Reply-To: <4C3FDDF8-B8F1-11D6-B10B-00039351FE6A@mac.com> References: <4C3FDDF8-B8F1-11D6-B10B-00039351FE6A@mac.com> Message-ID: <200208261554.56687.yduppen@xs4all.nl> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > can now be done much more elegantly as: > > def method(self, argument, *args, **kw): > # Do something with argument > callable(*args, *kw) > > """ > > This must be a new form of callable(), because in my copy of Python > Essential Reference (for 2.1), callable() takes one parameter argument > that is an object. I believe that 'callable' here does not refer to the builtin 'callable' function, but instead serves as a placeholder for any callable object (i.e. any x for which 'callable(x)' is true). Not very clear, I agree. > I understood what map() and filter() do, but why are list comprehensions > better? FWIW, I don't really know exactly what a list comprehension is, > only that PER says that the following > > map(function, alist) > > can be better written using list comprehension as > > [function(x) for x in alist] > > -- why? In my case, the best reason for doing this is when you want to map methods on a set of objects. Example: class Foo: def __init__(self, x): self.x = x def getX(self): return self.x A fairly simple class, which only serves as an example. Now let's build a list of Foo objects: l = [ Foo(1), Foo(2), Foo(3), Foo(4), Foo(5), Foo(6) ] Now imagine I need a derived list, containing the value of all getX methods. Using map, there are two possible ways of doing this: derived = map(Foo.getX, l) or derived = map(lambda z: z.getX(), l) The first case only works if you're sure that the list l only contains objects of class Foo; if there are subclasses of Foo with an overridden method getX, the first example doesn't work. The second case requires constructing a new anonymous function; while I usually have no problem with lambdas, it seems that many people do. List comprehensions (LCs) provide a much better way of getting the derived list: derived = [ z.getX() for z in l ] As you can see, this requires no anonymous functions and is perfectly OO. The advantage of this becomes even clearer if you want to map AND filter. Let's say we only want the even values and that we have no 'odd' or 'even' function. derivedEven = filter(lambda n: n % 2 == 0, map(lambda z: z.getX(), l)) Argl! What does this do? All we have is the 'descriptive' variable name. derivedEven = [ z.getX() for z in l if z.getX() % 2 == 0 ] Much better! But then again, LCs are also a matter of taste :) YDD - -- http://www.xs4all.nl/~yduppen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9ajMwLsKMuCf5EdwRAsqwAKC0swPYqe9Bw+aMz9C0kdbnDwPS7wCg+kdP 5st8sTJ3nn54ReKRfafx0N8= =43il -----END PGP SIGNATURE----- From erikprice@mac.com Mon Aug 26 15:15:36 2002 From: erikprice@mac.com (Erik Price) Date: Mon, 26 Aug 2002 10:15:36 -0400 Subject: [Tutor] Python Cookbook In-Reply-To: <200208261554.56687.yduppen@xs4all.nl> Message-ID: <4AAD9FB5-B8FE-11D6-A9E4-00039351FE6A@mac.com> On Monday, August 26, 2002, at 09:54 AM, Yigal Duppen wrote: > List comprehensions (LCs) provide a much better way of getting the > derived > list: > derived = [ z.getX() for z in l ] > > As you can see, this requires no anonymous functions and is perfectly > OO. > > The advantage of this becomes even clearer if you want to map AND > filter. > Let's say we only want the even values and that we have no 'odd' or > 'even' > function. > > derivedEven = filter(lambda n: n % 2 == 0, map(lambda z: z.getX(), l)) > > Argl! What does this do? All we have is the 'descriptive' variable name. > > derivedEven = [ z.getX() for z in l if z.getX() % 2 == 0 ] > > Much better! But then again, LCs are also a matter of taste :) Ah... very clear now. I hadn't considered that LCs are useful because, like lambda, they don't require you to specify a specific type (such as in "derived = map(Foo.getX, l)"), so they can be useful in situations where you're trying to use polymorphism or something. Great example. But what -is- the problem that some people have with lambda? (You mention that you don't have a problem with it, but that implies that others do.) One last question -- in your final example above, you have an "if" statement FOLLOWING the "main" part of the list comprehension. Is this a normal Python construction or something that is allowed for list comprehensions only? I have seen that sort of construction in Perl: print "Correct" if ($correct); But I haven't seen it in Python. Thanks again. Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From alan.gauld@bt.com Mon Aug 26 13:46:46 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 26 Aug 2002 13:46:46 +0100 Subject: [Tutor] Hi All Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C884@mbtlipnt02.btlabs.bt.co.uk> > Hi could one or 2 of you help me with this I have gotten > this far I havnt got the hang of python yet but am > working on it . > Here it goes: > def getStuff(file) > info = open(file,"r") > infolines = info.readlines() > for line in infolines: > word = string.split(lines) Assuming the indentation wackiness is due to a cut n paste error (if not fix that first, Python is fussy about indentation). 'lines' does not exist here it should be 'line' - names must be consistent. print"Line %d contains %d words" % (linenum,len(word)) linenum += 1 linenum does not exist you need to initialise it at the top of the function: linenum = 1 # or zero? 'word' is a confusing name since its more than one word. Better would be to use words. These small changes make your code much easier to read. totalwords += len(words) words does not exiost here nor does totalwords. You will need to use 'word'(or change it to 'words' in the code above) and initialize totalwords at the top of the function. print "Total lines:", linenum - 1 print "Average words per line:", float(totalwords)/linenum - 1 You might want to use parens to disambiguate the calculation: print "Average words per line:", float(totalwords)/(linenum - 1) Or better since you calculate the same thing twice reset the variable: linenum = linenum -1 print "Total lines:", linenum print "Average words per line:", float(totalwords)/linenum HTH, Alan G. From shey@argonaut.com Mon Aug 26 15:39:31 2002 From: shey@argonaut.com (shey crompton) Date: Mon, 26 Aug 2002 15:39:31 +0100 Subject: [Tutor] Adjusting a file Message-ID: <415C917D807AD411B72C00805FF7330B03836406@MAILSRV> I have a file called Menu.txt located in C:\Python22 on my PC. I am trying to open the file, add a header, and then close it again. There's only one problem, when I run the script below, I get a syntax error the line after the except statement. I copied the script straight from How to Program Using Python. Incidentally, the script returned the same error message when I was just using 'Menu.txt' for the file as opposed to C:/Python22... Thanks for any help/tips. Shey import os, time try: menu=open('C:/Python22/Menu.txt','r') outf=open('C:/Python22/Menu.txt','w') header='Menu for %s' % time.ctime(time.time()) outf.write(header + '\n') lines = menu.readlines() for i in range(2,len(lines)): outf.write(lines[i]) outf.close() menu.close() os.rename('C:/Python22/Menu.txt', 'C:/Python22/Menu.bak') os.rename('C:/Python22/Menu.tmp', 'C:/Python22/Menu.txt') os.remove('C:/Python22/Menu.bak') except: print 'ERROR: Failed to create new menu' From yduppen@xs4all.nl Mon Aug 26 15:46:31 2002 From: yduppen@xs4all.nl (Yigal Duppen) Date: Mon, 26 Aug 2002 16:46:31 +0200 Subject: [Tutor] Python Cookbook In-Reply-To: <4AAD9FB5-B8FE-11D6-A9E4-00039351FE6A@mac.com> References: <4AAD9FB5-B8FE-11D6-A9E4-00039351FE6A@mac.com> Message-ID: <200208261646.31813.yduppen@xs4all.nl> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > But what -is- the problem that some people have with lambda? (You > mention that you don't have a problem with it, but that implies that > others do.) Most people favoring lambda have experience in Functional Programming, Lisp and/or lambda calculus; people disliking it don't. To them, it probably looks obscure. > One last question -- in your final example above, you have an "if" > statement FOLLOWING the "main" part of the list comprehension. Is this > a normal Python construction or something that is allowed for list > comprehensions only? I have seen that sort of construction in Perl: No, the trailing if is only allowed in LCs. Luckily. Furthermore, in LCs the if _must_ be trailing; for example, the following is illegal: [ x if x % 2 == 0 for x in [1,2,3]] otoh, the following is legal: [ x for x in [1, 2, 3, 4] if x % 2 == 0 and x < 4 ] > print "Correct" if ($correct); Indeed one of the more horrible examples from Perl ;) YDD - -- http://www.xs4all.nl/~yduppen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9aj9HLsKMuCf5EdwRAm/rAJ4iZBZZc4RkIbd/KFFPMgyQnwG90QCgpGBB Flm6MUe7uIKu+zaTxrsXJQw= =OoD1 -----END PGP SIGNATURE----- From alan.gauld@bt.com Mon Aug 26 17:13:06 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 26 Aug 2002 17:13:06 +0100 Subject: [Tutor] Adjusting a file Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C88D@mbtlipnt02.btlabs.bt.co.uk> > problem, when I run the script below, I get a syntax error > the line after the except statement. Not sure what that is but I think you have another problem... > import os, time > > try: > menu=open('C:/Python22/Menu.txt','r') > outf=open('C:/Python22/Menu.txt','w') I think this one should be "Menu.tmp" - otherwise you'll stamp all over the file you are reading - not a good idea! > os.rename('C:/Python22/Menu.txt', 'C:/Python22/Menu.bak') > os.rename('C:/Python22/Menu.tmp', 'C:/Python22/Menu.txt') And this line only makes sense if your new ffile is Menu.tmp... > except: > print 'ERROR: Failed to create new menu' Hmm, The except could mean several things aside from that but I guess it illustrates the idea OK. I can't see anything that would cause a syntax error... Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From shey@argonaut.com Mon Aug 26 17:53:50 2002 From: shey@argonaut.com (shey crompton) Date: Mon, 26 Aug 2002 17:53:50 +0100 Subject: [Tutor] Adjusting a file Message-ID: <415C917D807AD411B72C00805FF7330B03836407@MAILSRV> Thanks Alan. The outf line should have been writing to Menu.tmp. When I changed the suffix to .tmp everything ran correctly. One of these days I'll learn how to read! :-) -----Original Message----- From: alan.gauld@bt.com [mailto:alan.gauld@bt.com] Sent: 26 August 2002 17:13 To: shey@argonaut.com; tutor@python.org Subject: RE: [Tutor] Adjusting a file > problem, when I run the script below, I get a syntax error > the line after the except statement. Not sure what that is but I think you have another problem... > import os, time > > try: > menu=open('C:/Python22/Menu.txt','r') > outf=open('C:/Python22/Menu.txt','w') I think this one should be "Menu.tmp" - otherwise you'll stamp all over the file you are reading - not a good idea! > os.rename('C:/Python22/Menu.txt', 'C:/Python22/Menu.bak') > os.rename('C:/Python22/Menu.tmp', 'C:/Python22/Menu.txt') And this line only makes sense if your new ffile is Menu.tmp... > except: > print 'ERROR: Failed to create new menu' Hmm, The except could mean several things aside from that but I guess it illustrates the idea OK. I can't see anything that would cause a syntax error... Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From dyoo@hkn.eecs.berkeley.edu Mon Aug 26 19:04:24 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 26 Aug 2002 11:04:24 -0700 (PDT) Subject: [Tutor] urlparse question In-Reply-To: Message-ID: On Mon, 26 Aug 2002 Jaco.Smuts@za.didata.com wrote: > Hello there > > I am busy writing a small app to extract keywords (amongst other things) > from search engine referer urls stored in a mysql database (using apache > mod_log_sql). > > 1 - Please tell me if I'm re-inventing the wheel. You're reinventing the wheel. *grin* > 2 - If not , what I'm struggling with is to get the differnet url > querystring parameters, what am I missing ? > > example: > the url is > http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=utf-8&q=south+africa+trav > el+cape+town The function cgi.parse_qs() will parse out a query string for you: ### >>> query_string = "hl=en&lr=&ie=UTF-8&oe=utf-8&q=south+africa+travel+cape+town">>> import cgi >>> dict = cgi.parse_qs(query_string) >>> dict {'hl': ['en'], 'ie': ['UTF-8'], 'oe': ['utf-8'], 'q': ['south africa travel cape town']} ### See: http://www.python.org/doc/lib/node298.html for more information on cgi.parse_qs(). I am a bit concerned, though, that this function wasn't easy to find; the url parsing stuff seems distributed among the urlparse and cgi modules --- I think it would be better if they were consolidated into the urlparse module! I'll add a feature request on Sourceforge to see if it's possible to move that function over to urlparse. Good luck! From jchilders_98@yahoo.com Mon Aug 26 19:55:02 2002 From: jchilders_98@yahoo.com (J. Childers) Date: Mon, 26 Aug 2002 11:55:02 -0700 (PDT) Subject: [Tutor] MySQLdb on Windows? Message-ID: <20020826185502.15321.qmail@web13901.mail.yahoo.com> What's the trick for getting MySQLdb running on Windows? After spending several hours prepping this weekend I finally got to the installation/setup instructions that come with MySQLdb only to find the following comments in the setup by platform notes: "Windows installation instructions: I don't do Windows." Ok, does this module even work under Windows? If so, what do I need to do to get it installed properly? Thanks, JC __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From max_ig@yahoo.com Mon Aug 26 20:03:12 2002 From: max_ig@yahoo.com (MIG) Date: Mon, 26 Aug 2002 12:03:12 -0700 (PDT) Subject: [Tutor] MySQLdb on Windows? In-Reply-To: <20020826185502.15321.qmail@web13901.mail.yahoo.com> Message-ID: <20020826190312.26727.qmail@web11304.mail.yahoo.com> I'm using MySQLdb on Windows with no problem. How did I get it running??? I insalled it and in any module just used import MySQLdb. There are a pdf file on the net very useful with many examples. (I don't have the url here because I don't have my computer here, sorry. But try Google). Good luck. Max --- "J. Childers" wrote: > What's the trick for getting MySQLdb running on Windows? After > spending several hours prepping > this weekend I finally got to the installation/setup instructions > that come with MySQLdb only to > find the following comments in the setup by platform notes: > > "Windows installation instructions: I don't do Windows." > > Ok, does this module even work under Windows? If so, what do I need > to do to get it installed > properly? > > Thanks, > > JC > > __________________________________________________ > Do You Yahoo!? > Yahoo! Finance - Get real-time stock quotes > http://finance.yahoo.com > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From bwinton@latte.ca Mon Aug 26 20:20:21 2002 From: bwinton@latte.ca (Blake Winton) Date: Mon, 26 Aug 2002 15:20:21 -0400 Subject: [Tutor] urlparse question In-Reply-To: References: Message-ID: <20020826192021.GA26749@latte.ca> * Danny Yoo [020826 14:05]: ### >>> query_string = "hl=en&lr=&ie=UTF-8&oe=utf-8&q=south+africa+travel+cape+town" >>> import cgi >>> dict = cgi.parse_qs(query_string) >>> dict {'hl': ['en'], 'ie': ['UTF-8'], 'oe': ['utf-8'], 'q': ['south africa travel cape town']} ### You might want to notice that it's completely lost the "lr=" part of the query string. If that's important to you, you may need to reinvent the wheel. Later, Blake. -- 9:40pm up 52 days, 21:07, 2 users, load average: 0.02, 0.09, 0.07 From dyoo@hkn.eecs.berkeley.edu Mon Aug 26 21:55:20 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 26 Aug 2002 13:55:20 -0700 (PDT) Subject: [Tutor] urlparse question In-Reply-To: <20020826192021.GA26749@latte.ca> Message-ID: On Mon, 26 Aug 2002, Blake Winton wrote: > * Danny Yoo [020826 14:05]: > ### > >>> query_string = > "hl=en&lr=&ie=UTF-8&oe=utf-8&q=south+africa+travel+cape+town" > >>> import cgi > >>> dict = cgi.parse_qs(query_string) > >>> dict > {'hl': ['en'], 'ie': ['UTF-8'], 'oe': ['utf-8'], > 'q': ['south africa travel cape town']} > ### > > You might want to notice that it's completely lost the "lr=" part of the > query string. If that's important to you, you may need to reinvent the > wheel. Good eye! I didn't notice that 'lr' didn't have a value in the dictionary. Thankfully, we can still take advantage cgi.quote_qs() because it can take in an optional parameter to keep even the empty parameters: ### >>> cgi.parse_qs(query_string, keep_blank_values = 1) {'hl': ['en'], 'ie': ['UTF-8'], 'oe': ['utf-8'], 'lr': [''], 'q': ['south africa travel cape town']} ### Hope this helps! From dyoo@hkn.eecs.berkeley.edu Mon Aug 26 22:03:26 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 26 Aug 2002 14:03:26 -0700 (PDT) Subject: [Tutor] MySQLdb on Windows? In-Reply-To: <20020826185502.15321.qmail@web13901.mail.yahoo.com> Message-ID: On Mon, 26 Aug 2002, J. Childers wrote: > What's the trick for getting MySQLdb running on Windows? After spending several hours prepping > this weekend I finally got to the installation/setup instructions that come with MySQLdb only to > find the following comments in the setup by platform notes: > > "Windows installation instructions: I don't do Windows." > > Ok, does this module even work under Windows? If so, what do I need to > do to get it installed properly? Hello JC, Yes, it should work under Windows; you probably downloaded the source code distribution by accident. Instaed, you'll want to get the 0.9.1 Windows-specific files. You can find them here: http://sourceforge.net/project/showfiles.php?group_id=22307&release_id=102893 (0.9.2 is new enough that I don't think anyone has had time to package them for Windows yet; you may want to contact the MySQLdb mailing list to see if anyone's willing to do this. You can probably check http://sourceforge.net/forum/forum.php?forum_id=70461 and I'm sure someone can help you with this.) People have contributed packaged modules for Windows which can be run as a regular installer. Since you're running Windows, you can ignore those other 'tar.gz' and 'rpm' Unix/Linux specific files. You'll want to get one of the following files: MySQL-python-0.9.1.win32-py1.5.exe MySQL-python-0.9.1.win32-py2.0.exe MySQL-python-0.9.1.win32-py2.1.exe MySQL-python-0.9.1.win32-py2.2.exe The modules are Python version specific, so you'll want to make sure you get the right one. Otherwise, everything should be good. Good luck! From jchilders@smartITservices.com Mon Aug 26 13:56:59 2002 From: jchilders@smartITservices.com (Jeff Childers) Date: Mon, 26 Aug 2002 08:56:59 -0400 Subject: [Tutor] Lost Modules? Message-ID: <9C067B997594D3118BF50050DA24EA1097D36E@CCG2> Hi Gus, Whew, thanks for the pointer. I'm not so much pulling my hair out now -- it can be very frustrating to fail at the most simple tasks when trying to learn a new language. Makes you want to just go back to your old language... :) Anyway, onward ho! Regards (and thanks again), Jeff -----Original Message----- From: Gus Tabares [mailto:gus.tabares@verizon.net] Sent: Saturday, August 24, 2002 1:57 PM To: J. Childers Subject: RE: [Tutor] Lost Modules? Hello, You can set your PYTHONPATH to include whatever directory you're importing modules from so python knows where to grab them. Assumming you're working under Win9x, under MS-DOS try typing this: set PYTHONPATH=.,c:\python\lib;c:\python\lib\tkinter;c:\whateverdiryouwant That should settle your importing problem. If not, let me know:) Hope this helps, Gus -----Original Message----- From: J. Childers [mailto:jchilders_98@yahoo.com] Sent: Saturday, August 24, 2002 10:37 AM To: Gus Tabares Subject: RE: [Tutor] Lost Modules? Hi Gus, It seems I needed to learn how to sys.path.append( os.getcwd()). I had been assuming that by using os.chdir(dir) Python would find my working files in the os.getcwd() location. Not so apparently. Would changing PYTHONPATH include my working directory in the default path? (with the method above I have to change it each time I start a new session). How do I find my PYTHONPATH? Thanks Gus, Jeff --- Gus Tabares wrote: > Hello, > > What is your PYTHONPATH set to? > > > Gus > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > J. Childers > Sent: Friday, August 23, 2002 3:11 PM > To: tutor@python.org > Subject: [Tutor] Lost Modules? > > > Hi, > > I am at my wits end trying to learn Python. When I create a module > ("mymod.py") and then try to > import it, Python tells me it cannot find a module of that name. > > "Import can't find module, or can't find name in module: No module > named mymod" > > Yet it is there, in the directory named in os.getcwd(). What the heck am I > doing wrong? This > behavior is consistent for any modules I create. Arg! > > Jeff > > __________________________________________________ > Do You Yahoo!? > Yahoo! Finance - Get real-time stock quotes > http://finance.yahoo.com > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From Morne" This is a multi-part message in MIME format. ------=_NextPart_000_0035_01C24D21.0B279C40 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0036_01C24D21.0B30C400" ------=_NextPart_001_0036_01C24D21.0B30C400 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi all Im not only looking for the answer but also want to learn for myself, I = just need some kind of a guide line. How and where would I start to make a program that can read the attached = ppp.log file and give me the following type of report: PPP Log file summary for 5 Jul 2002 ----------------------------------- Jul 5 18:15:01 Connected to internet (IP 155.239.150.146) Jul 5 18:18:08 Closed connection. ( Connect time: 197 secs: 5091 octets = in, 1864 octets out ) ----------------------------------- Successful connections: 5 Failed connections: 2 Total time online: 456 seconds Total data in: 66576 octets Total Data out: 66349 octets The lines in the file that you will use look like this: Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: myaddr 155.239.150.146 hisaddr =3D 155.239.150.254 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: Connect time: 197 secs: 5091 octets in, 1864 octets out Jul 6 06:30:44 maxigate ppp[34607]: tun0: Warning: Chat script failed Thanx alot=20 Morne ------=_NextPart_001_0036_01C24D21.0B30C400 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi all
Im not only looking for the answer but = also want to=20 learn for myself, I just need some kind of a guide line.
 
 
How and where would I start to make a = program that=20 can read the attached ppp.log file and give me the
following type of=20 report:


PPP Log file summary for 5 Jul=20 2002
-----------------------------------
Jul  5 18:15:01 = Connected to=20 internet (IP 155.239.150.146)
Jul  5 18:18:08 Closed connection. = (=20 Connect time: 197 secs: 5091 octets in,
1864 octets out=20 )
-----------------------------------
Successful connections: = 5
Failed=20 connections: 2
Total time online: 456 seconds
Total data in: 66576 = octets
Total Data out: 66349 octets




The lines in = the file=20 that you will use look like this:

Jul  5 18:45:31 maxigate=20 ppp[34607]: tun0: IPCP: myaddr 155.239.150.146
hisaddr =3D=20 155.239.150.254
Jul  5 18:48:48 maxigate ppp[34607]: tun0: IPCP: = Connect=20 time: 197 secs:
5091 octets in, 1864 octets out
Jul  6 = 06:30:44=20 maxigate ppp[34607]: tun0: Warning: Chat script failed
 
Thanx alot
Morne

------=_NextPart_001_0036_01C24D21.0B30C400-- ------=_NextPart_000_0035_01C24D21.0B279C40 Content-Type: text/plain; name="pp.log01.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="pp.log01.txt" Jul 5 18:00:00 maxigate newsyslog[87300]: logfile turned over Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = quit=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection dropped.=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = set timeout 180=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = dial=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: bundle: Establish=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: deflink: closed -> = opening=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: deflink: Connected!=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: deflink: opening -> = dial=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: Phone: 0860007249=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: deflink: Dial attempt 1 = of 1=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection closed.=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: Send: AT^M=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: Received: AT^M^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Send: ATE1Q0^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Received: ATE1Q0^M^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Send: = ATx1DT0860007249^M=20 Jul 5 18:15:03 maxigate ppp[34607]: tun0: Chat: Expect(40): CONNECT=20 Jul 5 18:15:22 maxigate ppp[34607]: tun0: Chat: Received: = ATx1DT0860007249^M^M=20 Jul 5 18:15:22 maxigate ppp[34607]: tun0: Chat: Received: CONNECT = 33600/ARQ/V34/LAPM/V42BIS^M=20 Jul 5 18:15:22 maxigate ppp[34607]: tun0: Phase: deflink: dial -> = carrier=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: Phase: deflink: /dev/cuaa0: = CD detected=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: Phase: deflink: carrier -> = login=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: Phase: deflink: login -> lcp=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: LCP: FSM: Using "deflink" as = a transport=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Initial --> Closed=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Stopped=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: deflink: LayerStart=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Stopped=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: deflink: State change = Stopped --> Req-Sent=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Req-Sent=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Req-Sent=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Req-Sent=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Req-Sent=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: LCP: deflink: LayerFinish=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: LCP: deflink: State change = Req-Sent --> Stopped=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: LCP: deflink: State change = Stopped --> Closed=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Initial=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: lcp -> logout = Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: logout -> = hangup=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: Connect time: = 40 secs: 0 octets in, 265 octets out=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: : 1079435 = packets in, 231579 packets out=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: total 6 bytes/sec, = peak 21 bytes/sec on Fri Jul 5 18:15:40 2002=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: hangup -> = closed=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: bundle: Dead=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = quit=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection dropped.=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = set timeout 180=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = dial=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: bundle: Establish=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: deflink: closed -> = opening=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: deflink: Connected!=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: deflink: opening -> = dial=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Phone: 0860007249=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: deflink: Dial attempt 1 = of 1=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection closed.=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Send: AT^M=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Received: AT^M^M=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Send: ATE1Q0^M=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 5 18:45:01 maxigate ppp[34607]: tun0: Chat: Received: ATE1Q0^M^M=20 Jul 5 18:45:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 5 18:45:01 maxigate ppp[34607]: tun0: Chat: Send: = ATx1DT0860007249^M=20 Jul 5 18:45:03 maxigate ppp[34607]: tun0: Chat: Expect(40): CONNECT=20 Jul 5 18:45:22 maxigate ppp[34607]: tun0: Chat: Received: = ATx1DT0860007249^M^M=20 Jul 5 18:45:22 maxigate ppp[34607]: tun0: Chat: Received: CONNECT = 33600/ARQ/V34/LAPM/V42BIS^M=20 Jul 5 18:45:22 maxigate ppp[34607]: tun0: Phase: deflink: dial -> = carrier=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: Phase: deflink: /dev/cuaa0: = CD detected=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: Phase: deflink: carrier -> = login=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: Phase: deflink: login -> lcp=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: LCP: FSM: Using "deflink" as = a transport=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Initial --> Closed=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Stopped=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: deflink: LayerStart=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Stopped=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xd52c5683=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: deflink: State change = Stopped --> Req-Sent=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigReq(7) state =3D Req-Sent=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x58cf83ad=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigAck(7) state =3D Req-Sent=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x58cf83ad=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: deflink: State change = Req-Sent --> Ack-Sent=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Ack-Sent=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xd52c5683=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xd52c5683=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigReq(8) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x58cf933e=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigAck(8) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x58cf933e=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigAck(179) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: State change = Ack-Sent --> Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: LayerUp=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: Sending ident magic = d52c5683 text user-ppp 2.3 (built Apr 26 2001)=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: SendIdent(180) = state =3D Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: bundle: Authenticate=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: deflink: his =3D PAP, = mine =3D none=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: Pap Output: itec79 = ********=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: Pap Input: SUCCESS ()=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: Using trigger address = 0.0.0.0=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: FSM: Using "deflink" as = a transport=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Initial --> Closed=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: LayerStart.=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: MPPE: Not usable without = CHAP81=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: = SendConfigReq(1) state =3D Closed=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: DEFLATE[4] win 15=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: PRED1[2] =20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Closed --> Req-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: deflink: lcp -> open=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: bundle: Network=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: FSM: Using "deflink" as = a transport=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Initial --> Closed=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: LayerStart.=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(103) state =3D Closed=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] 0.0.0.0=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: COMPPROTO[6] 16 VJ = slots with slot compression=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Closed --> Req-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigReq(188) state =3D Req-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.254=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigAck(188) state =3D Req-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.254=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Req-Sent --> Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvProtocolRej(9) state =3D Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: -- Protocol = 0x80fd (Compression Control Protocol) was rejected!=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Req-Sent --> Stopped=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigRej(103) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: Sending ident magic = d52c5683 text user-ppp 2.3 (built Apr 26 2001)=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: SendIdent(181) = state =3D Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: COMPPROTO[6] 16 VJ = slots with slot compression=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(104) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] 0.0.0.0=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigNak(104) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.146=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] changing = address: 0.0.0.0 --> 155.239.150.146=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(105) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.146=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigAck(105) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Ack-Sent --> Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: LayerUp.=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: myaddr 155.239.150.146 = hisaddr =3D 155.239.150.254=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Command: maxigate: !bg = /usr/local/sys/linkup=20 Jul 5 18:46:33 maxigate ppp[34607]: tun0: Phase: deflink: HDLC errors = -> FCS: 2, ADDR: 0, COMD: 0, PROTO: 0=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: Idle timer expired=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: LayerDown: = 155.239.150.146=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Command: maxigate: iface = clear=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: Using trigger address = 0.0.0.0=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: = SendTerminateReq(106) state =3D Opened=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Opened --> Closing=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvTerminateAck(106) state =3D Closing=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: LayerFinish.=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: Connect time: 197 secs: = 5091 octets in, 1864 octets out=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: : 234569 packets in, = 230304 packets out=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: total 35 bytes/sec, = peak 815 bytes/sec on Fri Jul 5 18:48:48 2002=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Closing --> Closed=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: bundle: Terminate=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: CCP: deflink: State change = Stopped --> Closed=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: CCP: deflink: State change = Closed --> Initial=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: LayerDown=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: = SendTerminateReq(180) state =3D Opened=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: State change = Opened --> Closing=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: open -> lcp=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Closed --> Initial=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: = RecvTerminateAck(180) state =3D Closing=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: LayerFinish=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closing --> Closed=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Initial=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: lcp -> logout = Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: logout -> = hangup=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: Connect time: = 228 secs: 6795 octets in, 2567 octets out=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: : 1079551 = packets in, 231625 packets out=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: total 41 bytes/sec, = peak 840 bytes/sec on Fri Jul 5 18:48:48 2002=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: hangup -> = closed=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: bundle: Dead=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Command: /var/run/internet: = quit=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection dropped.=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Command: /var/run/internet: = set timeout 180=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Command: /var/run/internet: = dial=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: bundle: Establish=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: deflink: closed -> = opening=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: deflink: Connected!=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: deflink: opening -> = dial=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Phone: 0860007249=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: deflink: Dial attempt 1 = of 1=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection closed.=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Send: AT^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Received: AT^M^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Send: ATE1Q0^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Received: ATE1Q0^M^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Send: = ATx1DT0860007249^M=20 Jul 6 06:30:03 maxigate ppp[34607]: tun0: Chat: Expect(40): CONNECT=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Chat: Expect timeout=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Warning: Chat script failed=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: dial -> = hangup=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: Connect time: = 43 secs: 0 octets in, 0 octets out=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: : 1079551 = packets in, 231625 packets out=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: total 0 bytes/sec, = peak 0 bytes/sec on Sat Jul 6 06:30:44 2002=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: hangup -> = closed=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: bundle: Dead=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = quit=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection dropped.=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = set timeout 180=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = dial=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: bundle: Establish=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: deflink: closed -> = opening=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: deflink: Connected!=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: deflink: opening -> = dial=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Phone: 0860007249=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: deflink: Dial attempt 1 = of 1=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection closed.=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Send: AT^M=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Received: = ATx1DT0860007249^MAT^M^M=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Send: ATE1Q0^M=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 6 08:30:01 maxigate ppp[34607]: tun0: Chat: Received: ATE1Q0^M^M=20 Jul 6 08:30:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 6 08:30:01 maxigate ppp[34607]: tun0: Chat: Send: = ATx1DT0860007249^M=20 Jul 6 08:30:03 maxigate ppp[34607]: tun0: Chat: Expect(40): CONNECT=20 Jul 6 08:30:22 maxigate ppp[34607]: tun0: Chat: Received: = ATx1DT0860007249^M^M=20 Jul 6 08:30:22 maxigate ppp[34607]: tun0: Chat: Received: CONNECT = 33600/ARQ/V34/LAPM/V42BIS^M=20 Jul 6 08:30:22 maxigate ppp[34607]: tun0: Phase: deflink: dial -> = carrier=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: Phase: deflink: /dev/cuaa0: = CD detected=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: Phase: deflink: carrier -> = login=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: Phase: deflink: login -> lcp=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: LCP: FSM: Using "deflink" as = a transport=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Initial --> Closed=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Stopped=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: deflink: LayerStart=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(181) state =3D Stopped=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x0cd05494=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: deflink: State change = Stopped --> Req-Sent=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigReq(204) state =3D Req-Sent=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x5bc3012a=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigAck(204) state =3D Req-Sent=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x5bc3012a=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: deflink: State change = Req-Sent --> Ack-Sent=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(181) state =3D Ack-Sent=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x0cd05494=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(181) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x0cd05494=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigReq(205) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x5bc310bd=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigAck(205) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x5bc310bd=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigAck(181) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: State change = Ack-Sent --> Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: LayerUp=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: Sending ident magic = 0cd05494 text user-ppp 2.3 (built Apr 26 2001)=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: SendIdent(182) = state =3D Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: bundle: Authenticate=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: deflink: his =3D PAP, = mine =3D none=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: Pap Output: itec79 = ********=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: Pap Input: SUCCESS ()=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: Using trigger address = 0.0.0.0=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: FSM: Using "deflink" as = a transport=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Initial --> Closed=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: LayerStart.=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: MPPE: Not usable without = CHAP81=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: = SendConfigReq(1) state =3D Closed=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: DEFLATE[4] win 15=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: PRED1[2] =20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Closed --> Req-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: deflink: lcp -> open=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: bundle: Network=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: FSM: Using "deflink" as = a transport=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Initial --> Closed=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: LayerStart.=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(107) state =3D Closed=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] 0.0.0.0=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: COMPPROTO[6] 16 VJ = slots with slot compression=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Closed --> Req-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigReq(204) state =3D Req-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.254=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigAck(204) state =3D Req-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.254=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Req-Sent --> Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvProtocolRej(206) state =3D Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: -- Protocol = 0x80fd (Compression Control Protocol) was rejected!=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Req-Sent --> Stopped=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigRej(107) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: Sending ident magic = 0cd05494 text user-ppp 2.3 (built Apr 26 2001)=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: SendIdent(183) = state =3D Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: COMPPROTO[6] 16 VJ = slots with slot compression=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(108) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] 0.0.0.0=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigNak(108) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.26=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] changing = address: 0.0.0.0 --> 155.239.150.26=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(109) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.26=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigAck(109) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Ack-Sent --> Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: LayerUp.=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: myaddr 155.239.150.26 = hisaddr =3D 155.239.150.254=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Command: maxigate: !bg = /usr/local/sys/linkup=20 Jul 6 08:31:32 maxigate ppp[34607]: tun0: Phase: deflink: HDLC errors = -> FCS: 2, ADDR: 0, COMD: 0, PROTO: 0=20 ------=_NextPart_000_0035_01C24D21.0B279C40-- From jtk@yahoo.com Mon Aug 26 18:23:17 2002 From: jtk@yahoo.com (Jeff Kowalczyk) Date: Mon, 26 Aug 2002 13:23:17 -0400 Subject: [Tutor] converting a range to a list of lists where first list is one element shorter Message-ID: I want to parameterize a range A to B, e.g. [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] to a list of lists of length parameter N (e.g. 7), but with the first list of length N-1, e.g. [[1,2,3,4,5,6],[7,8,9,10,11,12,13],[14,15,16,17,18,19,20]] I'd like to do this in a pythonic way, without regressing to integer loop counters, temporary variables, explicit indexing and such, but my knowledge of generators and list comprehension isn't fully er, comprehended yet. Does anyone have a tip on how to approach this in python 2.1 (and 2.2, if there would be a difference between the two versions because of new 2.2 features)? Thanks. From lsloan@umich.edu Mon Aug 26 22:32:44 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Mon, 26 Aug 2002 17:32:44 -0400 Subject: [Tutor] urlparse question In-Reply-To: <20020826192021.GA26749@latte.ca> References: <20020826192021.GA26749@latte.ca> Message-ID: <19298233.1030383164@[10.0.1.16]> --On Monday, August 26, 2002 3:20 PM -0400 Blake Winton wrote: > * Danny Yoo [020826 14:05]: >### >>>> query_string = > "hl=en&lr=&ie=UTF-8&oe=utf-8&q=south+africa+travel+cape+town" >>>> import cgi >>>> dict = cgi.parse_qs(query_string) >>>> dict > {'hl': ['en'], 'ie': ['UTF-8'], 'oe': ['utf-8'], > 'q': ['south africa travel cape town']} >### > > You might want to notice that it's completely lost the "lr=" part > of the query string. If that's important to you, you may need to > reinvent the wheel. Hmm... That's a pity. I think it would be more useful if it set dict['lr'] = None or []. -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From dman@dman.ddts.net Mon Aug 26 22:47:23 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Mon, 26 Aug 2002 17:47:23 -0400 Subject: [Tutor] Re: books arrived In-Reply-To: <3D69A8CD.9A6D349@netzero.net> References: <3D686911.234852A6@netzero.net> <70901471896.20020825113416@inkedmn.net> <3D69A8CD.9A6D349@netzero.net> Message-ID: <20020826214723.GA26440@dman.ddts.net> --LQksG6bCIzRHxTLp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 26, 2002 at 12:04:29AM -0400, Kirk Bailey wrote: | Syntax is ok, but the modules I need to study more. and alas, I am stuck | for the time being with 1.5.2, my hardware guru says we would have to | upgrade critter to handle the new version. Heh. The hardware guy says you need more juice. Let me tell you about NOT _need_ing more juice. I have a 486sx here with 8MB RAM and a 320 MB hard drive. If I wanted to, I could install python and run scripts. I haven't because I have another machine that doesn't thrash so much, but I _could_ run python on it. I'm sure whatever system you have it is better than that 486 :-). -D --=20 There is not a righteous man on earth who does what is right and never sins. Ecclesiastes 7:20 =20 http://dman.ddts.net/~dman/ --LQksG6bCIzRHxTLp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1qoesACgkQO8l8XBKTpRTIOgCgrz8dnGOpRXK7WpePcv3sWOVd 7FkAnimvdphjbZtKdvlxF2rk7KQIof0j =DOu9 -----END PGP SIGNATURE----- --LQksG6bCIzRHxTLp-- From dyoo@hkn.eecs.berkeley.edu Mon Aug 26 22:34:09 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 26 Aug 2002 14:34:09 -0700 (PDT) Subject: [Tutor] converting a range to a list of lists where ... [simplifying a problem / functions / list slices] In-Reply-To: Message-ID: On Mon, 26 Aug 2002, Jeff Kowalczyk wrote: > I want to parameterize a range A to B, e.g. > [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] > > to a list of lists of length parameter N (e.g. 7), but with the first list > of length N-1, e.g. > [[1,2,3,4,5,6],[7,8,9,10,11,12,13],[14,15,16,17,18,19,20]] > > I'd like to do this in a pythonic way, without regressing to integer > loop counters, temporary variables, explicit indexing and such, but my > knowledge of generators and list comprehension isn't fully er, > comprehended yet. Hmmm... I'd discourage a list comprehension approach for this problem, because this problem isn't quite doing a mapping or a filtering operation on our list. That is, we're not transforming individual elements of our list into new elements, but rather are clumping them together. I also feel that generators would not be of much help on this one, but I could be wrong on this. Consequently, I think I'd go for an integer loop counter and explicit list slicing on this one. *grin* Seriously, they aren't bad tools! Comprehensions are just shortcuts, and we don't always have to use them. In fact, if we're straining to stretch list comprehensions, we're probably complicating matters. Let's simplify your problem for the moment: let's say that we just wanted to take a list and break it into sublists of length 'N'. (We'll deal with that first sublist length restriction in a moment.) If we go at the simpler problem, then defining a sublist grouping function isn't bad at all: ### >>> def group_sublists(mylist, N): ... sublists = [] ... i = 0 ... while i < len(mylist): ... sublists.append(mylist[i:i+N]) ... i = i + N ... return sublists ... >>> group_sublists(range(20), 5) [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19]] ### While this doesn't solve the immediate problem, it's fairly close. The reason why it's nice to go after this simpler problem fist is because we can now apply it toward your full problem in a pretty way: ### >>> def group_special(mylist, N): ... return [mylist[:N-1]] + group_sublists(mylist[N-1:], N) ... >>> group_special(range(20), 7) [[0, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18, 19]] ### No mess, no fuss. *grin* I hope this helps! From cyberdiction@hotmail.com Mon Aug 26 22:30:52 2002 From: cyberdiction@hotmail.com (Stephen Harris) Date: Mon, 26 Aug 2002 14:30:52 -0700 Subject: [Tutor] Beginner-->conditional statements Message-ID: This is a multi-part message in MIME format. ------=_NextPart_000_004E_01C24D0D.2E3C1BC0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Howdy Pilgrims, I've decided to learn Python as my first programming=20 language, though I dabbled with Perl. This email is a=20 bit of a test. Python installed and I've made Hello World. One reason I picked Python was because Tutor promoted a helpful mailing list. Also does anyone know of a tutorial(which dwells upon) that covers those conditional statements in some detail with some graduating problems and solutions? Python=20 would be best, but if conditional statements work about=20 the same in other languages then that would work if the=20 logic of constructing them is covered. Best regards, Stephen ------=_NextPart_000_004E_01C24D0D.2E3C1BC0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Howdy Pilgrims,
 
I've decided to learn Python as my = first=20 programming
language, though I dabbled with Perl. = This email is a
bit of a test. Python installed and = I've made Hello=20 World.
One reason I picked Python was = because Tutor=20 promoted
a helpful mailing list.
 
Also does anyone know of a = tutorial(which dwells=20 upon)
that covers those conditional = statements in some=20 detail
with some graduating problems and = solutions? Python=20
would be best, but=20 if conditional statements work about
the same in other=20 languages then that would work if the
logic of=20 constructing them is covered.
 
Best regards,
Stephen
------=_NextPart_000_004E_01C24D0D.2E3C1BC0-- From dman@dman.ddts.net Mon Aug 26 22:50:38 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Mon, 26 Aug 2002 17:50:38 -0400 Subject: [Tutor] printing monetary values Message-ID: <20020826215038.GB26440@dman.ddts.net> --BwCQnh7xodEAoBMC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I just know I've seen mention before of a library function that properly formats money as a string, but I can't seem to find it anywhere. I want to receive a NUMERIC(15,2) data from a SQL database (eg, 3275.68) and have it displayed as $3,275.68. (dollar sign, commas, and decimal) I've searched the Vaults of Parnassus, the 'locale' module, and comp.lang.python, but didn't find anything except a few partial examples of how to implement it myself. TIA, -D --=20 The heart is deceitful above all things and beyond cure. Who can understand it? =20 I the Lord search the heart and examine the mind, to reward a man according to his conduct, according to what his deeds deserve. =20 Jeremiah 17:9-10 =20 http://dman.ddts.net/~dman/ --BwCQnh7xodEAoBMC Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1qoq4ACgkQO8l8XBKTpRSqnQCdGqXc/09KFFerJNKuyBNcEFh/ YxcAoMxO9n7PkuKXWvOqCrauXpEqdzzG =Sf8L -----END PGP SIGNATURE----- --BwCQnh7xodEAoBMC-- From shalehperry@attbi.com Mon Aug 26 22:51:01 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Mon, 26 Aug 2002 14:51:01 -0700 Subject: [Tutor] printing monetary values In-Reply-To: <20020826215038.GB26440@dman.ddts.net> References: <20020826215038.GB26440@dman.ddts.net> Message-ID: <200208261451.01959.shalehperry@attbi.com> On Monday 26 August 2002 02:50 pm, Derrick 'dman' Hudson wrote: > I just know I've seen mention before of a library function that > properly formats money as a string, but I can't seem to find it > anywhere. I want to receive a NUMERIC(15,2) data from a SQL database > (eg, 3275.68) and have it displayed as $3,275.68. (dollar sign, > commas, and decimal) I've searched the Vaults of Parnassus, the > 'locale' module, and comp.lang.python, but didn't find anything except > a few partial examples of how to implement it myself. > > TIA, > -D import locale locale.setlocale(locale.LC_ALL, "") # sets locale to the currently define= d # value in the user's enviro= nment locale_info =3D locale.localeconv() currency =3D locale_info['currency_symbol'] # now that we have the currency symbol we call locale.format() # to transform the number into a pretty string total =3D 3275.68 print total: "%s%s\n" % (currency, locale.format("%0.2f", total, 1)) From dman@dman.ddts.net Tue Aug 27 00:42:13 2002 From: dman@dman.ddts.net (Derrick 'dman' Hudson) Date: Mon, 26 Aug 2002 19:42:13 -0400 Subject: [Tutor] Re: printing monetary values In-Reply-To: <200208261451.01959.shalehperry@attbi.com> References: <20020826215038.GB26440@dman.ddts.net> <200208261451.01959.shalehperry@attbi.com> Message-ID: <20020826234213.GA27660@dman.ddts.net> --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 26, 2002 at 02:51:01PM -0700, Sean 'Shaleh' Perry wrote: | On Monday 26 August 2002 02:50 pm, Derrick 'dman' Hudson wrote: | > I just know I've seen mention before of a library function that | > properly formats money as a string, but I can't seem to find it | > anywhere. I want to receive a NUMERIC(15,2) data from a SQL database | > (eg, 3275.68) and have it displayed as $3,275.68. (dollar sign, | > commas, and decimal) I've searched the Vaults of Parnassus, the | > 'locale' module, and comp.lang.python, but didn't find anything except | > a few partial examples of how to implement it myself. | | import locale | locale.setlocale(locale.LC_ALL, "") # sets locale to the currently defined | # value in the user's enviro= nment ********************************** | locale_info =3D locale.localeconv() | currency =3D locale_info['currency_symbol'] |=20 | # now that we have the currency symbol we call locale.format() | # to transform the number into a pretty string |=20 | total =3D 3275.68 | print "total: %s%s\n" % (currency, locale.format("%0.2f", total, 1)) Bingo! The line emphasized by the row of stars is the key to making this actually work. Thanks! -D --=20 He who spares the rod hates his son, but he who loves him is careful to discipline him. Proverbs 13:24 =20 http://dman.ddts.net/~dman/ --0OAP2g/MAC+5xKAE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj1qvNUACgkQO8l8XBKTpRQHcgCglT5Yj7C5KeOnr07XKZ10Xhww DCwAoL63QO1QNW86uFg1MnOrYMG7ZIdC =0Pyw -----END PGP SIGNATURE----- --0OAP2g/MAC+5xKAE-- From shalehperry@attbi.com Tue Aug 27 00:39:04 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Mon, 26 Aug 2002 16:39:04 -0700 Subject: [Tutor] Re: printing monetary values In-Reply-To: <20020826234213.GA27660@dman.ddts.net> References: <20020826215038.GB26440@dman.ddts.net> <200208261451.01959.shalehperry@attbi.com> <20020826234213.GA27660@dman.ddts.net> Message-ID: <200208261639.04598.shalehperry@attbi.com> On Monday 26 August 2002 04:42 pm, Derrick 'dman' Hudson wrote: > On Mon, Aug 26, 2002 at 02:51:01PM -0700, Sean 'Shaleh' Perry wrote: > | On Monday 26 August 2002 02:50 pm, Derrick 'dman' Hudson wrote: > | > I just know I've seen mention before of a library function that > | > properly formats money as a string, but I can't seem to find it > | > anywhere. I want to receive a NUMERIC(15,2) data from a SQL databa= se > | > (eg, 3275.68) and have it displayed as $3,275.68. (dollar sign, > | > commas, and decimal) I've searched the Vaults of Parnassus, the > | > 'locale' module, and comp.lang.python, but didn't find anything exc= ept > | > a few partial examples of how to implement it myself. > | > | import locale > | > | locale.setlocale(locale.LC_ALL, "") # sets locale to the currently > | defined # value in the user's environment > > ********************************** > note you can replace the "" with another locale so you can print the same= =20 string in N different locales by simply changing the locale and calling t= he=20 code again. for i in locale_names: do_setlocale(i) do_show_amount(total) > > Bingo! The line emphasized by the row of stars is the key to making > this actually work. Thanks! > > -D From magnus@thinkware.se Tue Aug 27 01:05:17 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Tue, 27 Aug 2002 02:05:17 +0200 Subject: [Tutor] printing monetary values In-Reply-To: <200208261451.01959.shalehperry@attbi.com> References: <20020826215038.GB26440@dman.ddts.net> <20020826215038.GB26440@dman.ddts.net> Message-ID: <5.1.0.14.0.20020827013021.02ad1c38@www.thinkware.se> At 14:51 2002-08-26 -0700, Sean 'Shaleh' Perry wrote: >print total: "%s%s\n" % (currency, locale.format("%0.2f", total, 1)) I'd place "total: " inside the quotes if I were you! ;) Otherwise close. The code above has some way to go to fully print monetary values in different locales as they should be. To be complete it needs to pay more attention to the dictionary returned by locale.localeconv(). I think locale.format() looks at decimal separator, grouping and thousand separator, but nothing else? With Swedish setting for instance, your code will write "kr3 275,68" instead of the expected "3 275,68 kr". * It ignores that mon_grouping might differ from grouping and mon_thousands_sep might differ from thousands_sep. * It should use p_cs_precedes/n_cs_precedes to determine whether the currency symbol goes before or after the value. (And I think, p_sep_by_space/n_sep_by_space to see whether to have a space between the value and the currency symbol.) * It should use frac_digits to determine number of decimals, insteqad of a hard coded 2. * locale.format() doesn't care about p_sign_posn / n_sign_posn. A negative amount will be written $-1.00 etc instead of ($1.00) which would be correct. It would really be nice to have all this wrapped in a nice language independent way. As well as time and date printing etc... Maybe locale should be extended with money_format(), int_money_format(), date_time_format() etc... Or perhaps even better: The format strings could be extended so that locale.format("%m", 4324) would make 4324 into a string representation of money and so on. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From shalehperry@attbi.com Tue Aug 27 01:12:31 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Mon, 26 Aug 2002 17:12:31 -0700 Subject: [Tutor] printing monetary values In-Reply-To: <5.1.0.14.0.20020827013021.02ad1c38@www.thinkware.se> References: <20020826215038.GB26440@dman.ddts.net> <5.1.0.14.0.20020827013021.02ad1c38@www.thinkware.se> Message-ID: <200208261712.31444.shalehperry@attbi.com> On Monday 26 August 2002 05:05 pm, Magnus Lycka wrote: > > I think locale.format() looks at decimal separator, grouping > and thousand separator, but nothing else? > > With Swedish setting for instance, your code will write > "kr3 275,68" instead of the expected "3 275,68 kr". > > * It ignores that mon_grouping might differ from grouping and > mon_thousands_sep might differ from thousands_sep. > i originally had code of the form -- format(string, value, mon_grouping) = but=20 was told that the final piece was simply a bool and the value was not rea= d. =20 Suggestions welcome. > * It should use p_cs_precedes/n_cs_precedes to determine > whether the currency symbol goes before or after the value. > (And I think, p_sep_by_space/n_sep_by_space to see whether > to have a space between the value and the currency symbol.) > ooo, I have never seen this talked about. Spiffy. > * It should use frac_digits to determine number of decimals, > insteqad of a hard coded 2. > hmmm, ya it should. > * locale.format() doesn't care about p_sign_posn / n_sign_posn. > A negative amount will be written $-1.00 etc instead of > ($1.00) which would be correct. > "correct" under certain values of true (-: It might make sense to displa= y it=20 as a negative value for some groups and with the (money) notation for oth= er=20 groups of people. > It would really be nice to have all this wrapped in a nice > language independent way. As well as time and date printing > etc... > > Maybe locale should be extended with money_format(), > int_money_format(), date_time_format() etc... Or perhaps > even better: The format strings could be extended so that > locale.format("%m", 4324) would make 4324 into a string > representation of money and so on. Indeed this is a lot of replicated code. From scot@possum.in-berlin.de Tue Aug 27 02:07:36 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Tue, 27 Aug 2002 03:07:36 +0200 Subject: [Tutor] Why lambda could be considered evil In-Reply-To: <4AAD9FB5-B8FE-11D6-A9E4-00039351FE6A@mac.com> References: <4AAD9FB5-B8FE-11D6-A9E4-00039351FE6A@mac.com> Message-ID: <200208270307.36129.scot@possum.in-berlin.de> Hello Erik, > But what -is- the problem that some people have with lambda? One of the things that annoys me terribly about Python is that its beautiful and elegant structure seems to have been mangled in some places solely to please powerful and sinister language lobbyists. Usually it is some non-intuitive C-esque syntax such as "variable += 23" or "print 'What %s does this mean' % abuse" or "print >> someplace, 'I want Python to be more like bash!'". In the case of lambda, it is a Lisp construct that seems as foreign to Python as an steele [sic] ball shoved up a unicorn's nostril. I would sum up the main objections as: 1. It creates a complexity hot spot. Some people seem to be unable to resist the temptation to be very, very clever in lambda expressions, to the point where it is hard to figure out just what all they are trying to do in that one cramped line. Everywhere else, Python makes a point of stopping you from being too clever for your own good. 2. It is hard for newbies to understand why it is needed at all. "Lambda is an expression, not a statement" is fine for computer scientists who spend lots of time with formal grammars, but to the rest of us it sounds suspiciously like "Don't split infinitives". 3. The name is just plain stupid. Calling "an expression form that generates function objects" (Lutz and Ascher) /lambda/ might be intuitive if you've spent the last 20 years programming Lisp, but if you're new to it all, it just seems like, er, Greek. It isn't even a verb like "import", "try", "def(ine)" or "map". If you must have this "expression form", give it a mnenomic name or use a generic keyword like "function" instead of abusing Southern European alphabets. So far, nobody has been able to explain to me why you can't just write a clean, honest, and readable def instead of shoving everything in a lambda expression (except in Tkinter, which was ripped off from Tcl and might need those sort of constructs). Fortunately, list comprehensions seem to be killing a lot of lambdas, which can only be good - at least they are _somewhat_ clearer than lambdas. Y, Scot -- Scot W. Stevenson wrote me on Tuesday, 27. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1679 hours and has a CPU that is falling asleep at a system load of 0.19. From jchilders@smartITservices.com Mon Aug 26 22:49:02 2002 From: jchilders@smartITservices.com (Jeff Childers) Date: Mon, 26 Aug 2002 17:49:02 -0400 Subject: [Tutor] MySQLdb on Windows? Message-ID: <9C067B997594D3118BF50050DA24EA1097D37B@CCG2> Danny, Ah, worked perfectly. So much nicer than those crazy tar.gz files. Thanks! JC -----Original Message----- From: Danny Yoo [mailto:dyoo@hkn.eecs.berkeley.edu] Sent: Monday, August 26, 2002 5:03 PM To: J. Childers Cc: tutor@python.org Subject: Re: [Tutor] MySQLdb on Windows? On Mon, 26 Aug 2002, J. Childers wrote: > What's the trick for getting MySQLdb running on Windows? After spending several hours prepping > this weekend I finally got to the installation/setup instructions that come with MySQLdb only to > find the following comments in the setup by platform notes: > > "Windows installation instructions: I don't do Windows." > > Ok, does this module even work under Windows? If so, what do I need to > do to get it installed properly? Hello JC, Yes, it should work under Windows; you probably downloaded the source code distribution by accident. Instaed, you'll want to get the 0.9.1 Windows-specific files. You can find them here: http://sourceforge.net/project/showfiles.php?group_id=22307&release_id=10289 3 (0.9.2 is new enough that I don't think anyone has had time to package them for Windows yet; you may want to contact the MySQLdb mailing list to see if anyone's willing to do this. You can probably check http://sourceforge.net/forum/forum.php?forum_id=70461 and I'm sure someone can help you with this.) People have contributed packaged modules for Windows which can be run as a regular installer. Since you're running Windows, you can ignore those other 'tar.gz' and 'rpm' Unix/Linux specific files. You'll want to get one of the following files: MySQL-python-0.9.1.win32-py1.5.exe MySQL-python-0.9.1.win32-py2.0.exe MySQL-python-0.9.1.win32-py2.1.exe MySQL-python-0.9.1.win32-py2.2.exe The modules are Python version specific, so you'll want to make sure you get the right one. Otherwise, everything should be good. Good luck! From jchilders@smartITservices.com Mon Aug 26 22:55:28 2002 From: jchilders@smartITservices.com (Jeff Childers) Date: Mon, 26 Aug 2002 17:55:28 -0400 Subject: [Tutor] Beginner-->conditional statements Message-ID: <9C067B997594D3118BF50050DA24EA1097D37C@CCG2> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C24D4B.4A399990 Content-Type: text/plain; charset="iso-8859-1" Hi Stephen, Try www.diveintopython.org . This online tutorial covered enough of the basics to get me hooked. Also try the tutorial on the Developer's Shed: http://www.devshed.com/Server_Side/Python Good luck, Jeff -----Original Message----- From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of Stephen Harris Sent: Monday, August 26, 2002 5:31 PM To: tutor@python.org Subject: [Tutor] Beginner-->conditional statements Howdy Pilgrims, I've decided to learn Python as my first programming language, though I dabbled with Perl. This email is a bit of a test. Python installed and I've made Hello World. One reason I picked Python was because Tutor promoted a helpful mailing list. Also does anyone know of a tutorial(which dwells upon) that covers those conditional statements in some detail with some graduating problems and solutions? Python would be best, but if conditional statements work about the same in other languages then that would work if the logic of constructing them is covered. Best regards, Stephen ------_=_NextPart_001_01C24D4B.4A399990 Content-Type: text/html; charset="iso-8859-1"
Hi Stephen,
 
Try www.diveintopython.org. This online tutorial covered enough of the basics to get me hooked.
 
Also try the tutorial on the Developer's Shed: http://www.devshed.com/Server_Side/Python
 
Good luck,
 
Jeff
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of Stephen Harris
Sent: Monday, August 26, 2002 5:31 PM
To: tutor@python.org
Subject: [Tutor] Beginner-->conditional statements

Howdy Pilgrims,
 
I've decided to learn Python as my first programming
language, though I dabbled with Perl. This email is a
bit of a test. Python installed and I've made Hello World.
One reason I picked Python was because Tutor promoted
a helpful mailing list.
 
Also does anyone know of a tutorial(which dwells upon)
that covers those conditional statements in some detail
with some graduating problems and solutions? Python
would be best, but if conditional statements work about
the same in other languages then that would work if the
logic of constructing them is covered.
 
Best regards,
Stephen
------_=_NextPart_001_01C24D4B.4A399990-- From Anthony Polis" Hello, I'm getting an Apache error (module not found) when I try to load mod_python. I followed the tutorial (http://www.modpython.org/live/mod_python-2.7.8/doc-html/app-wininst.html) twice and I still get the error. I've checked to make sure that the mod_python.dll is in the modules directory and it is! yet, apache still doesn't see it. has anyone ran into this problem? I'm using Apache 1.3, mod_python, activepython and Windows 2000. thanks, Anthony From dyoo@hkn.eecs.berkeley.edu Tue Aug 27 05:46:31 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Mon, 26 Aug 2002 21:46:31 -0700 (PDT) Subject: [Tutor] mod_python problems! In-Reply-To: <000501c24d80$a34388e0$0a30fea9@voyd> Message-ID: On Mon, 26 Aug 2002, Anthony Polis wrote: > Hello, > > I'm getting an Apache error (module not found) when I try to load > mod_python. I followed the tutorial > (http://www.modpython.org/live/mod_python-2.7.8/doc-html/app-wininst.html) > twice and I still get the error. > > I've checked to make sure that the mod_python.dll is in the modules > directory and it is! yet, apache still doesn't see it. has anyone ran > into this problem? I'm using Apache 1.3, mod_python, activepython and > Windows 2000. Hi Anthony, Yikes, this sounds advanced. *grin* I don't think many of us here have played with mod_python yet. You might want to ask on the mod-python mailing list to get better help on this one. There's details on subscribing to it here: http://www.modpython.org/mailman/listinfo/mod_python That mailing list looks pretty active, so I'm sure that someone can help you get mod_python working. Installation problems are always a bit annoying, but I hope that you can get it fixed quickly. Best of wishes! From Jaco.Smuts@za.didata.com Tue Aug 27 08:09:09 2002 From: Jaco.Smuts@za.didata.com (Jaco.Smuts@za.didata.com) Date: Tue, 27 Aug 2002 09:09:09 +0200 Subject: [Tutor] urlparse question Message-ID: thanks guys, it will definitely help to have this available in the urlparse library though. Cheers -----Original Message----- From: Danny Yoo [mailto:dyoo@hkn.eecs.berkeley.edu] Sent: 26 Augustus 2002 10:55 To: Blake Winton Cc: tutor@python.org Subject: Re: [Tutor] urlparse question On Mon, 26 Aug 2002, Blake Winton wrote: > * Danny Yoo [020826 14:05]: > ### > >>> query_string = > "hl=en&lr=&ie=UTF-8&oe=utf-8&q=south+africa+travel+cape+town" > >>> import cgi > >>> dict = cgi.parse_qs(query_string) > >>> dict > {'hl': ['en'], 'ie': ['UTF-8'], 'oe': ['utf-8'], > 'q': ['south africa travel cape town']} > ### > > You might want to notice that it's completely lost the "lr=" part of the > query string. If that's important to you, you may need to reinvent the > wheel. Good eye! I didn't notice that 'lr' didn't have a value in the dictionary. Thankfully, we can still take advantage cgi.quote_qs() because it can take in an optional parameter to keep even the empty parameters: ### >>> cgi.parse_qs(query_string, keep_blank_values = 1) {'hl': ['en'], 'ie': ['UTF-8'], 'oe': ['utf-8'], 'lr': [''], 'q': ['south africa travel cape town']} ### Hope this helps! _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor This message contains information intended solely for the addressee, which is confidential or private in nature and subject to legal privilege. If you are not the intended recipient, you may not peruse, use, disseminate, distribute or copy this message or any file attached to this message. Any such unauthorised use is prohibited and may be unlawful. If you have received this message in error, please notify the sender immediately by e-mail, facsimile or telephone and thereafter delete the original message from your machine. Furthermore, the information contained in this message, and any attachments thereto, is for information purposes only and may contain the personal views and opinions of the author, which are not necessarily the views and opinions of Dimension Data (South Africa) (Proprietary) Limited or is subsidiaries and associated companies ("Dimension Data"). Dimension Data therefore does not accept liability for any claims, loss or damages of whatsoever nature, arising as a result of the reliance on such information by anyone. Whilst all reasonable steps are taken to ensure the accuracy and integrity of information transmitted electronically and to preserve the confidentiality thereof, Dimension Data accepts no liability or responsibility whatsoever if information or data is, for whatsoever reason, incorrect, corrupted or does not reach its intended destination. From alan.gauld@bt.com Tue Aug 27 11:14:47 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 27 Aug 2002 11:14:47 +0100 Subject: [Tutor] To program or not to program Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C892@mbtlipnt02.btlabs.bt.co.uk> > Im not only looking for the answer but also want to > learn for myself, I just need some kind of a guide line. > The lines in the file that you will use look like this: > Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: myaddr 155.239.150.146 > Jul 6 06:30:44 maxigate ppp[34607]: tun0: Warning: Chat script failed Look at the file readlines() function(s) Look at the string split method - suggest you split with ':' separator. Then extract the bits of information you want by accessing the fields - maybe extract the seconds from the 3rd field. Join the bits you need joined(field[0:3] and fields[6:] mebbe?) Have a function to process each possible message type. Check field 5 for message type and process accordingly Keep the data in a set of variables. If you want wrap the whole thing up in a set of objects - Logfile, Report, LogEntry(with subclasses) might be candidates? That'd probably be how I approached it... HTH Alan G. From alan.gauld@bt.com Tue Aug 27 11:25:32 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 27 Aug 2002 11:25:32 +0100 Subject: [Tutor] Beginner-->conditional statements Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C893@mbtlipnt02.btlabs.bt.co.uk> > Also does anyone know of a tutorial(which dwells upon) > that covers those conditional statements in some detail > with some graduating problems and solutions? Most of the tutorials on the beginners pages explain them. How much they provide in the way of excercises is variable. Have you looked at any of those tutorials yet? Is there anything specific you don't understand? (This is a good place to ask those kind of specific questions!) Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Tue Aug 27 11:59:43 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 27 Aug 2002 11:59:43 +0100 Subject: [Tutor] Why lambda could be considered evil Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C894@mbtlipnt02.btlabs.bt.co.uk> > > But what -is- the problem that some people have with lambda? = > ... In the case of lambda, it is a Lisp construct Actually Lambda is not a Lisp construct but a part of the lambda calculus which is a branch of math. The use of lambda is common in several functional languages. My beef with lambda in Python is that it is only partially implemented so that it really is only a thin bit of syntactic sugar around a def statement. Useful for creating lots of similar but not quite identical functions programatically but not for much else. However understanding lamda expressions is one of those "change your life" type discoveries in programming. Once you get them the whole theoretocal basis of programming kind of pops into focus - or it did for me! > seems as foreign to Python as an steele [sic] ball shoved up > a unicorn's nostril. = Not at all. Python supports many forms of programming. The class statement is part of OO and not a rip off from C++, similarly lambda is part of functional programming. If you want to support a functional style as well as an OOP style > 1. It creates a complexity hot spot. Some people seem to be > unable to resist the temptation to be very, very clever I agree this is bad but we are seeing the same kind of overcomplexity in List Comprehensions. Avoidable complexity is nearl always a bad thing regardless of the language construct, but I agree lambdas do seem to bring out the worst in some folks! :-) > 2. It is hard for newbies to understand why it is needed at > all. "Lambda is an expression, not a statement" is fine for computer > scientists who spend Fair point, but for those who do need it its useful. Of course it would help if lambdas were fully implemented to allow multi line 'arbitrary' blocks of code rather than just single line expressions.... > 3. The name is just plain stupid. .... > be intuitive if you've spent the last 20 years programming Lisp, Or studying lambda calculus! > it a mnenomic name or use a generic keyword like "function" > instead of If you don't like lambda you can just use def. In python the two are syntactically equivalent! def f(x): return expression f = lambda x: expression are the same thing. > clean, honest, and readable def instead of shoving everything > in a lambda expression No reason except that lambda is the more conventional and therefore readable form to anyone trainied in Functional Programming. Why use a tuple when you could use a list instead? (OK Tuples have some slightly different features - immutability...) > (except in Tkinter, which was ripped off from Tcl Tcl doesn't have lambdas per se (although it does have arbitrary code blocks). You never need lambdas in Tkinter, they are just a convenience. Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From thomi@thomi.imail.net.nz Tue Aug 27 12:18:19 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Tue, 27 Aug 2002 23:18:19 +1200 Subject: [Tutor] security with ssh?? Message-ID: <20020827231819.7a44e467.thomi@thomi.imail.net.nz> Is there any easy way that any of you ppl can think of, to provide an ssh login to a computer, using python?? So that the user can ssh in normally, but instead of sshing in to the actual machine, they end up running the python program instead, and when they quit the python program, they are disconnected?? I ask because i could not find any sort of ssh module for python. does anyone know of one? thanks. -- Lord, what fools these mortals be! -- midsummer nights dream. Thomi Richards, thomi@imail.net.nz From erikprice@mac.com Tue Aug 27 12:31:32 2002 From: erikprice@mac.com (Erik Price) Date: Tue, 27 Aug 2002 07:31:32 -0400 Subject: [Tutor] Why lambda could be considered evil In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C894@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <89B8DAB3-B9B0-11D6-B316-00039351FE6A@mac.com> On Tuesday, August 27, 2002, at 06:59 AM, alan.gauld@bt.com wrote: > However understanding lamda expressions is one of > those "change your life" type discoveries in programming. > Once you get them the whole theoretocal basis of programming > kind of pops into focus - or it did for me! That's the thing -- I'm not there yet. I had a 24-hour sense of clarity and a "change your life" feeling when I finally understood the fundamental concept of OO programming (why was that so hard to understand at one time? in retrospect it's so simple), perhaps someday I'll have the same experience with lambda. But until the lightbulb goes off in my head, I'm willing to hear any arguments for or against. How does it change your life? Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From wilson@visi.com Tue Aug 27 12:40:34 2002 From: wilson@visi.com (Tim Wilson) Date: Tue, 27 Aug 2002 06:40:34 -0500 Subject: [Tutor] security with ssh?? In-Reply-To: <20020827231819.7a44e467.thomi@thomi.imail.net.nz> References: <20020827231819.7a44e467.thomi@thomi.imail.net.nz> Message-ID: <20020827114034.GA6753@isis.visi.com> On Tue, Aug 27, 2002 at 11:18:19PM +1200, Thomi Richards wrote: > > Is there any easy way that any of you ppl can think of, to provide an > ssh login to a computer, using python?? So that the user can ssh in > normally, but instead of sshing in to the actual machine, they end up > running the python program instead, and when they quit the python > program, they are disconnected?? I ask because i could not find any sort > of ssh module for python. does anyone know of one? How about setting the user's login shell to /usr/bin/python? -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.com W. St. Paul, MN | | http://slashdot.org wilson@visi.com | | http://linux.com From alan.gauld@bt.com Tue Aug 27 12:51:18 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 27 Aug 2002 12:51:18 +0100 Subject: [Tutor] Why lambda could be considered evil Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C896@mbtlipnt02.btlabs.bt.co.uk> > > those "change your life" type discoveries in programming. > I'll have the same experience with lambda. But until the > lightbulb goes off in my head, I'm willing to hear any > arguments for or against. How does it change your life? Purely in a programming sense! I'm not that sad... But it changes the way you think about programs and how they are constructed. For one thing Functional Programming starts to really make sense and you start to use those concepts in your normal day to day work - even designing methods within classes etc. Of course much of it is good practice that you do anyway but understanding lambdas etc helped me see *why* it was good practice. Thats where the light-bulb effect came in. Languages like Smalltalk, Lisp, Haskell, ML are all much easier to understand once you get the idea of lambdas. Basically anywhere where you need to pass around functionality as an object (which is basically what a lambda is!). Combining lambdas with closures just provides a different style of programming. It is esoteric, no doubt about it. You can write good code without it. The same is true of OOP. But with lambdas behind you you get a new set of toys to play with and new concepts become possible. Big complex problems often become more manageable. I'm trying to think of a suitable example that fits in an email but I can't right off hand. If I do I'll post it. And I stress I'm talking about the concept of lambdas not the way Python does them. Alan G. From Morne" This is a multi-part message in MIME format. ------=_NextPart_000_0110_01C24DD4.DFD551E0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0111_01C24DD4.DFD551E0" ------=_NextPart_001_0111_01C24DD4.DFD551E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi=20 I have been asking for help and you have been giving me help, but I am = very new to any kind of programming and wanted to start on python. Is = there a way that someone would mentor me in learnning python I really = wanna lear but cant seem to get a kick off Please let me know=20 fromclay@maxitec.co.za ------=_NextPart_001_0111_01C24DD4.DFD551E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi
 
I have been asking for help and you = have been=20 giving me help, but I am very new to any kind of programming and wanted = to start=20 on python. Is there a way that someone would mentor me in learnning = python I=20 really wanna lear but cant seem to get a kick off
 
Please let me know
 
fromclay@maxitec.co.za
 
------=_NextPart_001_0111_01C24DD4.DFD551E0-- ------=_NextPart_000_0110_01C24DD4.DFD551E0 Content-Type: application/octet-stream; name="ppp.log" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ppp.log" Jul 5 18:00:00 maxigate newsyslog[87300]: logfile turned over Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = quit=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection dropped.=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = set timeout 180=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = dial=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: bundle: Establish=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: deflink: closed -> = opening=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: deflink: Connected!=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: deflink: opening -> = dial=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: Phone: 0860007249=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: deflink: Dial attempt 1 = of 1=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection closed.=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: Send: AT^M=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: Received: AT^M^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Send: ATE1Q0^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Received: ATE1Q0^M^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Send: = ATx1DT0860007249^M=20 Jul 5 18:15:03 maxigate ppp[34607]: tun0: Chat: Expect(40): CONNECT=20 Jul 5 18:15:22 maxigate ppp[34607]: tun0: Chat: Received: = ATx1DT0860007249^M^M=20 Jul 5 18:15:22 maxigate ppp[34607]: tun0: Chat: Received: CONNECT = 33600/ARQ/V34/LAPM/V42BIS^M=20 Jul 5 18:15:22 maxigate ppp[34607]: tun0: Phase: deflink: dial -> = carrier=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: Phase: deflink: /dev/cuaa0: = CD detected=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: Phase: deflink: carrier -> = login=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: Phase: deflink: login -> lcp=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: LCP: FSM: Using "deflink" as = a transport=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Initial --> Closed=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Stopped=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: deflink: LayerStart=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Stopped=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: deflink: State change = Stopped --> Req-Sent=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Req-Sent=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Req-Sent=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Req-Sent=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Req-Sent=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: LCP: deflink: LayerFinish=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: LCP: deflink: State change = Req-Sent --> Stopped=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: LCP: deflink: State change = Stopped --> Closed=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Initial=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: lcp -> logout = Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: logout -> = hangup=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: Connect time: = 40 secs: 0 octets in, 265 octets out=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: : 1079435 = packets in, 231579 packets out=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: total 6 bytes/sec, = peak 21 bytes/sec on Fri Jul 5 18:15:40 2002=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: hangup -> = closed=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: bundle: Dead=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = quit=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection dropped.=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = set timeout 180=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = dial=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: bundle: Establish=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: deflink: closed -> = opening=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: deflink: Connected!=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: deflink: opening -> = dial=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Phone: 0860007249=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: deflink: Dial attempt 1 = of 1=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection closed.=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Send: AT^M=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Received: AT^M^M=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Send: ATE1Q0^M=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 5 18:45:01 maxigate ppp[34607]: tun0: Chat: Received: ATE1Q0^M^M=20 Jul 5 18:45:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 5 18:45:01 maxigate ppp[34607]: tun0: Chat: Send: = ATx1DT0860007249^M=20 Jul 5 18:45:03 maxigate ppp[34607]: tun0: Chat: Expect(40): CONNECT=20 Jul 5 18:45:22 maxigate ppp[34607]: tun0: Chat: Received: = ATx1DT0860007249^M^M=20 Jul 5 18:45:22 maxigate ppp[34607]: tun0: Chat: Received: CONNECT = 33600/ARQ/V34/LAPM/V42BIS^M=20 Jul 5 18:45:22 maxigate ppp[34607]: tun0: Phase: deflink: dial -> = carrier=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: Phase: deflink: /dev/cuaa0: = CD detected=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: Phase: deflink: carrier -> = login=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: Phase: deflink: login -> lcp=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: LCP: FSM: Using "deflink" as = a transport=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Initial --> Closed=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Stopped=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: deflink: LayerStart=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Stopped=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xd52c5683=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: deflink: State change = Stopped --> Req-Sent=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigReq(7) state =3D Req-Sent=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x58cf83ad=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigAck(7) state =3D Req-Sent=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x58cf83ad=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: deflink: State change = Req-Sent --> Ack-Sent=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Ack-Sent=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xd52c5683=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xd52c5683=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigReq(8) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x58cf933e=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigAck(8) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x58cf933e=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigAck(179) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: State change = Ack-Sent --> Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: LayerUp=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: Sending ident magic = d52c5683 text user-ppp 2.3 (built Apr 26 2001)=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: SendIdent(180) = state =3D Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: bundle: Authenticate=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: deflink: his =3D PAP, = mine =3D none=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: Pap Output: itec79 = ********=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: Pap Input: SUCCESS ()=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: Using trigger address = 0.0.0.0=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: FSM: Using "deflink" as = a transport=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Initial --> Closed=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: LayerStart.=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: MPPE: Not usable without = CHAP81=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: = SendConfigReq(1) state =3D Closed=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: DEFLATE[4] win 15=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: PRED1[2] =20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Closed --> Req-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: deflink: lcp -> open=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: bundle: Network=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: FSM: Using "deflink" as = a transport=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Initial --> Closed=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: LayerStart.=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(103) state =3D Closed=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] 0.0.0.0=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: COMPPROTO[6] 16 VJ = slots with slot compression=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Closed --> Req-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigReq(188) state =3D Req-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.254=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigAck(188) state =3D Req-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.254=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Req-Sent --> Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvProtocolRej(9) state =3D Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: -- Protocol = 0x80fd (Compression Control Protocol) was rejected!=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Req-Sent --> Stopped=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigRej(103) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: Sending ident magic = d52c5683 text user-ppp 2.3 (built Apr 26 2001)=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: SendIdent(181) = state =3D Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: COMPPROTO[6] 16 VJ = slots with slot compression=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(104) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] 0.0.0.0=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigNak(104) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.146=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] changing = address: 0.0.0.0 --> 155.239.150.146=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(105) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.146=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigAck(105) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Ack-Sent --> Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: LayerUp.=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: myaddr 155.239.150.146 = hisaddr =3D 155.239.150.254=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Command: maxigate: !bg = /usr/local/sys/linkup=20 Jul 5 18:46:33 maxigate ppp[34607]: tun0: Phase: deflink: HDLC errors = -> FCS: 2, ADDR: 0, COMD: 0, PROTO: 0=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: Idle timer expired=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: LayerDown: = 155.239.150.146=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Command: maxigate: iface = clear=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: Using trigger address = 0.0.0.0=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: = SendTerminateReq(106) state =3D Opened=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Opened --> Closing=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvTerminateAck(106) state =3D Closing=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: LayerFinish.=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: Connect time: 197 secs: = 5091 octets in, 1864 octets out=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: : 234569 packets in, = 230304 packets out=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: total 35 bytes/sec, = peak 815 bytes/sec on Fri Jul 5 18:48:48 2002=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Closing --> Closed=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: bundle: Terminate=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: CCP: deflink: State change = Stopped --> Closed=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: CCP: deflink: State change = Closed --> Initial=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: LayerDown=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: = SendTerminateReq(180) state =3D Opened=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: State change = Opened --> Closing=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: open -> lcp=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Closed --> Initial=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: = RecvTerminateAck(180) state =3D Closing=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: LayerFinish=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closing --> Closed=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Initial=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: lcp -> logout = Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: logout -> = hangup=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: Connect time: = 228 secs: 6795 octets in, 2567 octets out=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: : 1079551 = packets in, 231625 packets out=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: total 41 bytes/sec, = peak 840 bytes/sec on Fri Jul 5 18:48:48 2002=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: hangup -> = closed=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: bundle: Dead=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Command: /var/run/internet: = quit=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection dropped.=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Command: /var/run/internet: = set timeout 180=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Command: /var/run/internet: = dial=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: bundle: Establish=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: deflink: closed -> = opening=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: deflink: Connected!=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: deflink: opening -> = dial=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Phone: 0860007249=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: deflink: Dial attempt 1 = of 1=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection closed.=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Send: AT^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Received: AT^M^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Send: ATE1Q0^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Received: ATE1Q0^M^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Send: = ATx1DT0860007249^M=20 Jul 6 06:30:03 maxigate ppp[34607]: tun0: Chat: Expect(40): CONNECT=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Chat: Expect timeout=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Warning: Chat script failed=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: dial -> = hangup=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: Connect time: = 43 secs: 0 octets in, 0 octets out=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: : 1079551 = packets in, 231625 packets out=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: total 0 bytes/sec, = peak 0 bytes/sec on Sat Jul 6 06:30:44 2002=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: hangup -> = closed=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: bundle: Dead=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = quit=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection dropped.=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = set timeout 180=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = dial=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: bundle: Establish=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: deflink: closed -> = opening=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: deflink: Connected!=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: deflink: opening -> = dial=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Phone: 0860007249=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: deflink: Dial attempt 1 = of 1=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection closed.=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Send: AT^M=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Received: = ATx1DT0860007249^MAT^M^M=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Send: ATE1Q0^M=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 6 08:30:01 maxigate ppp[34607]: tun0: Chat: Received: ATE1Q0^M^M=20 Jul 6 08:30:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 6 08:30:01 maxigate ppp[34607]: tun0: Chat: Send: = ATx1DT0860007249^M=20 Jul 6 08:30:03 maxigate ppp[34607]: tun0: Chat: Expect(40): CONNECT=20 Jul 6 08:30:22 maxigate ppp[34607]: tun0: Chat: Received: = ATx1DT0860007249^M^M=20 Jul 6 08:30:22 maxigate ppp[34607]: tun0: Chat: Received: CONNECT = 33600/ARQ/V34/LAPM/V42BIS^M=20 Jul 6 08:30:22 maxigate ppp[34607]: tun0: Phase: deflink: dial -> = carrier=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: Phase: deflink: /dev/cuaa0: = CD detected=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: Phase: deflink: carrier -> = login=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: Phase: deflink: login -> lcp=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: LCP: FSM: Using "deflink" as = a transport=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Initial --> Closed=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Stopped=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: deflink: LayerStart=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(181) state =3D Stopped=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x0cd05494=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: deflink: State change = Stopped --> Req-Sent=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigReq(204) state =3D Req-Sent=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x5bc3012a=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigAck(204) state =3D Req-Sent=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x5bc3012a=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: deflink: State change = Req-Sent --> Ack-Sent=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(181) state =3D Ack-Sent=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x0cd05494=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(181) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x0cd05494=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigReq(205) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x5bc310bd=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigAck(205) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x5bc310bd=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigAck(181) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: State change = Ack-Sent --> Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: LayerUp=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: Sending ident magic = 0cd05494 text user-ppp 2.3 (built Apr 26 2001)=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: SendIdent(182) = state =3D Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: bundle: Authenticate=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: deflink: his =3D PAP, = mine =3D none=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: Pap Output: itec79 = ********=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: Pap Input: SUCCESS ()=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: Using trigger address = 0.0.0.0=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: FSM: Using "deflink" as = a transport=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Initial --> Closed=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: LayerStart.=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: MPPE: Not usable without = CHAP81=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: = SendConfigReq(1) state =3D Closed=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: DEFLATE[4] win 15=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: PRED1[2] =20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Closed --> Req-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: deflink: lcp -> open=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: bundle: Network=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: FSM: Using "deflink" as = a transport=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Initial --> Closed=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: LayerStart.=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(107) state =3D Closed=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] 0.0.0.0=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: COMPPROTO[6] 16 VJ = slots with slot compression=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Closed --> Req-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigReq(204) state =3D Req-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.254=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigAck(204) state =3D Req-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.254=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Req-Sent --> Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvProtocolRej(206) state =3D Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: -- Protocol = 0x80fd (Compression Control Protocol) was rejected!=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Req-Sent --> Stopped=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigRej(107) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: Sending ident magic = 0cd05494 text user-ppp 2.3 (built Apr 26 2001)=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: SendIdent(183) = state =3D Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: COMPPROTO[6] 16 VJ = slots with slot compression=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(108) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] 0.0.0.0=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigNak(108) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.26=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] changing = address: 0.0.0.0 --> 155.239.150.26=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(109) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.26=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigAck(109) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Ack-Sent --> Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: LayerUp.=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: myaddr 155.239.150.26 = hisaddr =3D 155.239.150.254=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Command: maxigate: !bg = /usr/local/sys/linkup=20 Jul 6 08:31:32 maxigate ppp[34607]: tun0: Phase: deflink: HDLC errors = -> FCS: 2, ADDR: 0, COMD: 0, PROTO: 0=20 ------=_NextPart_000_0110_01C24DD4.DFD551E0-- From erikprice@mac.com Tue Aug 27 13:35:13 2002 From: erikprice@mac.com (Erik Price) Date: Tue, 27 Aug 2002 08:35:13 -0400 Subject: [Tutor] security with ssh?? In-Reply-To: <20020827231819.7a44e467.thomi@thomi.imail.net.nz> Message-ID: <6EEB59A3-B9B9-11D6-B316-00039351FE6A@mac.com> On Tuesday, August 27, 2002, at 07:18 AM, Thomi Richards wrote: > Is there any easy way that any of you ppl can think of, to provide an > ssh login to a computer, using python?? So that the user can ssh in > normally, but instead of sshing in to the actual machine, they end up > running the python program instead, and when they quit the python > program, they are disconnected?? I ask because i could not find any sort > of ssh module for python. does anyone know of one? I would read up on "ssh" since there's a lot of security implications in doing this (such as, is the information sent from your Python program to the ssh client secure??). ssh was written to be super-secure, and something like this -could- compromise it. That said, do a google search under the search criteria "ssh" and "wrapper" and see what others have done with C, C++, Tcl, etc. I'm sure you will find a lot, though not necessarily in Python. It shouldn't be too much different. Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From erikprice@mac.com Tue Aug 27 13:38:31 2002 From: erikprice@mac.com (Erik Price) Date: Tue, 27 Aug 2002 08:38:31 -0400 Subject: [Tutor] mentor neeeeeded(log file) In-Reply-To: <011401c24dc4$1f1517c0$7800a8c0@maxitec.co.za> Message-ID: On Tuesday, August 27, 2002, at 08:20 AM, Morne wrote: > I have been asking for help and you have been giving me help, but I am > very new to any kind of programming and wanted to start on python. Is > there a way that someone would mentor me in learnning python I really > wanna lear but cant seem to get a kick off Some Jedi master of programming once told me: "nothing teaches code like code" In other words, fire up that interactive Python interpreter and start playing -- short of taking a class, the only way you're going to learn anything is by doing. If you need a guide, there are plenty of books and web sites that you can follow, and this list is a great forum for asking questions when you get stumped. Hang in there. Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From thomi@thomi.imail.net.nz Tue Aug 27 13:29:52 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Wed, 28 Aug 2002 00:29:52 +1200 Subject: [Tutor] security with ssh?? In-Reply-To: <6EEB59A3-B9B9-11D6-B316-00039351FE6A@mac.com> References: <20020827231819.7a44e467.thomi@thomi.imail.net.nz> <6EEB59A3-B9B9-11D6-B316-00039351FE6A@mac.com> Message-ID: <20020828002952.5d26a039.thomi@thomi.imail.net.nz> thanks all, this answers my question. Whatever i do, it will end up being more secure than the telnet method cisco routers use :-) On Tue, 27 Aug 2002 08:35:13 -0400 Thus said Erik Price : > > On Tuesday, August 27, 2002, at 07:18 AM, Thomi Richards wrote: > > > Is there any easy way that any of you ppl can think of, to provide > > an ssh login to a computer, using python?? So that the user can ssh > > in normally, but instead of sshing in to the actual machine, they > > end up running the python program instead, and when they quit the > > python program, they are disconnected?? I ask because i could not > > find any sort of ssh module for python. does anyone know of one? > > I would read up on "ssh" since there's a lot of security implications > in doing this (such as, is the information sent from your Python > program to the ssh client secure??). ssh was written to be > super-secure, and something like this -could- compromise it. > > That said, do a google search under the search criteria "ssh" and > "wrapper" and see what others have done with C, C++, Tcl, etc. I'm > sure you will find a lot, though not necessarily in Python. It > shouldn't be too much different. > > > > Erik > > > > > -- > Erik Price > > email: erikprice@mac.com > jabber: erikprice@jabber.org > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- This is a subliminal message. Thomi Richards, thomi@imail.net.nz From thomi@thomi.imail.net.nz Tue Aug 27 13:33:48 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Wed, 28 Aug 2002 00:33:48 +1200 Subject: [Tutor] mentor neeeeeded(log file) In-Reply-To: References: <011401c24dc4$1f1517c0$7800a8c0@maxitec.co.za> Message-ID: <20020828003348.2b4e3497.thomi@thomi.imail.net.nz> Yeah, i would suggest that you come up with some really simple program you want to do. Maybe a simple arithmetic quiz? something which asks questions, gets answers, maybe even keeps score?? It's how i was taught, and once you get the hang of it, it's really quite simple :-) On Tue, 27 Aug 2002 08:38:31 -0400 Thus said Erik Price : > > On Tuesday, August 27, 2002, at 08:20 AM, Morne wrote: > > > I have been asking for help and you have been giving me help, but I > > am very new to any kind of programming and wanted to start on > > python. Is there a way that someone would mentor me in learnning > > python I really wanna lear but cant seem to get a kick off > > Some Jedi master of programming once told me: > > "nothing teaches code like code" > > In other words, fire up that interactive Python interpreter and start > playing -- short of taking a class, the only way you're going to learn > > anything is by doing. If you need a guide, there are plenty of books > and web sites that you can follow, and this list is a great forum for > asking questions when you get stumped. > > Hang in there. > > > > > > Erik > > > > > > -- > Erik Price > > email: erikprice@mac.com > jabber: erikprice@jabber.org > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- This message was brought to you by one bored guy, with nothing better to do, And the letter Q. Thomi Richards, thomi@imail.net.nz From lsloan@umich.edu Tue Aug 27 13:52:48 2002 From: lsloan@umich.edu (Lance E Sloan) Date: Tue, 27 Aug 2002 08:52:48 -0400 Subject: [Tutor] Re: books arrived In-Reply-To: <20020826214723.GA26440@dman.ddts.net> References: <3D686911.234852A6@netzero.net> <70901471896.20020825113416@inkedmn.net> <3D69A8CD.9A6D349@netzero.net> <20020826214723.GA26440@dman.ddts.net> Message-ID: <20278520.1030438368@[10.0.1.33]> On Mon, Aug 26, 2002 at 12:04:29AM -0400, Kirk Bailey wrote: > Syntax is ok, but the modules I need to study more. and alas, I am stuck > for the time being with 1.5.2, my hardware guru says we would have to > upgrade critter to handle the new version. What kind of critter are we talking about? If it's your desktop machine, just try installing a newer version. If it's a multiuser machine you're sharing, like Linux or some kind of UNIX, if you have access to a C compiler, you can build and install the new version of Python in your home directory and run it from there. I've done that several times myself, to get the "configure" parameters right, which I then pass on to the sysadmins here. (They like to do all the builds themselves.) -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Python & Perl CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web" From gus.tabares@verizon.net Tue Aug 27 14:03:45 2002 From: gus.tabares@verizon.net (Gus Tabares) Date: Tue, 27 Aug 2002 09:03:45 -0400 Subject: [Tutor] ftplib with classes Message-ID: <3D6B78B1.7030606@verizon.net> Hello all, I'm trying to get my hands dirty with using classes so I decided to create a simple program to connect to a ftp and just logout. I know how to do this using the interpreter and functions but classes are a different story. Looking at the doc for ftplib I see: __init__(self, host='', user='', passwd='', acct='') # Initialization method (called by class instantiation). # Initialize host to localhost, port to standard ftp port # Optional arguments are host (for connect()), # and user, passwd, acct (for login()) Now the code I have as of now is: import ftplib class Connection: def __init__(self, host='', user='', passwd='', acct=''): self.user = username self.host = hostname self.passwd = password Am I doing this right? Also, for connecting ( connect()) would I use that as a method? Just looking for a bump in the right direction. Any help is appreciated. Thanks... Gus From magnus@thinkware.se Tue Aug 27 14:26:15 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Tue, 27 Aug 2002 15:26:15 +0200 Subject: [Tutor] security with ssh?? In-Reply-To: <20020827231819.7a44e467.thomi@thomi.imail.net.nz> Message-ID: <5.1.0.14.0.20020827134428.02b428e8@www.thinkware.se> At 23:18 2002-08-27 +1200, Thomi Richards wrote: >Is there any easy way that any of you ppl can think of, to provide an >ssh login to a computer, using python?? So that the user can ssh in >normally, but instead of sshing in to the actual machine, they end up >running the python program instead, and when they quit the python >program, they are disconnected?? I ask because i could not find any sort >of ssh module for python. does anyone know of one? What OS? In unix and friends, the easiest solution would be to execute your python program from a login script. Create one (or more) specific user(s) for the purpose, and fix their setup script like this: [mypythonuser@mymachine ~/mypythonuser]$ more .bashrc # .bashrc exec ./mypythonprogram There are security issues around this. Can the user manage to break the .bashrc script with Ctrl-C before you start the program etc? These are standard unix security issues that have nothing to do with python. Another option would be to use you program as login shell. This places some requirements on your application though. To be honest, I'm not sure what the requirements are there. I can replace /bin/bash with /usr/bin/python and get python as a login shell, but replacing it with a simple python script doesn't work. Maybe it's just lacking some environment variables? Trying to use a python script as login shell gave "Permission denied". Wrapping it with McMillan installer gave: X:\xxx>ssh -l username machine Password: Last login: Tue Aug 27 14:47:17 2002 from xxxxxx Cannot open archive: /usr/X11R6/bin/-tinyshellConnection to palanga closed. Another option is to look at medusa, which lets you write internet servers. I think there is an SSL wrapper for medusa somewhere. See http://www.nightmare.com/medusa/ SSL is not ssh, but it is another option that gives you encrypted traffic. Of course, ssh would not be the client... --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From alan.gauld@bt.com Tue Aug 27 11:04:54 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 27 Aug 2002 11:04:54 +0100 Subject: [Tutor] Way off topic! Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C891@mbtlipnt02.btlabs.bt.co.uk> This has nothing(or very little) to do with Python however I'm sure that there are a few on the tutor list in the Bay area and... I'm on vacation in the US in a couple of weeks driving Hw101 and will be spending a couple of days in San Francisco. I've already done the rock and bridges etc so what other interesting things are there to do in SF for a slightly nerdy type guy like me? (Preferably that won't leave my non nerdy wife screaming in horror! :-) Sorry for taking up bandwidth on a personal matter, Replies off list direct to me please. Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From shey@argonaut.com Tue Aug 27 15:10:17 2002 From: shey@argonaut.com (shey crompton) Date: Tue, 27 Aug 2002 15:10:17 +0100 Subject: [Tutor] mentor neeeeeded(log file) Message-ID: <415C917D807AD411B72C00805FF7330B0383640C@MAILSRV> Oops. I just realised I didn't send the message below to Tutor. Sorry Thomi! That's also what I've been doing. I've been going through a couple of tutorials, taking their basic examples, and extending them. One example of this is from Alan's book which is a simple loop that prints out the times tables between 2-12. As I learn more, I am revisiting the program, and adding little touches like asking the user which one he/she wants printed. I intend to eventually make it into a program with a GUI (overkill, I know), and probably a multiplication quiz. As Thomi said, take something simple, and extend it. You can always go back to the original simple program and change direction. Most of all persevere. I started Python about 2 months with no programming experience whatsoever, and, although I am no expert yet, I know that any day now I will figure out what's happening. :-) -----Original Message----- From: Thomi Richards [mailto:thomi@thomi.imail.net.nz] Sent: 27 August 2002 13:34 To: tutor@python.org Subject: Re: [Tutor] mentor neeeeeded(log file) Yeah, i would suggest that you come up with some really simple program you want to do. Maybe a simple arithmetic quiz? something which asks questions, gets answers, maybe even keeps score?? It's how i was taught, and once you get the hang of it, it's really quite simple :-) On Tue, 27 Aug 2002 08:38:31 -0400 Thus said Erik Price : > > On Tuesday, August 27, 2002, at 08:20 AM, Morne wrote: > > > I have been asking for help and you have been giving me help, but I > > am very new to any kind of programming and wanted to start on > > python. Is there a way that someone would mentor me in learnning > > python I really wanna lear but cant seem to get a kick off > > Some Jedi master of programming once told me: > > "nothing teaches code like code" > > In other words, fire up that interactive Python interpreter and start > playing -- short of taking a class, the only way you're going to learn > > anything is by doing. If you need a guide, there are plenty of books > and web sites that you can follow, and this list is a great forum for > asking questions when you get stumped. > > Hang in there. > > > > > > Erik > > > > > > -- > Erik Price > > email: erikprice@mac.com > jabber: erikprice@jabber.org > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- This message was brought to you by one bored guy, with nothing better to do, And the letter Q. Thomi Richards, thomi@imail.net.nz _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From alan.gauld@bt.com Tue Aug 27 13:33:19 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 27 Aug 2002 13:33:19 +0100 Subject: [Tutor] mentor neeeeeded(log file) Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C898@mbtlipnt02.btlabs.bt.co.uk> > me help, but I am very new to any kind of programming > and wanted to start on python. > Is there a way that someone would mentor me in > learning python I really wanna lear but cant seem > to get a kick off The entire list is here to help, you get a better response that way than from any single person. The best way to learn Python will be to start at the beginning with one of the Newbies tutors (maybe even Danny's IDLE tutor before that?). Then work through doing the exa,plres and extending them as you experiment and/or follow the exercises given. If you don't undersand something opr something doesn't work like you expect post the code and the error message along with your question and we will try to explain. That way other beginners benefit from your mistakes and questions and you get a faster and more varied response. The only stupid question is the one you don't ask! How far have you got? Have you installed Python? (From your other mails I assume yes). Which tutorials have you tried? How far through them are you? Start at the beginning, approach it methodically and you can learn to program in a few days or weeks. If you just jump in and try things it woill take a lot longer and you will probably learn a lot of bad habits! Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From alan.gauld@bt.com Tue Aug 27 18:19:09 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 27 Aug 2002 18:19:09 +0100 Subject: [Tutor] ftplib with classes Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C8A3@mbtlipnt02.btlabs.bt.co.uk> > I'm trying to get my hands dirty with using classes ... > different story. Looking at the doc for ftplib I see: > > Now the code I have as of now is: > > import ftplib > > class Connection: > def __init__(self, host='', user='', passwd='', acct=''): > self.user = username > self.host = hostname > self.passwd = password > > Am I doing this right? So far so good. You can now create a connection instance and pass it the details it needs. > Also, for connecting ( connect()) would I use > that as a method? You probably want to make it a method taking some parameters which are defaulted to the self ones: def connect(self, host=self.host,user=self.user,...etc) You might also like to automatically connect within the init method iff you have the requireddata. Add after your code: if self.host != '' and self.user != '' and... self.connect() Then whehn you come to use your class it looks like this: import ftpClass conn1 = ftpClass.Connection() # no connection made yet conn2 = ftpClass.Connection('ftp.google.com', 'anonymous', 'me@foo.com') conn1.connect('ftp.bigbiz.com','agauld', 'ninini') files = conn1.ls() theFile = conn1.get(files[0]) conn1.close() conn2.put(files[0]) conn2.close() And so on. In designing a class it's a good idea to run one of these imaginary usage scenarios to help decide what the methods should look like from the client perspective... HTH, Alan g. From lumbricus@gmx.net Tue Aug 27 18:37:04 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Tue, 27 Aug 2002 19:37:04 +0200 (MEST) Subject: [Tutor] security with ssh?? References: <5.1.0.14.0.20020827134428.02b428e8@www.thinkware.se> Message-ID: <669.1030469824@www39.gmx.net> > At 23:18 2002-08-27 +1200, Thomi Richards wrote: [ snip ] > I can replace /bin/bash with /usr/bin/python and get python > as a login shell, but replacing it with a simple python script > doesn't work. Maybe it's just lacking some environment > variables? Trying to use a python script as login shell gave > "Permission denied". Wrapping it with McMillan installer gave: The path to the program used as login shell must be in /etc/shells HTH, HAND J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From erikprice@mac.com Tue Aug 27 18:53:02 2002 From: erikprice@mac.com (Erik Price) Date: Tue, 27 Aug 2002 13:53:02 -0400 Subject: [Tutor] inheritance vs aggregation in Python Message-ID: My understanding of inheritance and aggregation are pretty limited. I have a question about them (in Python). From what I understand, the primary benefit of inheritance (over aggregation) is that the object is of the same type as the ancestor object it is inheriting from. This is important in Java and presumably in other strongly typed languages. However, aggregation of objects seems (to me) to be more flexible than inheriting from objects, since you don't limit yourself to just that type. So, then, in Python, typing isn't strongly enforced -- so then what is the advantage of inheritance vs simply aggregating an object that you might need? (Other than any performance-related reasons, I'm asking this question in a theoretical rather than practical sense.) Perhaps I've missed some important point, if so then dope slap me and tell me what it is. Thanks, Erik PS: (I swear I've asked this question before, so I probably deserve a dope slap anyway for having forgotten.) From ATrautman@perryjudds.com Tue Aug 27 18:44:25 2002 From: ATrautman@perryjudds.com (Alan Trautman) Date: Tue, 27 Aug 2002 12:44:25 -0500 Subject: [Tutor] mentor neeeeeded(log file) Message-ID: <0BA95581EDA7D611841B00A0C9AD25DD2B5835@mail.pjinet.com> Don't forget to write down how you think the program should function. Then compare this to the problem you are having. It will help you learn how your thinking and what the computer does can be combined to create programs. A quick paper flow chart of what you want to happen is a great reference as you create the code. Eventually if you really program a lot you will learn that good programming begins with paper, background and research not at the keyboard (something I need to remind myself as I rewrite code ...again:( ). Focus on something simple you want to accomplish. There are many good tutorials out there for Python. Don't forget you can take one that does something you like and diagram it as well. You can learn a lot from good code! I like calculator programs to begin with they are simple to get started and can become increasingly complex such as adding a graphical user interface, scientific functions etc. [Alan Trautman] -----Original Message----- From: Morne [mailto:fromclay@maxitec.co.za] Sent: Tuesday, August 27, 2002 7:20 AM To: python tutor Subject: [Tutor] mentor neeeeeded(log file) Hi I have been asking for help and you have been giving me help, but I am very new to any kind of programming and wanted to start on python. Is there a way that someone would mentor me in learnning python I really wanna lear but cant seem to get a kick off Please let me know fromclay@maxitec.co.za From shalehperry@attbi.com Tue Aug 27 18:54:57 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Tue, 27 Aug 2002 10:54:57 -0700 Subject: [Tutor] inheritance vs aggregation in Python In-Reply-To: References: Message-ID: <200208271054.57420.shalehperry@attbi.com> On Tuesday 27 August 2002 10:53, Erik Price wrote: > My understanding of inheritance and aggregation are pretty limited. I > have a question about them (in Python). > > From what I understand, the primary benefit of inheritance (over > aggregation) is that the object is of the same type as the ancestor > object it is inheriting from. This is important in Java and presumably > in other strongly typed languages. > > However, aggregation of objects seems (to me) to be more flexible than > inheriting from objects, since you don't limit yourself to just that > type. > > So, then, in Python, typing isn't strongly enforced -- so then what is > the advantage of inheritance vs simply aggregating an object that you > might need? (Other than any performance-related reasons, I'm asking > this question in a theoretical rather than practical sense.) > Part of programming is creating something from a specification. Inherita= nce=20 often makes for a more clear implementation and leads to "self documentin= g"=20 code. The proverbial example uses animals or geometry. Animal -> Bird -> Raven For a more real world situation consider a Factory which makes Widgets. Widget -> WidgetTypeI WidgetTypeII a Widget may define a part number and a factory number (where was it made= ). You could then use aggregation to group several Widgets into a Car for=20 instance. In the OO literature Inheritance is called "is-a" and aggregation is call= ed=20 "has-a". 'A bird is a animal' or 'A WidgetTypeI is a Widget' or 'A Car h= as a=20 Windshield'. From dyoo@hkn.eecs.berkeley.edu Tue Aug 27 18:55:43 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Tue, 27 Aug 2002 10:55:43 -0700 (PDT) Subject: [Tutor] Why lambda could be considered evil In-Reply-To: <89B8DAB3-B9B0-11D6-B316-00039351FE6A@mac.com> Message-ID: On Tue, 27 Aug 2002, Erik Price wrote: > > On Tuesday, August 27, 2002, at 06:59 AM, alan.gauld@bt.com wrote: > > > However understanding lamda expressions is one of those "change your > > life" type discoveries in programming. Once you get them the whole > > theoretocal basis of programming kind of pops into focus - or it did > > for me! > > That's the thing -- I'm not there yet. I had a 24-hour sense of clarity > and a "change your life" feeling when I finally understood the > fundamental concept of OO programming (why was that so hard to > understand at one time? in retrospect it's so simple), perhaps someday > I'll have the same experience with lambda. But until the lightbulb goes > off in my head, I'm willing to hear any arguments for or against. If you have some free time, I'd recommend a book called "Structure and Interpretation of Computer Programs". It has a big lambda symbol on the front cover --- surely, with it, we may be able to elucidate this mystery! *grin* http://mitpress.mit.edu/sicp/full-text/book/book.html Lambda isn't quite effective in Python, but because it's much more powerful in the Scheme Lisp language, you may find it easier to pick up the concept in that language. The book is freely available online, which is very convenient. I think of 'lambda' as a constructor of functions --- in languages that fully support lambda functions, we can take advantage of lambda and variable name binding to create what we think of as a function. As a concrete example, let's take a simple function definition: ### >>> def square(x): ... return x * x ... ### What's weird about this simple snippet is that it's doing two separate things at once: it's creating this sort of function object that we can look at: ### >>> square ### and it's also "binding" it to a name. That is, just as we bind variables like numbers and strings by doing things like arithmetic: ### >>> gold_ratio = (1+5**0.5)/2 >>> gold_ratio 1.6180339887498949 >>> name = "Erik " + "Price" >>> name 'Erik Price' ### the idea behind lambda is that functions themselves are values that are constructed, and that can be handled just like numbers and strings: ### >>> some_function = lambda (x): x * x >>> some_function at 0x8115fac> ### I think that's one of the key ideas behind lambda --- functions aren't any more "special" than other objects in the language: they just have different properties. And what makes a function really different is that it can be called: ### >>> some_function(8) 64 ### and that's basically it. In a language that fully supports lambda, there's no need for a separate "function definition" syntax, because all we'd need to define functions is variable assignment and that lambda function constructor. I hope that made some sort of sense. *grin* Good luck! From erikprice@mac.com Tue Aug 27 19:09:30 2002 From: erikprice@mac.com (Erik Price) Date: Tue, 27 Aug 2002 14:09:30 -0400 Subject: [Tutor] mentor neeeeeded(log file) In-Reply-To: <0BA95581EDA7D611841B00A0C9AD25DD2B5835@mail.pjinet.com> Message-ID: <221C0E3C-B9E8-11D6-AE5E-00039351FE6A@mac.com> On Tuesday, August 27, 2002, at 01:44 PM, Alan Trautman wrote: > Don't forget to write down how you think the program should function. > Then > compare this to the problem you are having. It will help you learn how > your > thinking and what the computer does can be combined to create > programs. A > quick paper flow chart of what you want to happen is a great reference > as > you create the code. Eventually if you really program a lot you will > learn > that good programming begins with paper, background and research not > at the > keyboard (something I need to remind myself as I rewrite code > ...again:( ). This is really important. I taught myself to program from some books, and I wrote my first "real" application in an easy language called PHP. It was really nothing more than a specialized content management system for a company that I was temping for. But as I learned more and more about programming, I realized that I had sort of gone about it the wrong way -- rather than come up with a good plan of what I wanted to do, I sort of just went and did it. I finally finished it after a couple of months (it was many thousands of lines of code), but by that time I knew I would have done it completely differently than I had, if I had known everything that I then knew when I first started. [Sorry that last sentence is a mouthful.] The reason I tell you this isn't to make you think that it's hard to program, but rather to emphasize that, once you get past the stage of experimenting with and learning the basics, you will find that designing the program is really a major part of the job. This seems to be especially true of larger programs. I'm still learning to program, in fact, as you can tell from my posts I still have a lot of questions. I thought that it would be a worthwhile lesson to try using UML. I have taken a night job as a waiter in a restaurant and have been using a spreadsheet to keep track of my tips and sales. When I find the time, I'm going to try to model a tip-tracking program, perhaps using a database like MySQL to store the data. But I don't want to just jump in and do it (though that is very tempting), I'm going to try to map out my needs first, then determine the various entities in the application (database, user, tips, hours worked, taxes, etc), and then try to see the best way to reproduce those real-life relationships in a program. Only after all of this will I actually sit down and write the code. For such a simple application, this might seem like overkill. Just remember that it's more of an exercise than anything else! (It can probably be done entirely in one line using Perl, but... ;) Erik From Jaco.Smuts@za.didata.com Tue Aug 27 19:34:27 2002 From: Jaco.Smuts@za.didata.com (Jaco.Smuts@za.didata.com) Date: Tue, 27 Aug 2002 20:34:27 +0200 Subject: [Tutor] multi threaded queue examples Message-ID: Hello I'm sure it's a huge bite for some-one with my limited experience, but I'm looking for a tutorial or examples of how to implement multi threading in Python. More specifically I'm looking for examples implementing the standard library queue. Thanks Jaco This message contains information intended solely for the addressee, which is confidential or private in nature and subject to legal privilege. If you are not the intended recipient, you may not peruse, use, disseminate, distribute or copy this message or any file attached to this message. Any such unauthorised use is prohibited and may be unlawful. If you have received this message in error, please notify the sender immediately by e-mail, facsimile or telephone and thereafter delete the original message from your machine. Furthermore, the information contained in this message, and any attachments thereto, is for information purposes only and may contain the personal views and opinions of the author, which are not necessarily the views and opinions of Dimension Data (South Africa) (Proprietary) Limited or is subsidiaries and associated companies ("Dimension Data"). Dimension Data therefore does not accept liability for any claims, loss or damages of whatsoever nature, arising as a result of the reliance on such information by anyone. Whilst all reasonable steps are taken to ensure the accuracy and integrity of information transmitted electronically and to preserve the confidentiality thereof, Dimension Data accepts no liability or responsibility whatsoever if information or data is, for whatsoever reason, incorrect, corrupted or does not reach its intended destination. From erikprice@mac.com Tue Aug 27 19:44:19 2002 From: erikprice@mac.com (Erik Price) Date: Tue, 27 Aug 2002 14:44:19 -0400 Subject: [Tutor] Why lambda could be considered evil In-Reply-To: Message-ID: On Tuesday, August 27, 2002, at 01:55 PM, Danny Yoo wrote: > If you have some free time, I'd recommend a book called "Structure and > Interpretation of Computer Programs". It has a big lambda symbol on > the > front cover --- surely, with it, we may be able to elucidate this > mystery! > *grin* I've been recommended to this book before... actually I've heard of it in many places. I'll have to check it out. But -another- programming language!! ;) (I'm still getting used to Python!) > In a language that fully supports lambda, there's no need for a > separate > "function definition" syntax, because all we'd need to define > functions is > variable assignment and that lambda function constructor. How is Python deficient compared with these languages? Does this restrict a person from using "functional programming" in Python? > I hope that made some sort of sense. *grin* Good luck! Yes, definitely. Thanks very much. Erik From erikprice@mac.com Tue Aug 27 19:45:13 2002 From: erikprice@mac.com (Erik Price) Date: Tue, 27 Aug 2002 14:45:13 -0400 Subject: [Tutor] inheritance vs aggregation in Python In-Reply-To: <200208271054.57420.shalehperry@attbi.com> Message-ID: <1EDAF090-B9ED-11D6-AE5E-00039351FE6A@mac.com> On Tuesday, August 27, 2002, at 01:54 PM, Sean 'Shaleh' Perry wrote: > Part of programming is creating something from a specification. > Inheritance > often makes for a more clear implementation and leads to "self > documenting" > code. I see. So "use it when it makes sense", but you're not -forced- to do so as you are in stricter languages. Thanks. Erik From shalehperry@attbi.com Tue Aug 27 20:10:15 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Tue, 27 Aug 2002 12:10:15 -0700 Subject: [Tutor] inheritance vs aggregation in Python In-Reply-To: <1EDAF090-B9ED-11D6-AE5E-00039351FE6A@mac.com> References: <1EDAF090-B9ED-11D6-AE5E-00039351FE6A@mac.com> Message-ID: <200208271210.15839.shalehperry@attbi.com> On Tuesday 27 August 2002 11:45, Erik Price wrote: > On Tuesday, August 27, 2002, at 01:54 PM, Sean 'Shaleh' Perry wrote: > > Part of programming is creating something from a specification. > > Inheritance > > often makes for a more clear implementation and leads to "self > > documenting" > > code. > > I see. So "use it when it makes sense", but you're not -forced- to do > so as you are in stricter languages. > Actually you are not "forced" to in other languages either. Here in Pyth= on=20 most new classes will be derived from Object. This inheritance is simila= r to=20 the way Java works. In C++ you have say BaseStream which you derive StringStream from (lets y= ou=20 read from a string as if it were say stdin) but your C++ implementation o= f=20 the Python rfc822 module would not derive from either of these it would=20 contain a Stream instance. Many times large inheritance hierarchies are the sign of poor design. From dyoo@hkn.eecs.berkeley.edu Tue Aug 27 20:46:09 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Tue, 27 Aug 2002 12:46:09 -0700 (PDT) Subject: [Tutor] Why lambda could be considered evil In-Reply-To: Message-ID: On Tue, 27 Aug 2002, Erik Price wrote: > > On Tuesday, August 27, 2002, at 01:55 PM, Danny Yoo wrote: > > > If you have some free time, I'd recommend a book called "Structure and > > Interpretation of Computer Programs". It has a big lambda symbol on > > the front cover --- surely, with it, we may be able to elucidate this > > mystery! *grin* > > I've been recommended to this book before... actually I've heard of it > in many places. I'll have to check it out. But -another- programming > language!! ;) (I'm still getting used to Python!) > > > In a language that fully supports lambda, there's no need for a > > separate "function definition" syntax, because all we'd need to define > > functions is variable assignment and that lambda function constructor. > > How is Python deficient compared with these languages? Lambda in Python is specifically weakened to only allow one "expression" in it --- it's only meant to be a shortcut way of constructing a quicky throwaway function. And Python makes a distinction between expressions, like: ### >>> 42 42 ### and statements, like assignment: ### >>> the_answer = 42 ### It's that double-whammy combination of one-expression / statements-are-not-expressions restriction that makes lambda fairly weak in Python. There are only a few statement types in Python, but they're pretty common, like print if / elif variable name assignment (=) which is why stuff like 'lambda x: print x' doesn't work in Python: 'print' isn't an expression, so it can't be used in a lambda. Not that there aren't any benefits to separating statements from expressions: it allows us to use a familiar assignment syntax when we do keyword parameter stuff, like that cgi.parse_qs() example from a few days ago. But it does keeps us from using lambda to make any Python function: Python's lambda just isn't powerful enough: it can't make any functions that contain statements. On the other hand, some languages make no distinction between "statements" and "expressions", which make it easier to mix them together. In Scheme, for example, everything's an expression. Something like this: ### (Python) def factorial(x): if x == 0: return 1 return x * factorial(x-1) ### would be difficult to write as a lambda. However, we can do it easily in Scheme, because Scheme's conditional isn't a statement, but an expression that gives us a value back: ;;; (Scheme) (define factorial (lambda (x) (if (= x 0) 1 (* x (factorial (- x 1)))))) ;;; which translates in English to "the name 'factorial' will stand for this function that takes one parameter 'x'." So the tools that a Scheme programmer has are smaller and simpler, which is very alluring to someone who likes purity. But here is one evil expression that involves lambda in a terribly convoluted way: ;;; (Scheme) ((lambda (kickstart-function x) (kickstart-function x kickstart-function)) (lambda (y self-function) (if (= y 0) 1 (* y (self-function (- y 1) self-function)))) 5) ;;; Try guessing what that bit of code is doing, but don't stare at it too long. *grin* If it helps, and if you have a scheme interpreter like 'guile' on your system, you can vary the number at the bottom. The fact that Scheme's lambda can be composed like this, and that everything is an expression, is both a blessing and a curse --- in Scheme, that language permits all expressions to mix well with each other... sometimes too well. But by forcing a wedge between statements and expressions, the Python language tries to bound the complexity of any expression in Python to something humanly managable. So Python's lambda is weak for practical reasons. > Does this restrict a person from using "functional programming" in > Python? No, no, but it does reduces the power of using 'lambda' when we do functional programming, placing it more in the 'def' statement. When we do functional programming in Python, we find outselves having to use 'def' to be able to use statements in our functions. Again, I hope some of this made some sense. *grin* From magnus@thinkware.se Tue Aug 27 21:36:10 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Tue, 27 Aug 2002 22:36:10 +0200 Subject: [Tutor] security with ssh?? In-Reply-To: <669.1030469824@www39.gmx.net> References: <5.1.0.14.0.20020827134428.02b428e8@www.thinkware.se> Message-ID: <5.1.0.14.0.20020827223132.02b16488@www.thinkware.se> At 19:37 2002-08-27 +0200, lumbricus@gmx.net wrote: >The path to the program used as login shell must be in >/etc/shells Well, some programs check this, but not sshd it seems. Setting the shell to /usr/bin/python in /etc/passwd worked without problems. Login in brought me to the python prompt, and raise SystemExit logged me out. I never put python in /etc/shells. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From aicolburn@yahoo.com Tue Aug 27 23:17:20 2002 From: aicolburn@yahoo.com (Alan Colburn) Date: Tue, 27 Aug 2002 15:17:20 -0700 Subject: [Tutor] Understanding Nested Commands Message-ID: <008201c24e17$82fa6ee0$cae68b86@fo5132> A few weeks ago I asked the list: "I'd like to save a file, with a list of lists, in a format that could be read directly into a spreadsheet. Each list would represent a different row, and each list element a different column. How could I go about doing this? (List elements are strings.)" One response suggested this: >>> myList = [['a','b','c'],['d','e','f'],['g','h','i']] >>> '\n'.join([','.join(sublist) for sublist in myList]) It's a great solution that does everything I wanted. However, I'm slightly stumped in understanding how it works. Can someone take me through what's going on? Or, alternatively, show me how I might do the exact same thing via multiple lines, i.e., for sublist in myList: for member in sublist: #etc. I understand the .join command and everything else that's going on here. I could, of course, just continue using the statement as is ... I just have this insatiable desire to know :-) Thanks, as always -- Al From cyberdiction@hotmail.com Tue Aug 27 23:13:32 2002 From: cyberdiction@hotmail.com (Stephen Harris) Date: Tue, 27 Aug 2002 15:13:32 -0700 Subject: [Tutor] Beginner-->conditional statements References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C893@mbtlipnt02.btlabs.bt.co.uk> Message-ID: I went to your website and read a good part of your tutorial. I had a question about the usage of '%' for MOD and then its apparent different meaning in the next contiguous section. However, my post to you from your website bounced as spam! I posted to you rather than list because your website indicated to do so. The difference is between: a and alan; crosswinds/net; and bt/com So by etc. does that include SF Fisherman's Wharf and Wax Museum? Santa Cruz, is 90 miles south on Hwy 1 and is a scenic drive. It has a Boardwalk(probably of dubious value to you) and a Greek Festival Sept 6-8 which takes place near the downtown shopping mall. Original message below: Hi, Thank you, I am finding your tutorial useful, but got stuck. I dont understand how '%' used in this example is consistent with mod? Perhaps you just meant it as a variable for numbers. I am confused with the prior usage as a remainder. >>> print 7%4 3 % is known as the modulus or mod operator and in other languages is often seen as MOD or similar. Experiment and you will soon get the idea. >>>print 'The total is: ', 23+45 You've seen that we can print strings and numbers. Now we combine the two in one print statement, separating them with a comma. We can extend this feature by combining it with a useful Python trick for outputting data called a format string: >>> print "The sum of %d and %d is: %d" % (7,18,7+18) {SH: This seems like a new usage? I'm not sure how to evaluate it? I couln't come up with a pattern for understanding it from previous info} In this command the format string contains '%' markers within it. The letter 'd' after the % tells Python that a 'decimal number' should be placed there. The values to fill in the markers are obtained from the values inside the bracketed expression following the % sign on its own. There are other letters that can be placed after the % markers. Some of these include: %s - for string %x - for hexadecimal number %0.2f - for a real number with a maximum of 2 decimal places %04d - pad the number out to 4 digits with 0's Regards, Stephen ----- Original Message ----- From: To: ; Sent: Tuesday, August 27, 2002 3:25 AM Subject: RE: [Tutor] Beginner-->conditional statements > > Also does anyone know of a tutorial(which dwells upon) > > that covers those conditional statements in some detail > > with some graduating problems and solutions? > > Most of the tutorials on the beginners pages explain them. > How much they provide in the way of excercises is variable. > > Have you looked at any of those tutorials yet? Is there > anything specific you don't understand? (This is a > good place to ask those kind of specific questions!) > > Alan g. > Author of the 'Learning to Program' web site > http://www.freenetpages.co.uk/hp/alan.gauld > From shalehperry@attbi.com Tue Aug 27 23:47:05 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Tue, 27 Aug 2002 15:47:05 -0700 Subject: [Tutor] Understanding Nested Commands In-Reply-To: <008201c24e17$82fa6ee0$cae68b86@fo5132> References: <008201c24e17$82fa6ee0$cae68b86@fo5132> Message-ID: <200208271547.05270.shalehperry@attbi.com> On Tuesday 27 August 2002 15:17, Alan Colburn wrote: > > One response suggested this: > >>> myList =3D [['a','b','c'],['d','e','f'],['g','h','i']] > >>> '\n'.join([','.join(sublist) for sublist in myList]) > > It's a great solution that does everything I wanted. However, I'm sligh= tly > stumped in understanding how it works. Can someone take me through what= 's > going > on? Or, alternatively, show me how I might do the exact same thing via > multiple lines, i.e., > result =3D [] for sublist in myList: result.append(','.join(sublist)) '\n'.join(result) The center work of the code was done by a list comprehension which gives = you=20 code of the form: [x for x in list] a list comprehension's result is a new list much like the functions map()= or=20 filter(). In fact I could write the earlier code like this: '\n'.join(map(lambda x: ','.join(x), myList)) Hope that helps. From jsoons@juilliard.edu Wed Aug 28 00:53:19 2002 From: jsoons@juilliard.edu (Jonathan Soons) Date: Tue, 27 Aug 2002 19:53:19 -0400 Subject: [Tutor] mutual recursion Message-ID: <33E101AC5AFF78419F466954A96854202F5843@mailbox.juilliard.edu> I am trying to create two lists. I have two functions that call each = other. I thought they might act as a flip-flop and add alternately to the two = lists. The file that gets read is something like: PER-BEGIN blah blah blah AWD-BEGIN blah blah blah blah PER-BEGIN blah blah blah AWD-BEGIN blah blah The script is: import string, sys, os, time f =3D open(sys.argv[1], 'r') txt =3D f.readlines() f.close() n =3D 0 awd =3D [] lets =3D [] def incrper() : global n, txt, awd, lets while txt[n] !=3D "AWD-BEGIN\n" : lets.append(txt[n]) n =3D n + 1 if n > len(txt) : break incrawd() def incrawd() : global n, txt, awd, lets while txt[n] !=3D "PER-BEGIN\n" : awd.append(txt[n]) n =3D n + 1 if n > len(txt) : break incrper() incrper() The error is: Traceback (most recent call last): File "F:\printawards.py", line 26, in ? incrper() File "F:\printawards.py", line 10, in incrper while txt[n] !=3D "AWD-BEGIN\n" : IndexError: list index out of range Is there a right way to do this? Thanks From runsun@bilbo.bio.purdue.edu Wed Aug 28 03:14:21 2002 From: runsun@bilbo.bio.purdue.edu (runsun) Date: Tue, 27 Aug 2002 21:14:21 -0500 Subject: [Tutor] Default function in a class ... is it possible??? In-Reply-To: <20020827203504.23600.31283.Mailman@mail.python.org> Message-ID: Hi I wanna know if a class can have a default function. For example, class myclass: def __init__(self): pass def quote(self, aText): return "[" + aText + "]" c =3D myclass() print c.quote('data') =3D=3D=3D> will print "[data]" Is there any way to make the following possible: print c('data') =3D=3D=3D=3D=3D> also print "[data]" means, making the function "quote()" as the default function of class "myclass" Thx in advance. pan =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 ~~ Be like water, be shapeless ~~ Runsun Pan, PhD, 773-834-3965 Ecology & Evolution, U of Chicago ------------------------------------------------------ =ABn=A4=E8=A7=D6=B3=F8=BA=F4=B8=F4=AA=A9 http://snews.8k.com/ =A4=E5=A4=C6=BD=D7=BE=C2 http://taiwantp.net/cgi/roadbbs.pl?board_id=3D7 =ACF=B8g=BD=D7=BE=C2 http://taiwantp.net/cgi/roadbbs.pl?board_id=3D3 =BBP=B4C=C5=E9=B9=EF=A7=DC http://taiwantp.net/cgi/roadbbs.pl?board_id=3D= 2 =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 scot@possum.in-berlin.de Tue Aug 27 19:12:18 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Tue, 27 Aug 2002 20:12:18 +0200 Subject: [Tutor] Why lambda could be considered evil In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C894@mbtlipnt02.btlabs.bt.co.uk> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C894@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <200208272012.18985.scot@possum.in-berlin.de> Hello Alan, > However understanding lambda expressions is one of > those "change your life" type discoveries in programming. Hmpf. Maybe my life isn't ready to be changed quite just yet =8). > The class statement is part of OO and not a rip off > from C++, similarly lambda is part of functional > programming. You could also add that list comprehensions come from something called Haskell, and generators from Icon, and I would agree. However, I see a major difference between classes, generators, and list comprehensions on the one hand and lambda, print >> file, and print "Funny %s characters" % variable on the other: The syntax of classes, generators and list comprehensions was changed to Python's way of doing things, while lambda and the two prints retain their "native" we-use-special-characters syntax. While discussing list comprehensions and their Haskell source in recipe 2.11 in the "Python Cookbook", Nathaniel Gray points out that Python tends to use keywords where other languages use punctuation, so that Haskell list comprehension terms such as [y | y <- xs, y < x] are turned into something like this in Python: [y for y in xs if y < x] (note that I couldn't even order a beer in Haskell, so this might not be the exact equivalent). Same thing goes for the class statement, which was adapted to Python: The very syntax has been turned Pythonic, and uses keywords instead of strange arrow thingies or double colons or whatever the other languages use. But the other three examples weren't absorbed into the language, they were just copied from C or Lisp, and they kept their native "punctuation" syntax. I'm not sure I understand why (except for the mighty C and Lisp lobbyists, which are probably linked to the Illuminati and Knights Templar), because print >> file, 'Print me' could have been print to file, 'Print me' or even better print 'Print me' to file and print "Hello Mr. %s" % name could have been print "Hello Mr. %s" using name or print "Hello Mr. %s" with name Which looks a lot more Pythonic to me. I've read the PEPs and BDFL pronouncements and I'm still not convinced. Given the number of English words in the OED, I'm _certainly_ not convinced that "keyword inflation" is going to be a problem anytime soon. And using keywords is just so much more consistant with the rest of the language, and better for human readers. > Of course it would help if lambdas were fully implemented > to allow multi line 'arbitrary' blocks of code rather > than just single line expressions.... I'm having some trouble visualizing that - could you give an example (in pseudocode or whatever) of what that would look like? > > 3. The name is just plain stupid. .... > > be intuitive if you've spent the last 20 years programming Lisp, > Or studying lambda calculus! Well, I'm not sure if the majority of Python users have actually done that, either =8)...I dimly remember having had calculus in school at some point, but I'd be hard pressed to come up with any details... I think this discussion can be reduced to one question: Is Python, or rather, Python's syntax, geared more towards computer science people with a strong background in various computer languages and math, or is it aimed more at what I would call the educated computer user who has some background, but nothing formal? I would argue that so far, it is mostly geared from the educated public, not specialists. My Exhibit One would be the new form of division, which is going to drive computer science people up the wall, but "real" people will just love because it is "real" division. If that is in fact so, then lambda and the two print forms mentioned above don't quite fit in. Y, Scot -- Scot W. Stevenson wrote me on Tuesday, 27. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1694 hours and has a CPU that is falling asleep at a system load of 0.01. From myregmail@yahoo.com Wed Aug 28 05:44:32 2002 From: myregmail@yahoo.com (Noriko Sakai) Date: Tue, 27 Aug 2002 21:44:32 -0700 (PDT) Subject: [Tutor] How to extract information from a stock website Message-ID: <20020828044432.43872.qmail@web13306.mail.yahoo.com> Hi. I'm new to Python, and i've read that Python is capable of extracting information such as latest stock prices off the web. Can anyone tell me how i can achieve this. I was thinking of building a website that uses this information to help manage my stock portfolios. Also, if i want to create a stand alone Windows program that does this portfolio management, can i still use Python to extract information as the back-end of the software ? Any help appreciated. Thank you __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From scot@possum.in-berlin.de Wed Aug 28 05:50:39 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Wed, 28 Aug 2002 06:50:39 +0200 Subject: [Tutor] A simple RPN calculator Message-ID: <200208280650.39225.scot@possum.in-berlin.de> Hello there, I had started a thread about Reverse Polish Notation calculators a while ago, and Gregor actually wrote one, and I did that smart-ass thing of coming back and saying, hey, really neat, Gregor, but how about the following functions...So I guess I owe him some code =8). Included is my attempt at a simple RPN calculator, any feedback of course would be most appreciated. Y, Scot ============================================================ #!/usr/bin/env python # Simple Reverse Polish Notation Calculator # Scot W. Stevenson 28. August 2002 # For the Python Tutor Mailinglist import cmd, sys class rpn_calc(cmd.Cmd): """Simple RPN calculator""" def __init__(self, stacksize=4): self.stack = [0]*stacksize self.stacksize = len(self.stack) self.lastregister = self.stacksize-1 self.intro='Simple RPN Calculator\nScot W. Stevenson 28. Aug 2002' self.lastx = 0 self.operations = { '+': self.do_add, '-': self.do_subtract, '*': self.do_multiply, '/': self.do_divide, '^': self.do_power} # Helper functions def _stacklift(self, new_x): """Lift stack by one entry, last register is lost""" del self.stack[self.lastregister] self.stack.insert(0, new_x) def _stackdrop(self, new_x): """Drop stack by one entry, losing Y register entry, last register is doubled""" self.stack.append(self.stack[self.lastregister]) del self.stack[0] self.stack[0]=new_x # Catch numbers and operators def default(self, entry): """Catch numbers and operators and process them. If entry is neither number nor operator, ignore and pass on to cmd loop.""" # Catch numbers try: number = float(entry) self.lastx = self.stack[0] self._stacklift(number) except ValueError: pass # Catch operations if entry in self.operations: operation = self.operations[entry] operation() # Show X register after each command def postcmd(self, *dummy): """Display the contents of the X register after each command""" print " %f" % self.stack[0] # Calculator commands def do_add(self, dummy=None): result = self.stack[1] + self.stack[0] self._stackdrop(result) def do_clrx(self, rest): """Clear X register""" self.stack[0] = 0 def do_divide(self, dummy=None): try: result = self.stack[2] / self.stack[0] self._stackdrop(result) except ZeroDivisionError: print "*** Division by Zero Error ***" def do_enter(self, dummy): """Perform a stack lift; last register value is lost, first (X) register value is pushed into the second (Y) register""" self._stacklift(self.stack[0]) def emptyline(self, dummy=None): """An empty line is treated like hitting the ENTER key""" self.do_enter(None) def do_lastx(self, dummy): """Restore X register value from before the operation in the X register, performing a stack lift""" self._stacklift(self.lastx) def do_multiply(self, dummy=None): try: result = self.stack[1] * self.stack[0] self._stackdrop(result) except OverflowError: print '*** Overflow Error ***' def do_power(self, dummy=None): try: result = pow(self.stack[1], self.stack[0]) self._stackdrop(result) except OverflowError: print '*** Overflow Error ***' def do_print(self, rest): """Print stack. Mostly used for debugging""" for i in range(self.stacksize-1, -1, -1): print 'Reg %s: %f' % (i, self.stack[i]) def do_quit(self, dummy): sys.exit() def do_rdown(self, dummy): """Roll down stack""" self.stack.append(self.stack[0]) del self.stack[0] def do_rup(self, dummy): """Roll up stack""" self.stack.insert(0, self.stack[self.lastregister]) del self.stack[self.lastregister+1] def do_subtract(self, dummy=None): result = self.stack[1] - self.stack[0] self._stackdrop(result) def do_xy(self, dummy): """Swap X and Y registers""" self.stack[0], self.stack[1] = self.stack[1], self.stack[0] # Help texts def help_add(self): print 'Add X and Y register. Use "+" key or "add" command' def help_clrx(self): print 'Clear X register' def help_divide(self): print 'Divide X by Y register. Use "/" key or "divide" command' def help_enter(self): print 'Push stack up by one, last register is lost' def help_help(self): print 'Prints list of commands' def help_lastx(self): print 'Retrieves value of the X register from before the last' print 'operation and pushes it in the X register, lifting the' print 'stack.' def help_multiply(self): print 'Multiply X by Y register. Use "*" key or "subtract" command' def help_power(self): print 'Take Y to the Xth power. Use "^" key or "power" command' def help_print(self): print 'Print stack. Used mostly for debugging' def help_rdown(self): print 'Rolls stack downwards' def help_rup(self): print 'Rolls stack upwards' def help_quit(self): print 'Quit program' def help_subtract(self): print 'Subtract X from Y register. Use "-" key or "subtract" cmd' def help_xy(self): print 'Swaps X and Y registers' # Main loop if __name__ == '__main__': testcalc = rpn_calc() testcalc.cmdloop() From hsteiger@comcast.net Wed Aug 28 06:23:25 2002 From: hsteiger@comcast.net (Henry Steigerwaldt) Date: Wed, 28 Aug 2002 00:23:25 -0500 Subject: [Tutor] Python Imaging Library Message-ID: <000801c24e53$0950d660$0201a8c0@eagle> This is a multi-part message in MIME format. --Boundary_(ID_xoIF8LHXjvZWNg0UWPkfIg) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT To All: I downloaded the PIL version 1.1.3 that can be used with Python version 2.2. I do have three questions however. 1) When I extract the files, in which directory should I extract them to? 2) Once that is done, how do I tie them into the Python 2.2 program, so that when I use import Image, etc. within a Python program to bring in the PIL library routines, Python will know where the PIL library is located? 3) Also, am I correct in saying that if I want to open a graphic file and plot it on a canvas, I must use PIL? Or would I have been able to do that with what already comes with the Python 2.2 download? Thanks much! Henry Steigerwaldt Hermitage, TN --Boundary_(ID_xoIF8LHXjvZWNg0UWPkfIg) Content-type: text/html; charset=iso-8859-1 Content-transfer-encoding: 7BIT
To All:
 
I downloaded the PIL version 1.1.3 that can be used with
Python version 2.2. I do have three questions however.
 
1)   When I extract the files, in which directory should I extract
     them to?
 
2)  Once that is done, how do I tie them into the Python 2.2
     program, so that when I use import Image, etc. within a Python
     program to bring in the PIL library routines, Python will know
     where the PIL library is located?
 
3)  Also, am I correct in saying that if I want to open a graphic
     file and plot it on a canvas, I must use PIL? Or would I have
     been able to do that with what already comes with the Python
     2.2 download? 
 
Thanks much!
 
Henry Steigerwaldt
Hermitage, TN
 
--Boundary_(ID_xoIF8LHXjvZWNg0UWPkfIg)-- From scot@possum.in-berlin.de Wed Aug 28 07:03:59 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Wed, 28 Aug 2002 08:03:59 +0200 Subject: [Tutor] Stupid mistake in RPN calculator In-Reply-To: <200208280650.39225.scot@possum.in-berlin.de> References: <200208280650.39225.scot@possum.in-berlin.de> Message-ID: <200208280803.59084.scot@possum.in-berlin.de> Hi - There is a typo in the division method of the RPN calculator I posted earlier: > def do_divide(self, dummy=None): > try: > result = self.stack[2] / self.stack[0] The last line must be: result = self.stack[1] / self.stack[0] Sorry. Y, Scot -- Scot W. Stevenson wrote me on Wednesday, 28. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1709 hours and has a CPU that is falling asleep at a system load of 0.12. From scot@possum.in-berlin.de Wed Aug 28 07:17:56 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Wed, 28 Aug 2002 08:17:56 +0200 Subject: [Tutor] Summing up the lambda discussion Message-ID: <200208280817.56661.scot@possum.in-berlin.de> Hi there, If I understand the comments by the experts here, then the discussion on lambda could be summed up as following: 1. Python only implements a primitive version of lambdas, robbing this tool of most of the power it has in other languages such as Scheme [which is a variant of Lisp?]. Actually, they're kinda neat when done right, and it is unfair to criticize them based on the Python implementation. 2. Our lambdas are further hamstrung by Python's distinction between statements and expressions, which isn't a feature of other, more lambda-friendly languages. 3. Any Python lambda can be replaced by a def statement, tho this requires extra coding and creates a bound function. Now this sounds like _everybody_ is frustrated by Python's lambda function: The experts because it is only a shadow of the lambdas in functional languages, and the newbies because it somewhat confusing at first in syntax and use. So the obvious question seems to be: Are there any plans to either beef up lambda so it is as useful as in other languages, or to just implement the Cheese Shop solution and get rid of it alltogether? Y, Scot -- Scot W. Stevenson wrote me on Wednesday, 28. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1709 hours and has a CPU that is falling asleep at a system load of 0.05. From idiot1@netzero.net Wed Aug 28 07:17:34 2002 From: idiot1@netzero.net (Kirk Bailey) Date: Wed, 28 Aug 2002 02:17:34 -0400 Subject: [Fwd: [Fwd: [Tutor] Re: books arrived]] Message-ID: <3D6C6AFE.1E6D33E7@netzero.net> Ah. Things are becoming clearer, he said as he sounded the foghorn. James Porter wrote: > > Not more juice! More HARD DISK space. Even if I just took you to FreeBSD > 4.2 it would need a 20 gig drive. FreeBSD 3.4 doesn't have the ELF > binaries proper for 2.x Python. The ports collection is entirely driven as > an ELF even and 4.x ports dont work in 3.x > > Shesh. > > At 12:58 AM 8/27/02 -0400, you wrote: > >Hmmm, some feel bigger server is not needed for 2.2 python. > > > >Derrick 'dman' Hudson wrote: > >> > >> On Mon, Aug 26, 2002 at 12:04:29AM -0400, Kirk Bailey wrote: > >> | Syntax is ok, but the modules I need to study more. and alas, I am stuck > >> | for the time being with 1.5.2, my hardware guru says we would have to > >> | upgrade critter to handle the new version. > >> > >> Heh. The hardware guy says you need more juice. Let me tell you > >> about NOT _need_ing more juice. I have a 486sx here with 8MB RAM and > >> a 320 MB hard drive. If I wanted to, I could install python and run > >> scripts. I haven't because I have another machine that doesn't thrash > >> so much, but I _could_ run python on it. I'm sure whatever system you > >> have it is better than that 486 :-). > >> > >> -D > >> > >> -- > >> There is not a righteous man on earth > >> who does what is right and never sins. > >> Ecclesiastes 7:20 > >> > >> http://dman.ddts.net/~dman/ > >> > >> ------------------------------------------------------------------------ > >> Part 1.2Type: application/pgp-signature > > > >-- > > > >end > > > >Respectfully, > > Kirk D Bailey > > > > > >+---------------------"Thou Art Free." -Eris-----------------------+ > >| http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | > >| KILL spam dead! http://www.scambusters.org/stopspam/#Pledge | > >| http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | > >+------------------Thinking| NORMAL |Thinking----------------------+ > > +--------+ > >------------------------------------------- > >Introducing NetZero Long Distance > >Unlimited Long Distance only $29.95/ month! > >Sign Up Today! www.netzerolongdistance.com > > > > -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | KILL spam dead! http://www.scambusters.org/stopspam/#Pledge | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com From dylan.belsey@baesystems.com Wed Aug 28 07:39:42 2002 From: dylan.belsey@baesystems.com (BELSEY, Dylan) Date: Wed, 28 Aug 2002 16:09:42 +0930 Subject: [Tutor] Default function in a class ... is it possible??? Message-ID: <86C3892A0C52D411AF5000A0C9EAA3B96320F7@wtntex1.baea.com.au> Have a look at the __call__() function for classes. I believe that it is close to what you want to do. The following is a very simple = example in the IDLE interpreter window. >>> class printer: def __call__(self): print "Hello from the __call__() function" =09 >>> p =3D printer() >>> p() Hello from the __call__() function >>> =20 HTH Dylan -----Original Message----- From: runsun [mailto:runsun@bilbo.bio.purdue.edu] Sent: Wednesday, 28 August 2002 12:14 To: tutor@python.org Subject: [Tutor] Default function in a class ... is it possible??? Hi I wanna know if a class can have a default function. For example, class myclass: def __init__(self): pass def quote(self, aText): return "[" + aText + "]" c =3D myclass() print c.quote('data') =3D=3D=3D> will print "[data]" Is there any way to make the following possible: print c('data') =3D=3D=3D=3D=3D> also print "[data]" means, making the function "quote()" as the default function of class "myclass" Thx in advance. pan =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 ~~ Be like water, be shapeless ~~ Runsun Pan, PhD, 773-834-3965 Ecology & Evolution, U of Chicago ------------------------------------------------------ =ABn=A4=E8=A7=D6=B3=F8=BA=F4=B8=F4=AA=A9 http://snews.8k.com/ =A4=E5=A4=C6=BD=D7=BE=C2 = http://taiwantp.net/cgi/roadbbs.pl?board_id=3D7 =ACF=B8g=BD=D7=BE=C2 http://taiwantp.net/cgi/roadbbs.pl?board_id=3D3 =BBP=B4C=C5=E9=B9=EF=A7=DC = http://taiwantp.net/cgi/roadbbs.pl?board_id=3D2 =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 _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From shalehperry@attbi.com Wed Aug 28 07:48:49 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Tue, 27 Aug 2002 23:48:49 -0700 Subject: [Tutor] Summing up the lambda discussion In-Reply-To: <200208280817.56661.scot@possum.in-berlin.de> References: <200208280817.56661.scot@possum.in-berlin.de> Message-ID: <200208272348.49410.shalehperry@attbi.com> On Tuesday 27 August 2002 23:17, Scot W. Stevenson wrote: > Hi there, > > If I understand the comments by the experts here, then the discussion o= n > lambda could be summed up as following: > > 1. Python only implements a primitive version of lambdas, robbing this = tool > of most of the power it has in other languages such as Scheme [which is= a > variant of Lisp?]. Actually, they're kinda neat when done right, and it= is > unfair to criticize them based on the Python implementation. > 1 and 2 are actually the same argument .... And yes, Scheme is basically= a=20 derivative of Lisp. > 2. Our lambdas are further hamstrung by Python's distinction between > statements and expressions, which isn't a feature of other, more > lambda-friendly languages. > > 3. Any Python lambda can be replaced by a def statement, tho this requi= res > extra coding and creates a bound function. > > Now this sounds like _everybody_ is frustrated by Python's lambda funct= ion: > The experts because it is only a shadow of the lambdas in functional > languages, and the newbies because it somewhat confusing at first in > syntax and use. > > So the obvious question seems to be: Are there any plans to either beef= up > lambda so it is as useful as in other languages, or to just implement t= he > Cheese Shop solution and get rid of it alltogether? > I like lambda and use it when it fits. I still use map() and filter() mo= re=20 than list comprehensions though. LCs seem to be directly attacking the=20 lambda niche. Guido has commented that lambda is one of the parts of pyt= hon=20 he would reconsider. At the moment I see lambda as a point of user style. It is no longer a p= iece=20 of python that you have to use. Unless of course you find LCs as ugly as= I=20 do (-: From biterbilen@yahoo.com Wed Aug 28 08:20:57 2002 From: biterbilen@yahoo.com (biter bilen) Date: Wed, 28 Aug 2002 00:20:57 -0700 (PDT) Subject: [Tutor] how to execute software within python Message-ID: <20020828072057.390.qmail@web10107.mail.yahoo.com> --0-113116662-1030519257=:217 Content-Type: text/plain; charset=us-ascii hi to everybody, i am to run clustalw program within python. but the program doesn't recognise clustalw. in general in what directory should these kind of software be installed to be run within scripts? i make a command line and try to run this with os.popen function. (i use windows) thanks in advance biter --------------------------------- Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes --0-113116662-1030519257=:217 Content-Type: text/html; charset=us-ascii

hi to everybody,

i am to run clustalw program within python. but the program doesn't recognise clustalw. in general in what directory should these kind of software be installed to be run within scripts?

i make a command line and try to run this with os.popen function. (i use windows)

thanks in advance

biter



Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes --0-113116662-1030519257=:217-- From scot@possum.in-berlin.de Wed Aug 28 08:55:57 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Wed, 28 Aug 2002 09:55:57 +0200 Subject: [Tutor] Some first notes on the "Python Cookbook" Message-ID: <200208280955.57477.scot@possum.in-berlin.de> Hi there, Erik and Danny had asked about the "Python Cookbook". I'm only on page 79 in the third chapter (plus a few pages where I cheated and skipped ahead), but I can offer the following notes so far: - If you sit down and actually work thru every recipe, you are going to learn a /lot/. Yes, the recipes in the first chapter alone have a big "Hey, way cool!" factor - the RPN calculator I posted uses recipes 1.1 (Swapping values without using a temporary variable, by Hamish Lawson) and 1.6 (Dispatching using a dictionary, by Dick Wall) that I picked up here. But part of this is also simply because the book touches on so many parts of the language, you tend to notice where you are unsure. For example, I realized in recipe 1.2 that I had just skimmed over the *args and **kwargs parts of function definitions when I was first learning the language and couldn't really follow the trick that Brent Burley was trying to teach me. Oops - ten points from Gryffindor. - The book is full of higher level Python programming concepts that I haven't seen in any of the three other books on the language I have read so far. This might in fact turn out to be the most valuable part of the book on the long run. Examples so far include: 1. Alex Martelli's comparison of the "Look before you leap" (LBYL), "Easier to ask forgiveness than permission" (EAFP), and "Homogenize different cases" (HDC) idioms in recipe 5.3 on page 169. I don't know if this is basic computer science stuff that everbody else learns in Algorithms 101, but I found the discussion fascinating. 2. The discussion of "Decorate-Sort-Undecorate" (DSU) and related concepts in chapter two (Tim Peters and others), which teaches you to force your problem into a form that you can use the built-in tools to solve - in other words, if you have a very good hammer, it is a good idea to transform everything into nails before you start working. 3. Various discussion on efficiency. These include accessing dictionaries with "for item in dic.keys()" [loops thru dictionary] vs. "dic.has_key()" [which uses the hash table]; the speed of filter, map and reduce vs. list comprehension; prelocating a list as a list of None instead of calling append; local variables are the fastest kind to access. A lot of these principles fit in somewhere in a grey zone between the pure syntax as given in introductory books and the high-level Python philosophy as set out in http://www.python.org/dev/culture.html - collecting them in small text could be enormously helpful to slightly more advanced newbies [hint =8)]. A good title might be "So what is this 'Pythonic' style I keep reading about?" - There is quite a difference in the background that is expected from the reader from chapter to chapter. While Matthew Wood expects you to be able to cope with concepts like "reentrancy" [still haven't figured that one out] and "thread-safety" in chapter two, chapter three starts off with Fred L. Drake explaining the very basic string commands such as the use of single or double quotes and splicing. - A lot of the recipes compare Medieval Python (1.5.2) fragments with their Renaissance Python (2.2) equivalents, which provides much-needed examples to the new forms such as "super" and generators. Working thru both forms show you just how powerful a few lines of Renaissance Python can be, and will have you wanting to do everything with list comprehensions, except when you can map or filter thru builtin functions. Again, I'm only on page 79, so don't blame me if you go out and buy the book and it turns out that it really goes downhill from page 80 on. So far, I would say that it was well worth my money, and would recommend it to anybody who has passed the absolute beginner phase. Having a bunch of peer-reviewed code that is extensively commented is second best only to places like this list where you can ask all sorts of questions, and O'Reilly did a good job of putting it all together. Y, Scot -- Scot W. Stevenson wrote me on Wednesday, 28. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1710 hours and has a CPU that is falling asleep at a system load of 0.04. From shey@argonaut.com Wed Aug 28 09:29:09 2002 From: shey@argonaut.com (shey crompton) Date: Wed, 28 Aug 2002 09:29:09 +0100 Subject: [Tutor] How to extract information from a stock website Message-ID: <415C917D807AD411B72C00805FF7330B0383640F@MAILSRV> I can't help with the exact coding of what you request, but I do recall something along the lines of a program which pulls stock market quotes off a website one either The Vaults of Parnassus (http://www.vex.net/parnassus/), or Useless Python (www.uselesspython.com). I'm probably wrong, but it's worth a look. :-) Shey -----Original Message----- From: Noriko Sakai [mailto:myregmail@yahoo.com] Sent: 28 August 2002 05:45 To: tutor@python.org Subject: [Tutor] How to extract information from a stock website Hi. I'm new to Python, and i've read that Python is capable of extracting information such as latest stock prices off the web. Can anyone tell me how i can achieve this. I was thinking of building a website that uses this information to help manage my stock portfolios. Also, if i want to create a stand alone Windows program that does this portfolio management, can i still use Python to extract information as the back-end of the software ? Any help appreciated. Thank you __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From shey@argonaut.com Wed Aug 28 09:32:28 2002 From: shey@argonaut.com (shey crompton) Date: Wed, 28 Aug 2002 09:32:28 +0100 Subject: [Tutor] How to extract information from a stock website Message-ID: <415C917D807AD411B72C00805FF7330B03836410@MAILSRV> I really should learn not to press send before I have all the information. :-) I did a search on Parnassus and came up with two programs that will do the job. Follow the link for more: http://py.vaults.ca/apyllo.py?find=quotes -----Original Message----- From: shey crompton [mailto:shey@argonaut.com] Sent: 28 August 2002 09:29 To: tutor@python.org Subject: RE: [Tutor] How to extract information from a stock website I can't help with the exact coding of what you request, but I do recall something along the lines of a program which pulls stock market quotes off a website one either The Vaults of Parnassus (http://www.vex.net/parnassus/), or Useless Python (www.uselesspython.com). I'm probably wrong, but it's worth a look. :-) Shey -----Original Message----- From: Noriko Sakai [mailto:myregmail@yahoo.com] Sent: 28 August 2002 05:45 To: tutor@python.org Subject: [Tutor] How to extract information from a stock website Hi. I'm new to Python, and i've read that Python is capable of extracting information such as latest stock prices off the web. Can anyone tell me how i can achieve this. I was thinking of building a website that uses this information to help manage my stock portfolios. Also, if i want to create a stand alone Windows program that does this portfolio management, can i still use Python to extract information as the back-end of the software ? Any help appreciated. Thank you __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From lep@aber.ac.uk Wed Aug 28 10:26:43 2002 From: lep@aber.ac.uk (Leighton Pritchard) Date: Wed, 28 Aug 2002 10:26:43 +0100 Subject: [Tutor] Re: Python Imaging Library Message-ID: <5.1.0.14.0.20020828100133.0a410420@pophost.aber.ac.uk> Hi Henry, >I downloaded the PIL version 1.1.3 that can be used with >Python version 2.2. I do have three questions however. >1) When I extract the files, in which directory should I extract >them to? >2) Once that is done, how do I tie them into the Python 2.2 >program, so that when I use import Image, etc. within a Python >program to bring in the PIL library routines, Python will know >where the PIL library is located? On Windows I have Python's top directory in F:\Applications\Python\python22, and the PIL sits in F:\Applications\Python\python22\PIL (i.e. this is the directory which has all the .py files in, including __init__.py). I have a plain text file called PIL.pth in Python's top directory, whose sole contents are "PIL" (without the quotation marks). This allows me to use 'import Image' to bring in the PIL itself. On Linux, my python libraries are in /usr/local/lib/python2.2 (if you're using Linux, yours might not be), and the PIL files are in /usr/local/lib/python2.2/site-packages/PIL. Again, there is a PIL.pth file in /usr/local/lib/python.2./site-packages containing only "PIL" without the quotes. This lets me use 'import _imaging' and 'import image' to bring in the PIL. >3) Also, am I correct in saying that if I want to open a graphic >file and plot it on a canvas, I must use PIL? Or would I have >been able to do that with what already comes with the Python >2.2 download? I think that there's a PhotoImage object in Tkinter that would allow you to do that without PIL, but I'm happy to bow to the more experienced users on the list over that... -- Dr Leighton Pritchard AMRSC T44, Cledwyn Building Institute of Biological Sciences University of Wales, Aberystwyth, SY23 3DD Tel 01970 622353 ext. 2353 PGP public key - http://www.keyserver.net (0x47B4A485) From lumbricus@gmx.net Wed Aug 28 11:33:28 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Wed, 28 Aug 2002 12:33:28 +0200 (MEST) Subject: [Tutor] how to execute software within python References: <20020828072057.390.qmail@web10107.mail.yahoo.com> Message-ID: <2094.1030530808@www29.gmx.net> > > hi to everybody, Hello! > i am to run clustalw program within python. but the program doesn't > recognise clustalw. in general in what directory should these kind of software be > installed to be run within scripts? Doesn't matter - just give popen the full path. > i make a command line and try to run this with os.popen function. (i use > windows) > > thanks in advance > > biter HTH, HAND J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From lumbricus@gmx.net Wed Aug 28 11:41:12 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Wed, 28 Aug 2002 12:41:12 +0200 (MEST) Subject: [Tutor] mutual recursion References: <33E101AC5AFF78419F466954A96854202F5843@mailbox.juilliard.edu> Message-ID: <20909.1030531272@www29.gmx.net> Hello! I didn't go through all of the code in detail, but.. [ snip ] > while txt[n] != "AWD-BEGIN\n" : > lets.append(txt[n]) > n = n + 1 > if n > len(txt) : ^^ That's too late, isn't it? [ snip ] > Thanks HTH, HAND J"o! -- -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From thomi@thomi.imail.net.nz Wed Aug 28 11:41:44 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Wed, 28 Aug 2002 22:41:44 +1200 Subject: [Tutor] iteration controll. Message-ID: <20020828224144.0127c462.thomi@thomi.imail.net.nz> Hey!! I have the following problem: I have made a program which needs to iterate through an instruction set at a user defined speed. The user doesn't need to know exactly what the numbers are, they just have a slider with faster at one end, and slower at the other. So say the speed range goes from 1 iteration a second (slowest) to 80 iterations a second (fastest). I'm still not sure what the fastest speed will be for this computer, and of course this will change from system to system. anyway, the problem is that i cannot think of how to add a delay command to the code, to adjust the speeds accordingly. what i need is something which says in python "if this code block takes longer then , decrease the delay, if it took less than , increase the delay". any idea? ideally that block of code should only run if the program senses that the timings are out, so it doesn't slow the program down all the time. thanks! -- The software required Win95 or better, so I installed Linux. Thomi Richards, thomi@imail.net.nz From magnus@thinkware.se Wed Aug 28 13:12:29 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 28 Aug 2002 14:12:29 +0200 Subject: [Tutor] iteration controll. In-Reply-To: <20020828224144.0127c462.thomi@thomi.imail.net.nz> Message-ID: <5.1.0.14.0.20020828135526.02b4ac48@www.thinkware.se> At 22:41 2002-08-28 +1200, Thomi Richards wrote: >I have made a program which needs to iterate through an instruction set >at a user defined speed. The user doesn't need to know exactly what the >numbers are, they just have a slider with faster at one end, and slower >at the other. So say the speed range goes from 1 iteration a second >(slowest) to 80 iterations a second (fastest). I'm still not sure what >the fastest speed will be for this computer, and of course this will >change from system to system. anyway, the problem is that i cannot think >of how to add a delay command to the code, to adjust the speeds >accordingly. what i need is something which says in python "if this code >block takes longer then , decrease the delay, if it took less >than , increase the delay". any idea? > >ideally that block of code should only run if the program senses that >the timings are out, so it doesn't slow the program down all the time. "import time" is a start... "time.sleep(x)" will make the program sleep for x seconds, where x is a float. "time.time()" gives the number of seconds since new-year 1970 as a float. delay =3D 1.0 / iter_per_sec while something: # Here we start measuring start =3D time.time() # Here is the code which should run at a certain interval. ... # Check whether we should delay elapsed =3D time.time() - start if elapsed < delay: time.sleep(delay - elapsed) Be sure not to execute time.sleep() with a negative time... --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From scot@possum.in-berlin.de Wed Aug 28 13:54:44 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Wed, 28 Aug 2002 14:54:44 +0200 Subject: [Tutor] iteration controll. In-Reply-To: <20020828224144.0127c462.thomi@thomi.imail.net.nz> References: <20020828224144.0127c462.thomi@thomi.imail.net.nz> Message-ID: <200208281454.44333.scot@possum.in-berlin.de> Hello Thomi, if I understand your problem correctly, you have a series of instructions that take a certain amount of time, say inst_time, and want to insert a pause of a certain length, say pause_time, so that together they either add up to one second (slowest) or 1/80 of a second (fastest), which we could call iterations per second, or iter_freq. So what we should be looking at is some formula such as pause_time = (1 - inst_time) / iter_freq with pause_time in seconds. You don't know inst_time beforehand, you say; my suggestion would be to calculate it at the start of the program by running a few 100 or 1,000 iterations (the more the better, to average out system load factors). Then you use the above formula to recalculate the pause depending on the slider value (which gives you iter_freq). Since you are talking about "wall clock time" and I see from your signature that you're running Linux, time.time() is IFAIK the best way to do the timing of the iterations (this, at least, is what Tim Peters says in the "Python Cookbook"). To get the pause itself, you can use time.sleep(), which dozes off in seconds, and add this to the iteration loop. It might help if you post the relevant part of the code here, so that people who do this all the time can give even better suggestions... Y, Scot -- Scot W. Stevenson wrote me on Wednesday, 28. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1715 hours and has a CPU that is falling asleep at a system load of 0.00. From erikprice@mac.com Wed Aug 28 14:34:39 2002 From: erikprice@mac.com (Erik Price) Date: Wed, 28 Aug 2002 09:34:39 -0400 Subject: [Tutor] Some first notes on the "Python Cookbook" In-Reply-To: <200208280955.57477.scot@possum.in-berlin.de> Message-ID: On Wednesday, August 28, 2002, at 03:55 AM, Scot W. Stevenson wrote: > Hi there, > > - If you sit down and actually work thru every recipe, you are going to > learn a /lot/. That's good to hear. I feel pretty good about most of Python's basics but have been wishing for something like O'Reilly's "Mastering Algorithms in Perl", except using Python. I'm interested in learning more about algorithms (b/c I have no CS experience), but I'd prefer to work in Python. > - The book is full of higher level Python programming concepts that I > haven't seen in any of the three other books on the language I have > read > so far. This might in fact turn out to be the most valuable part of the > book on the long run. This is the most appetizing news I've heard about the book, right here. > 1. Alex Martelli's comparison of the "Look before you leap" (LBYL), > "Easier > to ask forgiveness than permission" (EAFP), and "Homogenize different > cases" (HDC) idioms in recipe 5.3 on page 169. I don't know if this is > basic computer science stuff that everbody else learns in Algorithms > 101, > but I found the discussion fascinating. Does it infer a priori experience with algorithms? I could run into trouble there.... > - There is quite a difference in the background that is expected from > the > reader from chapter to chapter. While Matthew Wood expects you to be > able > to cope with concepts like "reentrancy" [still haven't figured that one > out] and "thread-safety" in chapter two, chapter three starts off with > Fred L. Drake explaining the very basic string commands such as the > use of > single or double quotes and splicing. Hm. > - A lot of the recipes compare Medieval Python (1.5.2) fragments with > their > Renaissance Python (2.2) equivalents, which provides much-needed > examples > to the new forms such as "super" and generators. Working thru both > forms > show you just how powerful a few lines of Renaissance Python can be, > and > will have you wanting to do everything with list comprehensions, except > when you can map or filter thru builtin functions. That's good to hear too -- knowing -when- to use these new constructs seems to be just as much or even more of the work as knowing how to use them. Also, I never know when I'm using a new Python construct or an old Python construct so that's further fruit from this book. > Again, I'm only on page 79, so don't blame me if you go out and buy the > book and it turns out that it really goes downhill from page 80 on. So > far, I would say that it was well worth my money, and would recommend > it > to anybody who has passed the absolute beginner phase. Having a bunch > of > peer-reviewed code that is extensively commented is second best only to > places like this list where you can ask all sorts of questions, and > O'Reilly did a good job of putting it all together. And betwixt them both, I can lick the platter clean. Judging from your in-progress review it sounds like just the book I have been looking for -- great! (Some of the recipes I saw at http://www.onlamp.com/pub/a/python/2002/07/11/recipes.html looked interesting, but I will be coming to this list with questions, since I don't even know why you would want to use a "singleton".) >>> thingsToBuy.insert(0, 'Python Cookbook') Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From lists@shrestha.net.np Wed Aug 28 03:40:44 2002 From: lists@shrestha.net.np (Ashish Shrestha) Date: Wed, 28 Aug 2002 08:25:44 +0545 Subject: [Tutor] Understanding Nested Commands References: <008201c24e17$82fa6ee0$cae68b86@fo5132> Message-ID: <3D6C382C.1060205@shrestha.net.np> Alan Colburn wrote: > One response suggested this: > > >>>>myList = [['a','b','c'],['d','e','f'],['g','h','i']] >>>>'\n'.join([','.join(sublist) for sublist in myList]) >>> > > It's a great solution that does everything I wanted. However, I'm slightly > stumped in understanding how it works. Can someone take me through what's > going > on? List comprehension provides ways for mapping a list to another list and for filtering a list. >>> n = range(1,10) >>> n [1, 2, 3, 4, 5, 6, 7, 8, 9] >>> n2 = [i * 2 for i in n] >>> n2 [2, 4, 6, 8, 10, 12, 14, 16, 18] In the above example, the list n is mapped to another list n2 by doubling the elements of the first list. >>> dogs = ['dogmatix', 'odie', 'snowy', 'snoopy'] >>> [name.title() for name in dogs] ['Dogmatix', 'Odie', 'Snowy', 'Snoopy'] >>> [len(name) for name in dogs] [8, 4, 5, 6] Looking at examples, we can see the syntax: newlist = [ for in oldlist] Filtering works on a similar approach. Elements are added to the new list only if it satisfies the filtering condition. >>> [name.title() for name in dogs if name[0] == 's'] ['Snowy', 'Snoopy'] >>> n = range(1, 10) >>> n2 = [i for i in n if i % 2 == 0] >>> n2 [2, 4, 6, 8] The syntax for filtering is: [ for in oldlist if ] Using the mapping and filtering the example below shows a method for finding a list of prime numbers. import math def primes(max): s = [1,2] + [i for i in range(3, max, 2)] for n in range(2, int(math.sqrt(max) + 1)): s = [i for i in s if i == n or i % n != 0] return s print primes(100) Well, I just love list comprehensions for their compactness. However, Tutor has taught me that it is not always the best solutions. It may be the easiest but not the most efficient as often the solutions that could be programmed to be linear in other cases result in not linear versions if we are not careful. Ashish Shrestha From nixonron@yahoo.com Wed Aug 28 16:57:22 2002 From: nixonron@yahoo.com (Ron Nixon) Date: Wed, 28 Aug 2002 08:57:22 -0700 (PDT) Subject: [Tutor] newbie text parsing question Message-ID: <20020828155722.8692.qmail@web20303.mail.yahoo.com> --0-1024771816-1030550242=:8637 Content-Type: text/plain; charset=us-ascii Ive got a file that looks like this: Case Number: 076-2000 Recall Notification Report: RNR076-2000 Date Opened: 12/20/2000 Date Closed: 04/20/2001 Recall Class: 1 Press Release (Y/N): Y Domestic Est. Number: 02040 M Name: Harper's Country Ham Imported Product (Y/N): Y Foreign Estab. Number: N/A City: Clinton State: KY Country: USA Product: Country Ham Problem: BACTERIA Description: LISTERIA Total Pounds Recalled: 10,400 Pounds Recovered: 7,561 I'd like to be able to read all of the file in a extract the data following the Title and ":" to produce some like this: 076-2000, RNR076-2000,04/20/2001,04/20/2001,1,Y,02040 M, Harper's Country Ham, etc that I can then import into a spreadsheet or database. I found nothing at the Python.org site nor in the Text Processing using Python book. Any ideas? thanks in advance Ron --------------------------------- Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes --0-1024771816-1030550242=:8637 Content-Type: text/html; charset=us-ascii

Ive got a file that looks like this:

   Case Number: 076-2000  Recall Notification Report:  RNR076-2000
   Date Opened: 12/20/2000  Date Closed:  04/20/2001
   Recall Class:  1  Press Release (Y/N):  Y
   Domestic Est. Number:  02040  M     Name:  Harper's Country Ham
   Imported Product (Y/N):  Y      Foreign Estab. Number:  N/A
   City:  Clinton   State:  KY  Country:  USA
   Product:  Country Ham
   Problem:  BACTERIA  Description: LISTERIA
   Total Pounds Recalled:  10,400  Pounds Recovered:    7,561

 

I'd like to be able to read all of the file in a extract the data following the Title and ":" to produce some like this:

076-2000, RNR076-2000,04/20/2001,04/20/2001,1,Y,02040  M, Harper's Country Ham, etc

that I can then import into a spreadsheet or database. I found nothing at the Python.org site nor in the Text Processing using Python book. Any ideas? thanks in advance

 

Ron



Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes --0-1024771816-1030550242=:8637-- From rob@uselesspython.com Wed Aug 28 17:31:33 2002 From: rob@uselesspython.com (Rob) Date: Wed, 28 Aug 2002 11:31:33 -0500 Subject: [Tutor] newbie text parsing question In-Reply-To: <20020828155722.8692.qmail@web20303.mail.yahoo.com> Message-ID: There are different ways to get to the solution you're after. Do you want to code for a situation in which you know you will always expect the same format to the file, or do you want to account for files that don't have precisely the same format? For instance, will you always have only one "Problem:" listed? Do you already have the grasp of reading and writing files to your satisfaction? The Tutorial that tends to come ship with Python distributions (and also easily found at python.org) has a section demonstrating File I/O. There are also lots of samples out there, at sites like the Vaults of Parnassus, the Python Cookbook site, and Useless Python. Rob -----Original Message----- From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of Ron Nixon Sent: Wednesday, August 28, 2002 10:57 AM To: tutor@python.org Subject: [Tutor] newbie text parsing question Ive got a file that looks like this: Case Number: 076-2000 Recall Notification Report: RNR076-2000 Date Opened: 12/20/2000 Date Closed: 04/20/2001 Recall Class: 1 Press Release (Y/N): Y Domestic Est. Number: 02040 M Name: Harper's Country Ham Imported Product (Y/N): Y Foreign Estab. Number: N/A City: Clinton State: KY Country: USA Product: Country Ham Problem: BACTERIA Description: LISTERIA Total Pounds Recalled: 10,400 Pounds Recovered: 7,561 I'd like to be able to read all of the file in a extract the data following the Title and ":" to produce some like this: 076-2000, RNR076-2000,04/20/2001,04/20/2001,1,Y,02040 M, Harper's Country Ham, etc that I can then import into a spreadsheet or database. I found nothing at the Python.org site nor in the Text Processing using Python book. Any ideas? thanks in advance Ron Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes From rob@uselesspython.com Wed Aug 28 17:40:23 2002 From: rob@uselesspython.com (Rob) Date: Wed, 28 Aug 2002 11:40:23 -0500 Subject: FW: [Tutor] newbie text parsing question Message-ID: Forwarding this message on to the friendly Tutor horde. 3;-> Rob -----Original Message----- From: Ron Nixon [mailto:nixonron@yahoo.com] Sent: Wednesday, August 28, 2002 11:34 AM To: Rob Subject: RE: [Tutor] newbie text parsing question Rob: I'd like to code for any situtation, but in this case because of time, I'd just like to get this file done. I do have a grasp of reading in and writing out files, processing something like this is altogether different though. The format of this file contains the same variables for each record. Any suggestions you could point me to would be appreciated. I'll take a look on the sites you suggested as well. Rob wrote: There are different ways to get to the solution you're after. Do you want to code for a situation in which you know you will always expect the same format to the file, or do you want to account for files that don't have precisely the same format? For instance, will you always have only one "Problem:" listed? Do you already have the grasp of reading and writing files to your satisfaction? The Tutorial that tends to come ship with Python distributions (and also easily found at python.org) has a section demonstrating File I/O. There are also lots of samples out there, at sites like the Vaults of Parnassus, the Python Cookbook site, and Useless Python. Rob -----Original Message----- From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of Ron Nixon Sent: Wednesday, August 28, 2002 10:57 AM To: tutor@python.orgS! ubject: [Tutor] newbie text parsing question Ive got a file that looks like this: Case Number: 076-2000 Recall Notification Report: RNR076-2000 Date Opened: 12/20/2000 Date Closed: 04/20/2001 Recall Class: 1 Press Release (Y/N): Y Domestic Est. Number: 02040 M Name: Harper's Country Ham Imported Product (Y/N): Y Foreign Estab. Number: N/A City: Clinton State: KY Country: USA Product: Country Ham Problem: BACTERIA Description: LISTERIA Total Pounds Recalled: 10,400 Pounds Recovered: 7,561 I'd like to be able to read all of the file in a extract the data following the Title and ":" to produce some like this: 076-2000, RNR076-2000,04/20/2001,04/20/2001,1,Y,02040 M, Harper's Country Ham, etc that I can then import into a spreadsheet or database. I found nothing at the Python.org site nor in the Text Processing using Python book. Any ideas? thanks in advance Ron Do You Yahoo!? Yahoo! Finan! ce! - Get real-time stock quotes _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes From ATrautman@perryjudds.com Wed Aug 28 17:41:16 2002 From: ATrautman@perryjudds.com (Alan Trautman) Date: Wed, 28 Aug 2002 11:41:16 -0500 Subject: [Tutor] newbie text parsing question Message-ID: <0BA95581EDA7D611841B00A0C9AD25DD2B5839@mail.pjinet.com> Again if you are looking for a concept of how to do this rather than the code I will give the approach I would use. read the file strip all newlines ('/n') put newlines ('/n') after every colon save the new file open the new file read every other line inserting a comma in between each element add a newline ('/n') at the end of a record append this to you master file contain all the previously parsed items repeat until all record are parsed hope that helps. It not really clever, smart or taking advantage of any special features of Python but it should work. You will have to add the extra step of splitting the records apart (I'm Hoping for your sake they are the same length) and you can then repeat the process every x number of lines in the original file. Good luck Alan -----Original Message----- From: Rob [mailto:rob@uselesspython.com] Sent: Wednesday, August 28, 2002 11:32 AM To: Python Tutor Subject: RE: [Tutor] newbie text parsing question There are different ways to get to the solution you're after. Do you want to code for a situation in which you know you will always expect the same format to the file, or do you want to account for files that don't have precisely the same format? For instance, will you always have only one "Problem:" listed? Do you already have the grasp of reading and writing files to your satisfaction? The Tutorial that tends to come ship with Python distributions (and also easily found at python.org) has a section demonstrating File I/O. There are also lots of samples out there, at sites like the Vaults of Parnassus, the Python Cookbook site, and Useless Python. Rob -----Original Message----- From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of Ron Nixon Sent: Wednesday, August 28, 2002 10:57 AM To: tutor@python.org Subject: [Tutor] newbie text parsing question Ive got a file that looks like this: Case Number: 076-2000 Recall Notification Report: RNR076-2000 Date Opened: 12/20/2000 Date Closed: 04/20/2001 Recall Class: 1 Press Release (Y/N): Y Domestic Est. Number: 02040 M Name: Harper's Country Ham Imported Product (Y/N): Y Foreign Estab. Number: N/A City: Clinton State: KY Country: USA Product: Country Ham Problem: BACTERIA Description: LISTERIA Total Pounds Recalled: 10,400 Pounds Recovered: 7,561 I'd like to be able to read all of the file in a extract the data following the Title and ":" to produce some like this: 076-2000, RNR076-2000,04/20/2001,04/20/2001,1,Y,02040 M, Harper's Country Ham, etc that I can then import into a spreadsheet or database. I found nothing at the Python.org site nor in the Text Processing using Python book. Any ideas? thanks in advance Ron Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From ATrautman@perryjudds.com Wed Aug 28 17:44:12 2002 From: ATrautman@perryjudds.com (Alan Trautman) Date: Wed, 28 Aug 2002 11:44:12 -0500 Subject: [Tutor] newbie text parsing question Message-ID: <0BA95581EDA7D611841B00A0C9AD25DD2B583A@mail.pjinet.com> Sorry dumb omission before inserting the comma you will need to remove the newline character again. -----Original Message----- From: Alan Trautman Sent: Wednesday, August 28, 2002 11:41 AM To: Python Tutor Subject: RE: [Tutor] newbie text parsing question Again if you are looking for a concept of how to do this rather than the code I will give the approach I would use. read the file strip all newlines ('/n') put newlines ('/n') after every colon save the new file open the new file read every other line inserting a comma in between each element add a newline ('/n') at the end of a record append this to you master file contain all the previously parsed items repeat until all record are parsed hope that helps. It not really clever, smart or taking advantage of any special features of Python but it should work. You will have to add the extra step of splitting the records apart (I'm Hoping for your sake they are the same length) and you can then repeat the process every x number of lines in the original file. Good luck Alan -----Original Message----- From: Rob [mailto:rob@uselesspython.com] Sent: Wednesday, August 28, 2002 11:32 AM To: Python Tutor Subject: RE: [Tutor] newbie text parsing question There are different ways to get to the solution you're after. Do you want to code for a situation in which you know you will always expect the same format to the file, or do you want to account for files that don't have precisely the same format? For instance, will you always have only one "Problem:" listed? Do you already have the grasp of reading and writing files to your satisfaction? The Tutorial that tends to come ship with Python distributions (and also easily found at python.org) has a section demonstrating File I/O. There are also lots of samples out there, at sites like the Vaults of Parnassus, the Python Cookbook site, and Useless Python. Rob -----Original Message----- From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of Ron Nixon Sent: Wednesday, August 28, 2002 10:57 AM To: tutor@python.org Subject: [Tutor] newbie text parsing question Ive got a file that looks like this: Case Number: 076-2000 Recall Notification Report: RNR076-2000 Date Opened: 12/20/2000 Date Closed: 04/20/2001 Recall Class: 1 Press Release (Y/N): Y Domestic Est. Number: 02040 M Name: Harper's Country Ham Imported Product (Y/N): Y Foreign Estab. Number: N/A City: Clinton State: KY Country: USA Product: Country Ham Problem: BACTERIA Description: LISTERIA Total Pounds Recalled: 10,400 Pounds Recovered: 7,561 I'd like to be able to read all of the file in a extract the data following the Title and ":" to produce some like this: 076-2000, RNR076-2000,04/20/2001,04/20/2001,1,Y,02040 M, Harper's Country Ham, etc that I can then import into a spreadsheet or database. I found nothing at the Python.org site nor in the Text Processing using Python book. Any ideas? thanks in advance Ron Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor From alan.gauld@bt.com Wed Aug 28 18:01:05 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 28 Aug 2002 18:01:05 +0100 Subject: [Tutor] Beginner-->conditional statements Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C8A5@mbtlipnt02.btlabs.bt.co.uk> > I went to your website and read a good part of your tutorial. > I had a question about the usage of '%' for MOD and then > its apparent different meaning in the next contiguous section. You are right it is contradictory. There are two unrelated usages of %. IMHO Its one of the bad things in Pythons design and I deliberately put the two uses on the same page to emphasise that it is different. If I'd separated them the new use might have just masked the earlier one and it would have been lost. Maybe I haven't emphasised that they are 2 completely different things enough... > However, my post to you from your website bounced as spam! If that was a week or two back my ISP decided to kill my account for some reason! It should be OK now. The correct email for tutorial issues is: alan.gauld@btinternet.com > The difference is between: a and alan; crosswinds/net; and bt/com bt.com is work. btinternet.com is home (where the tutor master files live) and crosswinds.net is obsolete - I get 20-30 junk mails a day on it... Now for something completely different... > So by etc. does that include SF Fisherman's Wharf and Wax Museum? Thanks everyone for SF suggestions. More are still welcome. > >>> print 7%4 > 3 > > >>> print "The sum of %d and %d is: %d" % (7,18,7+18) > {SH: This seems like a new usage? I'm not sure how to evaluate it? It is a new usage, you are right. > In this command the format string contains '%' markers within > it. The letter 'd' after the % tells Python that a > 'decimal number' should be placed there. I'll change the wording to include a specific caveat that it is unrelated to the modulo operator above. Thanks for pointing that out. Next question? :-) Alan g. From dyoo@hkn.eecs.berkeley.edu Wed Aug 28 18:12:11 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Wed, 28 Aug 2002 10:12:11 -0700 (PDT) Subject: [Tutor] how to execute software within python In-Reply-To: <20020828072057.390.qmail@web10107.mail.yahoo.com> Message-ID: On Wed, 28 Aug 2002, biter bilen wrote: > i am to run clustalw program within python. but the program doesn't > recognise clustalw. in general in what directory should these kind of > software be installed to be run within scripts? Hi Biter, If you're a bioinformatics sort of person, the Biopython project should be useful for you. The latest version of Biopython in CVS has a 'clustalw' module that may make it easier to work with the software in Python. (Underneath, it does do an os.popen() as well, but provides other services like parsing the clustalw report.) See: http://www.pasteur.fr/recherche/unites/sis/formation/python/ch11s06.html#sect_clustalw for more details on driving the clustalw program with Python. Good luck! From alan.gauld@bt.com Wed Aug 28 18:24:35 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 28 Aug 2002 18:24:35 +0100 Subject: [Tutor] Why lambda could be considered evil Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C8A6@mbtlipnt02.btlabs.bt.co.uk> > You could also add that list comprehensions come from > something called Haskell, and generators from Icon, > major difference between classes, generators, and list > comprehensions on the one hand and lambda, print >> file, > and print "Funny %s characters" % lambda should be in the first category because it is the correct natural name(albeit one that is not in general use) for what's being done. The other features are borrowed syntax and I agree they are not immediaely intuitive. OTOH look at COBOL which takes natural language to the other extreme: X = X PLUS 1 instead of X = X + 1 > while lambda and the two prints retain their "native" > we-use-special-characters syntax. lambda uses plain english spelling of a greek letter. Much worse if we had to use the actual lambda character in a funny font - as in Z notation for example! eek! lambda is the common term for what it does, it just happens that lambda calculus is not a widely studied topic! > that Haskell list comprehension terms such as > > [y | y <- xs, y < x] > > are turned into something like this in Python: > > [y for y in xs if y < x] Yes but List Comprehension is the natural term there not the syntax of Haskell. Haskell is one of many FP languages (albeit one of the best IMHO) > print >> file, 'Print me' could have been > print to file, 'Print me' or even better > print 'Print me' to file Yup! > > Or studying lambda calculus! > > Well, I'm not sure if the majority of Python users have > actually done that, I'm absolutely sure they won't have. > I dimly remember having had calculus in school Different beast entirely. > I think this discussion can be reduced to one question: Is Python, or > rather, Python's syntax, geared more towards computer science > people with a strong background in various computer languages or > more at what I would call the educated computer user The answer is both, thats what makes it so special. There are lots of languages aimed at beginners but they run out of steam when you move beyond casual use. Python delivers easy to learn (just ignore the wackier corners!) but then grows with you right up to and including OO and FP. There are parts of Python 2.2. that I was unhappy about (Kirby and I had a longish mail exchange about it) but at the end of the day I'm free to more or less ignore those corners. Thats one of the really clever things about what Tim and Guido and the others are doing. mostly we can just keep on using the bits we know and the tigers can go off and play with the exotica. > I would argue that so far, it is mostly geared from the > educated public, not specialists. I would disagree. It caters to both. Python has a lot of subtelty built in that weans newbies into doing things that CS departments spend ages teaching by making it part of the language. Python programmers learn to use indentation, doc strings, class browsers(dir (class)) and other features that students ion other languages sometimes never really 'get'. Almost everything in Python is true to CS principles while at the same time being as easy as it can be. lambda is in the same category, its there and is as easy as I've seen it anywhere but at the same time it does what CS expects it to do. > "real" division. If that is in fact so, then > lambda and the two print forms mentioned above Well I was guilty of that till Mr Peters pointed out that many respected CS languages take that same approach and in fact the C variant was probably the deviant. CS doesn't insist in integer divisioon that was a C language thing... lambdas are a branch of math just like complex numbers. I'd suggest most Python newbies don't know much about imaginary numbers either but having them in the language is great for those that do. If you don't like lambda don't use it. If it suddenly looks useful do use it. If you ever get round to reading up on lambda calculus then great, you can use python to play games without having to learn Lisp or Haskell... Alan g. From cyberdiction@hotmail.com Wed Aug 28 21:29:04 2002 From: cyberdiction@hotmail.com (Stephen Harris) Date: Wed, 28 Aug 2002 13:29:04 -0700 Subject: [Tutor] Beginner-->conditional statements References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C8A5@mbtlipnt02.btlabs.bt.co.uk> Message-ID: > > Next question? :-) > > Alan g. > I found out that IDLE does not use the default secondary prompt of ... but I got to see it from the command line. I'm still working through tutorials. I basically understand control statements but not how to concatenate them yet-- someone mentioned a Cookbook which will have examples of how one strings together code. I am now looking for an organized, graduated series of problems and solutions similar to a college course or fat book. Thanks for your reply, Stephen From runsun@bilbo.bio.purdue.edu Wed Aug 28 22:06:42 2002 From: runsun@bilbo.bio.purdue.edu (runsun) Date: Wed, 28 Aug 2002 16:06:42 -0500 Subject: [Tutor] Class Property ? In-Reply-To: Message-ID: Could someone tell me what the difference is between the following 2 ?? [1] class test: def __init__(self): self.__dict__['LastName']="" <===== [2] class test: def __init__(self): self.LastName="" <====== ============================================ ~~ Be like water, be shapeless ~~ Runsun Pan, PhD, 773-834-3965 Ecology & Evolution, U of Chicago ============================================= From shalehperry@attbi.com Wed Aug 28 22:19:56 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Wed, 28 Aug 2002 14:19:56 -0700 Subject: [Tutor] Class Property ? In-Reply-To: References: Message-ID: <200208281419.56346.shalehperry@attbi.com> On Wednesday 28 August 2002 14:06, runsun wrote: > Could someone tell me what the difference is between the following 2 ?? > > [1] > > class test: > def __init__(self): > self.__dict__['LastName']=3D"" <=3D=3D=3D=3D=3D > > [2] > > class test: > def __init__(self): > self.LastName=3D"" <=3D=3D=3D=3D=3D=3D > [2] causes the interpeter to perform [1]. If the class defines a __setat= tr__=20 [2] can lead to infinite loops. From aicolburn@yahoo.com Wed Aug 28 23:20:11 2002 From: aicolburn@yahoo.com (Alan Colburn) Date: Wed, 28 Aug 2002 15:20:11 -0700 Subject: [Tutor] Tkinter: binding functions to widgets Message-ID: <00cb01c24ee1$13200970$cae68b86@fo5132> I'm trying to learn some basic GUI design and, based on dicussions I've seen on this list, started learning to use Tkinter. I'm doing fine in terms of basic widget layout, parent & child frames, etc. The difficulty I'm having lies in trying to get the GUI to do something other than look impressive :-) I understand how one can use an Entry box, etc. to get information, but I don't understand how to do things like store the information in a variable, manipulate the information, or use the (manipulated) information to affect what's displayed in the GUI. To make it concrete, I tried to come up with something really simple I could ask you to write for me--something that' s only a few lines of code. Here's what I came up with. How would you write a GUI-based program in which: --a user enters a number --the program outputs whether or not the number was, say, greater than 0 --(optional) How do you store this entered number in a way that it would be available for other functions in the program, i.e, make it a global variable? I don't care what the program looks like ... it's the function binding I'm struggling with :-) Thanks, as always -- Al p.s. The new semester starts soon; I'll stop asking questions at that point :-) From erikprice@mac.com Thu Aug 29 03:24:45 2002 From: erikprice@mac.com (Erik Price) Date: Wed, 28 Aug 2002 22:24:45 -0400 Subject: [Tutor] yet another book review request Message-ID: <7BD626B9-BAF6-11D6-9CB7-00039351FE6A@mac.com> I'm curious what people think of Programming Python 2nd Edition (updated for Python 2). I was in the store tonight, looking at the Python Cookbook, but this one also seems like a great "next step" Python book. Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From shalehperry@attbi.com Thu Aug 29 03:22:07 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Wed, 28 Aug 2002 19:22:07 -0700 Subject: [Tutor] yet another book review request In-Reply-To: <7BD626B9-BAF6-11D6-9CB7-00039351FE6A@mac.com> References: <7BD626B9-BAF6-11D6-9CB7-00039351FE6A@mac.com> Message-ID: <200208281922.07831.shalehperry@attbi.com> On Wednesday 28 August 2002 19:24, Erik Price wrote: > I'm curious what people think of Programming Python 2nd Edition > (updated for Python 2). I was in the store tonight, looking at the > Python Cookbook, but this one also seems like a great "next step" > Python book. > I own one of the first prints of Programming Python (came out around the = time=20 of 1.5). It has long been my favorite book for learning Python. I love = how=20 the book progresses from small ideas to larger programs and it reuses the= =20 same examples again and again. I doubt the 2nd edition has changed so mu= ch=20 as to invalidate this. From erikprice@mac.com Thu Aug 29 04:03:04 2002 From: erikprice@mac.com (Erik Price) Date: Wed, 28 Aug 2002 23:03:04 -0400 Subject: [Tutor] yet another book review request In-Reply-To: <200208281922.07831.shalehperry@attbi.com> Message-ID: On Wednesday, August 28, 2002, at 10:22 PM, Sean 'Shaleh' Perry wrote: > I own one of the first prints of Programming Python (came out around > the time > of 1.5). It has long been my favorite book for learning Python. I > love how > the book progresses from small ideas to larger programs and it reuses > the > same examples again and again. I doubt the 2nd edition has changed so > much > as to invalidate this. Thanks, Sean. I was worried that it might teach some things that are no longer used in the newer version of Python but it seems like a "must-read" nonetheless. Interesting that it is not really like "Programming Perl", which is pretty well-known but doesn't take a "tutorial" approach at all (it's more of a reference). Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From rob@uselesspython.com Thu Aug 29 04:01:23 2002 From: rob@uselesspython.com (Rob) Date: Wed, 28 Aug 2002 22:01:23 -0500 Subject: [Tutor] yet another book review request In-Reply-To: Message-ID: I have unashamed love for *Programming Python, 2nd ed.* Rob http://uselesspython.com > -----Original Message----- > From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of > Erik Price > Sent: Wednesday, August 28, 2002 10:03 PM > To: tutor@python.org > Subject: Re: [Tutor] yet another book review request > > > > On Wednesday, August 28, 2002, at 10:22 PM, Sean 'Shaleh' Perry wrote: > > I own one of the first prints of Programming Python (came out around > > the time > > of 1.5). It has long been my favorite book for learning Python. I > > love how > > the book progresses from small ideas to larger programs and it reuses > > the > > same examples again and again. I doubt the 2nd edition has changed so > > much > > as to invalidate this. > > Thanks, Sean. I was worried that it might teach some things that are > no longer used in the newer version of Python but it seems like a > "must-read" nonetheless. Interesting that it is not really like > "Programming Perl", which is pretty well-known but doesn't take a > "tutorial" approach at all (it's more of a reference). > > > > Erik > > > > > > > -- > Erik Price > > email: erikprice@mac.com > jabber: erikprice@jabber.org > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > From scot@possum.in-berlin.de Thu Aug 29 00:35:27 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Thu, 29 Aug 2002 01:35:27 +0200 Subject: [Tutor] Why lambda could be considered evil In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20E66C8A6@mbtlipnt02.btlabs.bt.co.uk> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C8A6@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <200208290135.27475.scot@possum.in-berlin.de> Hello Alan, > and I agree they are not immediaely intuitive. OTOH look > at COBOL which takes natural language to the other extreme: > > X = X PLUS 1 Yes. Er. Well. I guess that explains why it is such a popular language, doesn't it... > > I dimly remember having had calculus in school > Different beast entirely. Glad you said so. I was getting somewhat worried about not remembering a single thing about lambdas =8). > Python programmers learn to use > indentation, doc strings, class browsers(dir (class)) > and other features that students ion other languages > sometimes never really 'get'. Hmm. Put that way, I have to agree with you, especially since I just worked thru two pages of generator examples and came away very impressed with what you can use them for. This just isn't BASIC anymore =8). One thing I have noticed with the "Cookbook" is how lambdas seem to be rather /non grata/, usually in their own paragraph and introduced by a phrase like "if you happen to like lambdas" or such. I have high hopes that it will become less and less common in the next years. In the end, truth and beauty will conquer all... > If you ever get round to reading > up on lambda calculus then great, you can use python > to play games without having to learn Lisp or Haskell... I think I'll save that one for a while - I still have the re module to get thru =8). Thanks for the comments! Y, Scot -- Scot W. Stevenson wrote me on Thursday, 29. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1726 hours and has a CPU that is falling asleep at a system load of 0.03. From scot@possum.in-berlin.de Thu Aug 29 01:43:39 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Thu, 29 Aug 2002 02:43:39 +0200 Subject: [Tutor] Tkinter: binding functions to widgets In-Reply-To: <00cb01c24ee1$13200970$cae68b86@fo5132> References: <00cb01c24ee1$13200970$cae68b86@fo5132> Message-ID: <200208290243.39877.scot@possum.in-berlin.de> Hello Alan, One of the basic design principles I was taught is to keep the GUI code and the actual production code as separate as possible. One of the main reasons cited is maintenance; also, imagine you get tired of Tkinter, fall madly in love with Qt, and dedicate your life to writing Python programs for the KDE desktop. It is a lot easer to reuse your old stuff if you don't have to untangle the GUI code from the production code. Usually, you have something in the GUI that triggers an event, for example if you press a button. Now this widget (the Button widget, for example) has a parameter called "command" that you can use to point to a function. What you can do is tell this function to get the value out an entry field (such as that of an Entry widget) and pass that value to the actual logic code that does the real work. So the chain of events is something like: - Button press calls function given with button command [Pure Tkinter] - Function gets value from Entry widget and passes it on to logic function - Logic function does the real work [No Tkinter] Once you get down to the last level, you are free to ignore that there is any such thing as a GUI. > --a user enters a number > --the program outputs whether or not the number was, say, greater than 0 I have some toy Tkinter code here from when I was playing with Entry fields that I quickly adopted to your example; it uses classes, though (which you can probably ignore) and because I'm not that experienced either, this might not be the best way of doing things (but then somebody will probably correct it, so we both learn something, ). "showinfo", in case you are wondering, is a pre-fab widget that is included in the tkMessageBox module. Note that it only accepts integers, not floats or such. If something is not clear (or flatly doesn't work - I just renamed a few things, cut a few lines out, and put in the try/except part), please feel free to ask, and I'll see if I understand what I did back then =8). Y, Scot ===================================================== from Tkinter import * from tkMessageBox import showinfo root = Tk() class numberchecker(Frame): def __init__(self, parent=None): Frame.__init__(self, parent) self.pack() self.entryfield = Entry(self) self.entryfield.insert(0, 'Type number here') self.entryfield.pack(side=TOP, fill=X) getbutton = Button(self, text='Go!', command=self.getnumber) getbutton.pack(side=TOP, fill=X) # Handel imput and delegate to logic function def getnumber(self): rawnumber = self.entryfield.get() # Make sure this is really a number try: number = int(rawnumber) except ValueError: self.entryfield.delete(0, END) self.entryfield.insert(0, '*** Not a number ***') return # Call program logic and display result if self.check_number(number) == 1: self.displaygoodnews(number) else: self.displaybadnews(number) # Display good news def displaygoodnews(self, number): messagetext = 'Number %s is greater than 0!' % number showinfo('Hurray!', messagetext) # Display good news def displaybadnews(self, number): messagetext = 'Number %s is not greater than 0!' % number showinfo('Oh no!', messagetext) # Actual program logic def check_number(self, number): if number > 0: return 1 else: return 0 if __name__ == '__main__': test = numberchecker() test.mainloop() From scot@possum.in-berlin.de Thu Aug 29 00:40:30 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Thu, 29 Aug 2002 01:40:30 +0200 Subject: [Tutor] Some first notes on the "Python Cookbook" In-Reply-To: References: Message-ID: <200208290140.30537.scot@possum.in-berlin.de> Hello Erik, > Does it infer a priori experience with algorithms? I could run into > trouble there.... No, or else I'd be in big trouble, too. By chance or design, the core concepts seem to repeat themselves in slightly different variants throughout the book, so you get more than one chance to understand them. > Also, I never know when I'm using a new Python construct or an > old Python construct so that's further fruit from this book. In fact, what this book will probably do is convince more people to chuck Python 1.5.2 out the window and switch to 2.2 - there are lots of examples where lots of code is turned into less code with just the use of iterators or list comprehension. This also means, however, that this book is probably going to be half-useless by Python 2.4 or such - but what Python book has a half-life longer than a year at the moment? Y, Scot -- Scot W. Stevenson wrote me on Thursday, 29. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1726 hours and has a CPU that is falling asleep at a system load of 0.08. From idiot1@netzero.net Thu Aug 29 05:39:52 2002 From: idiot1@netzero.net (Kirk Bailey) Date: Thu, 29 Aug 2002 00:39:52 -0400 Subject: [Tutor] returning to my memberlister script Message-ID: <3D6DA598.AC3E0B8@netzero.net> Well, I have been busy, but finally got to return to my memberlister script. It gets this result in the www.errorlog: SyntaxError: invalid syntax [Thu Aug 29 00:26:38 2002] [error] [client 63.208.207.252] Premature end of script headers: /www/www.tinylist.org/cgi-bin/TLmemberlister.py Traceback (innermost last): File "/www/www.tinylist.org/cgi-bin/TLmemberlister.py", line 126, in ? print 'listname='+mylist+'

' TypeError: __add__ nor __radd__ defined for these operands Here is the script ( I will omit the text headers): login as: howlermo Sent username "howlermo" howlermo@howlermonkey.net's password: Last login: Wed Aug 28 00:04:44 2002 from dialup-65.59.82. Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 3.4-RELEASE (HOWLER) #0: Thu Jun 21 22:13:44 EDT 2001 Welcome to the Monkey! Please, enjoy your stay... now get to work! You have new mail. $ /www/www.howlermonkey.net /www/www.howlermonkey.net: permission denied $ ls TL*.* ls: TL*.*: No such file or directory $ ls TL*.* ls: TL*.*: No such file or directory $ pwd /usr/home/howlermo $ cd /www/www.howlermonkey.net UW PICO(tm) 3.7 File: testlist3.owner UW PICO(tm) 3.7 File: TLmemberlister.py UW PICO(tm) 3.7 File: TLmemberlister.py Modified print '' print '' print "" print '

' print '


  TinyList

' print '


' # form=cgi.FieldStorage() # recover the form's data, if not (form.has_key("Owner")): print "Key 'owner' not found!" #120 if not (form.has_key("password")): print "key 'password' not found!" if not (form.has_key("listname")): print "key 'listname' not found!" mylist = form["listname"] # listname, print 'listname='+mylist+'

' # myowner = form["Owner"] # owner, print 'owner='+myowner+'

' # mypassword = form["password"] # and password. print 'password='+mypassword+'

' #130 f1=open('/lists/' + listname + '.owner','r') # read the (listname).owner file, trueowner=string.srip(f1.readline()) # read the owner id trueword=string.strip(f1.readline()) # read THE PASSWORD f1.close() # Close the file. if myowner == trueowner : # if the owner matches up, test the password; if mypassword==trueword: # if the password also matches, f1=open('/lists/'+ mylist,'r') #proceed to access the member roster. members=f1.readlines() # read them in, f1.close # and close the file. for i in members: #130 print i + '
' else: print 'Sorry, wrong password.' else: print 'Sorry, wrong owner id.' # print '


' # close the page, and end. # # #140 # ns# Note I am using 1.5.2 python, and an upgrade is not practical at this time. I invite suggestions, advice, evil humor, and dead parrot sketch sequals. -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | KILL spam dead! http://www.scambusters.org/stopspam/#Pledge | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com From idiot1@netzero.net Thu Aug 29 05:59:23 2002 From: idiot1@netzero.net (Kirk Bailey) Date: Thu, 29 Aug 2002 00:59:23 -0400 Subject: [Tutor] the address is the information- say what? Message-ID: <3D6DAA2B.E904C88B@netzero.net> OK, we're getting metaphysical here. This mantra haunts me from reading some stuff down at the public library. If indeed the address is the information, could we not reverse the process, and by providing information generate an address? 1. me 2. here 3. you 4. there 5. foo 6. pizza 7. snacks 8. pepto bismol Plug in key 6, you get pizza. Plug in pizza, get 6? Well, not with a dictionary, they can change placement at the interpreter's convince, but a list or tuple can do it. Wonder if this would be useful for email software? Hmmm... Anyway, onward with my script. -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | KILL spam dead! http://www.scambusters.org/stopspam/#Pledge | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ ------------------------------------------- Introducing NetZero Long Distance Unlimited Long Distance only $29.95/ month! Sign Up Today! www.netzerolongdistance.com From shalehperry@attbi.com Thu Aug 29 07:11:41 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Wed, 28 Aug 2002 23:11:41 -0700 Subject: [Tutor] yet another book review request In-Reply-To: References: Message-ID: <200208282311.41270.shalehperry@attbi.com> On Wednesday 28 August 2002 20:03, Erik Price wrote: > > Thanks, Sean. I was worried that it might teach some things that are > no longer used in the newer version of Python but it seems like a > "must-read" nonetheless. Interesting that it is not really like > "Programming Perl", which is pretty well-known but doesn't take a > "tutorial" approach at all (it's more of a reference). > You are correct. "Programming Python" actually teaches you the language = and=20 leaves the official Python docs to document the order of string.join(). = Some=20 people dislike the book because of this. I learned fairly early in my py= thon=20 programming to love the official docs so I never saw the style of the boo= k as=20 a failing. To each their own. From guillermo.fernandez@epfl.ch Thu Aug 29 08:31:58 2002 From: guillermo.fernandez@epfl.ch (Guillermo Fernandez) Date: Thu, 29 Aug 2002 17:01:58 +0930 Subject: [Tutor] Object problem in python 1.5.2 Message-ID: <3D6DCDEE.9B901EC9@epfl.ch> Hi! I'm trying to port a 2.2 python program to the 1.5.2 version. For those who wander why I'm doing such a weird thing: I've written in my computer (with python 2.2) a program that I would need to execute now in my university (with python 1.5.2). I encounter the following error executing my 2.2 program: Traceback (innermost last): File "Genetic.py", line 130, in ? if problem.maximize() != 0: File "GenAlg.py", line 156, in maximize return self.solve() File "GenAlg.py", line 113, in solve self.__initialize() File "GenAlg.py", line 219, in __initialize self.m_bestEver.evaluate() File "GASantaFe.py", line 508, in evaluate program=program-self._evaluate(self.m_genome) File "GASantaFe.py", line 435, in _evaluate executed=executed+self._evaluate(mylist[1]) File "GASantaFe.py", line 427, in _evaluate if iffood(): File "GASantaFe.py", line 400, in iffood length=int(math.sqrt(len(self._temp_map))) NameError: self The code is: In a Class: def _evaluate(self, mylist): """Evaluate the program stored in the list IN : The list OUT:""" def iffood(): # Is there food in front of us? line 400 -> length=int(math.sqrt(len(self._temp_map))) if self._direction == 0: return self._temp_map[self._x_pos+length* int(math.fmod((self._y_pos-1), length))] elif self._direction == 1: return self._temp_map[int(math.fmod((self._x_pos+1), length))+ length*self._y_pos] elif self._direction == 2: return self._temp_map[self._x_pos+length* int(math.fmod((self._y_pos+1), length))] elif self._direction == 3: return self._temp_map[int(math.fmod((self._x_pos-1), length))+ length*self._y_pos] else: print "Error" executed=0 length=int(math.sqrt(len(self._temp_map))) result=mylist[0] if result == "iffood": ETC, ETC, ETC... Have the object interface changed in such a manner that self is not recognized anymore? Of course, the original 2.2 code runs perfectly fine. Thanks! Guille From iumarumo@eidosnet.co.uk Thu Aug 29 10:52:39 2002 From: iumarumo@eidosnet.co.uk (Ibraheem Umaru-Mohammed) Date: Thu, 29 Aug 2002 10:52:39 +0100 Subject: [Tutor] Object problem in python 1.5.2 In-Reply-To: <3D6DCDEE.9B901EC9@epfl.ch> References: <3D6DCDEE.9B901EC9@epfl.ch> Message-ID: <20020829095239.GA25019@micromuse.com> ["Guillermo Fernandez"="Guillermo"] . . . Guillermo >> Guillermo >> The code is: Guillermo >> In a Class: Guillermo >> Guillermo >> def _evaluate(self, mylist): Guillermo >> """Evaluate the program stored in the list Guillermo >> IN : The list Guillermo >> OUT:""" Guillermo >> Guillermo >> def iffood(): Guillermo >> # Is there food in front of us? Guillermo >> line 400 -> length=int(math.sqrt(len(self._temp_map))) Guillermo >> if self._direction == 0: Guillermo >> return self._temp_map[self._x_pos+length* Guillermo >> int(math.fmod((self._y_pos-1), Guillermo >> length))] Guillermo >> elif self._direction == 1: Guillermo >> return self._temp_map[int(math.fmod((self._x_pos+1), Guillermo >> length))+ Guillermo >> length*self._y_pos] Guillermo >> elif self._direction == 2: Guillermo >> return self._temp_map[self._x_pos+length* Guillermo >> int(math.fmod((self._y_pos+1), Guillermo >> length))] Guillermo >> elif self._direction == 3: Guillermo >> return self._temp_map[int(math.fmod((self._x_pos-1), Guillermo >> length))+ Guillermo >> length*self._y_pos] Guillermo >> else: Guillermo >> print "Error" Guillermo >> Guillermo >> executed=0 Guillermo >> length=int(math.sqrt(len(self._temp_map))) Guillermo >> result=mylist[0] Guillermo >> if result == "iffood": Guillermo >> ETC, ETC, ETC... Guillermo >> Guillermo >> Have the object interface changed in such a manner that self is not Guillermo >> recognized anymore? Guillermo >> Guillermo >> Of course, the original 2.2 code runs perfectly fine. Guillermo >> Guillermo >> Thanks! Guillermo >> Guillermo >> Guille I believe the issue here is one of "nested scopes". Before Python2.2, names were resolved using the LGB princible (Local, Global, Built-in namespaces). Since nested scopes have been introduced, unbound names can be resolved from the enclosing function space. So in the example above, the method "iffood" is defined within "_evaluate", therefore any unresolved names in "iffood" are searched for in the "_evaluate" method's scope. In this case, "self" and "mylist" are resolved in the enclosing "_evaluate" namespace. Kindest regards, --ibs. -- Ibraheem Umaru-Mohammed "ibz" umarumohammed (at) btinternet (dot) com From erikprice@mac.com Thu Aug 29 12:43:00 2002 From: erikprice@mac.com (Erik Price) Date: Thu, 29 Aug 2002 07:43:00 -0400 Subject: [Tutor] Why lambda could be considered evil In-Reply-To: <200208290135.27475.scot@possum.in-berlin.de> Message-ID: <788B18B8-BB44-11D6-9CB7-00039351FE6A@mac.com> On Wednesday, August 28, 2002, at 07:35 PM, Scot W. Stevenson wrote: >> If you ever get round to reading >> up on lambda calculus then great, you can use python >> to play games without having to learn Lisp or Haskell... > > I think I'll save that one for a while - I still have the re module to > get > thru =8). That module is a sort of simlink on my system, to the "sre" module. (Or the "pre" module if I were to uncomment one of the lines.) Can someone explain why the code imports both from * and from "__all__" ? I've never seen the import __all__ before. (It looks like this: if engine == "sre": # New unicode-aware engine from sre import * from sre import __all__ else: # Old 1.5.2 engine. This one supports 8-bit strings only, # and will be removed in 2.0 final. from pre import * from pre import __all__ thank you) Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From thomi@thomi.imail.net.nz Thu Aug 29 12:35:39 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Thu, 29 Aug 2002 23:35:39 +1200 Subject: [Tutor] dictionary speeds? Message-ID: <20020829233539.2ec4cd6f.thomi@thomi.imail.net.nz> OK, i want to have a very complex dictionary structure, where the key is an ordinary old word, like "lion", but the value side is a tuple, which has other tuples nested inside it. it could have many thousand tuples inside it at once, and these need to be used frequently. My question is: how fast is the dictionary? would it slow down any data types _inside_ it? would it be faster to have a dictionary which has the word on the right, and an index number on the left?? I'm looking for speed here, its very important for this project. thanks once again. -- DOS: n., A small annoying boot virus that causes random spontaneous system crashes, usually just before saving a massive project. Easily cured by UNIX. See also MS-DOS, IBM-DOS, DR-DOS. (from David Vicker's .plan) Thomi Richards, thomi@imail.net.nz From magnus@thinkware.se Thu Aug 29 12:48:40 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Thu, 29 Aug 2002 13:48:40 +0200 Subject: [Tutor] Why lambda could be considered evil In-Reply-To: <200208290135.27475.scot@possum.in-berlin.de> References: <5104D4DBC598D211B5FE0000F8FE7EB20E66C8A6@mbtlipnt02.btlabs.bt.co.uk> <5104D4DBC598D211B5FE0000F8FE7EB20E66C8A6@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <5.1.0.14.0.20020829132950.02b50e78@www.thinkware.se> At 01:35 2002-08-29 +0200, Scot W. Stevenson wrote: > > and I agree they are not immediaely intuitive. OTOH look > > at COBOL which takes natural language to the other extreme: > > > > X =3D X PLUS 1 > >Yes. Er. Well. I guess that explains why it is such a popular language, >doesn't it... Actually, I thought the correct syntax for that would be ADD 1 TO X or COMPUTE X =3D X + 1 For an example of COBOL see http://99-bottles-of-beer.ls-la.net/c.html#Cobol --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From iumarumo@eidosnet.co.uk Thu Aug 29 12:59:19 2002 From: iumarumo@eidosnet.co.uk (Ibraheem Umaru-Mohammed) Date: Thu, 29 Aug 2002 12:59:19 +0100 Subject: [Tutor] Why lambda could be considered evil In-Reply-To: <788B18B8-BB44-11D6-9CB7-00039351FE6A@mac.com> References: <200208290135.27475.scot@possum.in-berlin.de> <788B18B8-BB44-11D6-9CB7-00039351FE6A@mac.com> Message-ID: <20020829115919.GB25019@micromuse.com> ["Erik Price"="Erik"] Erik >> Erik >> On Wednesday, August 28, 2002, at 07:35 PM, Scot W. Stevenson wrote: Erik >> Erik >> >>If you ever get round to reading Erik >> >>up on lambda calculus then great, you can use python Erik >> >>to play games without having to learn Lisp or Haskell... Erik >> > Erik >> >I think I'll save that one for a while - I still have the re module to Erik >> >get Erik >> >thru =8). Erik >> Erik >> That module is a sort of simlink on my system, to the "sre" module. Erik >> (Or the "pre" module if I were to uncomment one of the lines.) Erik >> Erik >> Can someone explain why the code imports both from * and from "__all__" Erik >> ? I've never seen the import __all__ before. (It looks like this: Erik >> Erik >> if engine == "sre": Erik >> # New unicode-aware engine Erik >> from sre import * Erik >> from sre import __all__ Erik >> else: Erik >> # Old 1.5.2 engine. This one supports 8-bit strings only, Erik >> # and will be removed in 2.0 final. Erik >> from pre import * Erik >> from pre import __all__ Erik >> Erik >> thank you) Erik >> Erik >> Erik >> Erik Erik >> I believe this is because "from foo import *" doesn't work very well on case sensitive platforms such as Windows. That is, "FOO.PY" could be imported as module "foo", "Foo", or "FOO". I think the "__all__" is used as a way to explicitly index names of a package. I've seen it used in a package's __init__.py code, to list module names that should be imported when "from foo import *" is used. Kindest regards, --ibz. -- Ibraheem Umaru-Mohammed "ibz" umarumohammed (at) btinternet (dot) com From magnus@thinkware.se Thu Aug 29 13:33:51 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Thu, 29 Aug 2002 14:33:51 +0200 Subject: [Tutor] yet another book review request In-Reply-To: <200208281922.07831.shalehperry@attbi.com> References: <7BD626B9-BAF6-11D6-9CB7-00039351FE6A@mac.com> <7BD626B9-BAF6-11D6-9CB7-00039351FE6A@mac.com> Message-ID: <5.1.0.14.0.20020829135041.02b45098@www.thinkware.se> At 19:22 2002-08-28 -0700, Sean 'Shaleh' Perry wrote: >On Wednesday 28 August 2002 19:24, Erik Price wrote: > > I'm curious what people think of Programming Python 2nd Edition > > (updated for Python 2). I was in the store tonight, looking at the > > Python Cookbook, but this one also seems like a great "next step" > > Python book. > > > >I own one of the first prints of Programming Python (came out around the= time >of 1.5). 1.3 actually... (Check the back.) So make sure to get the 2nd ed. I've only browsed through the 2nd ed, but I didn't like the first ed very much. 2nd ed seemed better though... > It has long been my favorite book for learning Python. I love how >the book progresses from small ideas to larger programs and it reuses the >same examples again and again. I doubt the 2nd edition has changed so much >as to invalidate this. This is not a bad idea, I agree with that, and from what I saw this is true for 2nd ed too. There are a lot of good Python books now. Among books for those beyond the first stage of learning, Programming Python is certainly one. Others are "Python Programming for Win 32" (if that's your platform) or Python Web Programming which covers all sorts of internet programming (not only for the web) and databases etc. If you want more of a reference guide for the core language, Python Essential Reference (2nd ed) is the book to choose. The Win 32 book is written for 1.5.2, but the others are more recent. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From magnus@thinkware.se Thu Aug 29 14:14:43 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Thu, 29 Aug 2002 15:14:43 +0200 Subject: [Tutor] Object problem in python 1.5.2 In-Reply-To: <3D6DCDEE.9B901EC9@epfl.ch> Message-ID: <5.1.0.14.0.20020829151236.02b79ab8@www.thinkware.se> As Ibraheem said, it's a namespace problem. At 17:01 2002-08-29 +0930, Guillermo Fernandez wrote: > def iffood(): This has to be def iffood(self): and the you need to pass "self" as a parameter when you call iffood. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From magnus@thinkware.se Thu Aug 29 14:39:49 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Thu, 29 Aug 2002 15:39:49 +0200 Subject: [Tutor] dictionary speeds? In-Reply-To: <20020829233539.2ec4cd6f.thomi@thomi.imail.net.nz> Message-ID: <5.1.0.14.0.20020829151608.02b79c00@www.thinkware.se> At 23:35 2002-08-29 +1200, Thomi Richards wrote: >OK, i want to have a very complex dictionary structure, where the key is >an ordinary old word, like "lion", but the value side is a tuple, which >has other tuples nested inside it. it could have many thousand tuples >inside it at once, and these need to be used frequently. My question is: > >how fast is the dictionary? would it slow down any data types _inside_ >it? would it be faster to have a dictionary which has the word on the >right, and an index number on the left?? > >I'm looking for speed here, its very important for this project. Dictionaries are fast. AFAIK look-up time is more or less constant regardless of dictionary size. (Assuming you fit in the RAM and don't start swapping of course.) The values are not stored inside the dictionary. The dictionary just contains pointers to the locations in memory. Look at this example: >>> parrot =3D (1,2,3) >>> larch =3D (parrot,4,5,6) >>> kilimanjaro =3D {'tree' : larch} >>> ronObvious =3D kilimanjaro['tree'] larch, ronObvious and kilimanjaro['tree'] will now all refer to the same object, a tuple containing ((1,2,3),4,5,6). It's not stored in a dict or in a variable. It's an object, and it's stored in the part of the compters memory called the heap. In my particular case it's stored at memory location 22837480 but that not very interesting... >>> id(larch) 22837480 >>> id(ronObvious) 22837480 >>> id(kilimanjaro['tree']) 22837480 This memory location the contains a tuple, which is basically four pointers, pointing out the locations of the four objects in it (the tuple with (1,2,3) and the three integers 4, 5 and 6. >>> id(larch[0]) # the tuple (1,2,3) 22778384 >>> id(parrot) # same tuple 22778384 >>> id(larch[1]) # integer 4 3439804 >>> id(larch[2]) # integer 5 3439600 >>> id(larch[3]) # integer 6 3439588 Further, python is capable of interning simple objects like integers, i.e. it will reuse immutable objects that are already used. >>> x =3D 6 >>> id(x) 3439588 But as you see: >>> y =3D (1,2,3) >>> id(y) 22866432 it wasn't clever enough to reuse the tuple at 22778384 though... (In theory it could have done that, since tuples can't change once they are created, i.e. they are immutable.) --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From Nicole.Seitz@urz.uni-hd.de Thu Aug 29 17:55:25 2002 From: Nicole.Seitz@urz.uni-hd.de (Nicole Seitz) Date: Thu, 29 Aug 2002 16:55:25 +0000 Subject: [Tutor] Reading and Writing Message-ID: <200208291655.25998.Nicole.Seitz@urz.uni-hd.de> hi there! I wrote a program, which opens a file, reads its data, gets out some=20 information and than writes this stuff to a file. It works fine, but I like to make the reading and writing process more=20 comfortable. So far, to open the input and output file, I did the following: infile =3D open("C:\WINDOWS\Desktop\python_scripts\html\ez-z.html").read(= ) outFile =3D open("C:\WINDOWS\Desktop\python_scripts\info\ez-z.txt","w") But there's not only one file to open, there are about 20, all of them in= the=20 same directory. My question now is: Is it possible to have the program open each of the files in this directo= ry =20 and for each input file, create an output file with a proper name(what I = mean=20 is this: for ez-a.htm I like to have ez-a.txt, and so on), so that I have= to=20 run my program only one time? Thanks for your help in advance. Nicole From erikprice@mac.com Thu Aug 29 16:06:03 2002 From: erikprice@mac.com (Erik Price) Date: Thu, 29 Aug 2002 11:06:03 -0400 Subject: [Tutor] Reading and Writing In-Reply-To: <200208291655.25998.Nicole.Seitz@urz.uni-hd.de> Message-ID: On Thursday, August 29, 2002, at 12:55 PM, Nicole Seitz wrote: > infile = > open("C:\WINDOWS\Desktop\python_scripts\html\ez-z.html").read() > outFile = open("C:\WINDOWS\Desktop\python_scripts\info\ez-z.txt","w") > > But there's not only one file to open, there are about 20, all of them > in the > same directory. My question now is: > > Is it possible to have the program open each of the files in this > directory > and for each input file, create an output file with a proper name(what > I mean > is this: for ez-a.htm I like to have ez-a.txt, and so on), so that I > have to > run my program only one time? Sure. Write your script such that it loops through each file in your target directory and performs the work you need done on each file. A simple way to do that is to read all of the files in a directory into a list, then loop over the list and perform the work to each file in the list. The following code should give you an idea of how to do it, but you might want to add some code that ensures that only certain files are acted upon (based on filename, for instance -- you can do this with the "fnmatch" module): import os.path htmlDirectory = "" # place the path to your read directory between the quotes txtDirectory = "" # place the path to your write directory between the quotes os.chdir(htmlDirectory) for file in os.listdir(): nosuffix = file.split('.')[0] infile = open(file).read() outfile = open(txtDirectory + nosuffix + '.txt', 'w') This will open each file in the target directory for reading, then open a similarly-named file in another directory (the difference is that it should have the suffix ".txt" instead of ".html") for writing. Note that this code doesn't actually do the writing of the first file, I didn't include that because this is just a different version of the code you already posted, and that code didn't have the writing part either. So you still have to implement the writing of data to the outfile. HTH, Erik PS: if someone knows of a more efficient solution that doesn't use os.chdir() I would be very interested in hearing about it -- it seems that using os.chdir() is overkill for this but maybe not? -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From lumbricus@gmx.net Thu Aug 29 16:12:42 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Thu, 29 Aug 2002 17:12:42 +0200 (MEST) Subject: [Tutor] Reading and Writing References: <200208291655.25998.Nicole.Seitz@urz.uni-hd.de> Message-ID: <12720.1030633962@www6.gmx.net> > hi there! Hello! [ snip ] > Is it possible to have the program open each of the files in this directo > ry > and for each input file, create an output file with a proper name(what I > mean > is this: for ez-a.htm I like to have ez-a.txt, and so on), so that I have > to > run my program only one time? You may be interested in the glob module. man glob > Thanks for your help in advance. > > Nicole HTH, HAND J"o! -- > > > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- Wir beschliessen etwas, stellen das dann in den Raum und warten dann einige Zeit ab, was passiert. Wenn es dann kein grosses Geschrei gibt und keine Aufstaende, weil die meisten gar nicht begreifen, was da beschlossen wurde, dann machen wir weiter - Schritt fuer Schritt, bis es kein Zurueck mehr gibt. -- J-C Juncker GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From iumarumo@eidosnet.co.uk Thu Aug 29 16:33:09 2002 From: iumarumo@eidosnet.co.uk (Ibraheem Umaru-Mohammed) Date: Thu, 29 Aug 2002 16:33:09 +0100 Subject: [Tutor] Reading and Writing In-Reply-To: References: <200208291655.25998.Nicole.Seitz@urz.uni-hd.de> Message-ID: <20020829153309.GC25019@micromuse.com> ["Erik Price"="Erik"] Erik >> On Thursday, August 29, 2002, at 12:55 PM, Nicole Seitz wrote: Erik >> Erik >> >infile = Erik >> >open("C:\WINDOWS\Desktop\python_scripts\html\ez-z.html").read() Erik >> > outFile = open("C:\WINDOWS\Desktop\python_scripts\info\ez-z.txt","w") Erik >> > Erik >> >But there's not only one file to open, there are about 20, all of them Erik >> >in the Erik >> >same directory. My question now is: Erik >> > Erik >> >Is it possible to have the program open each of the files in this Erik >> >directory Erik >> >and for each input file, create an output file with a proper name(what Erik >> >I mean Erik >> >is this: for ez-a.htm I like to have ez-a.txt, and so on), so that I Erik >> >have to Erik >> >run my program only one time? Erik >> Erik >> Sure. Write your script such that it loops through each file in your Erik >> target directory and performs the work you need done on each file. A Erik >> simple way to do that is to read all of the files in a directory into a Erik >> list, then loop over the list and perform the work to each file in the Erik >> list. The following code should give you an idea of how to do it, but Erik >> you might want to add some code that ensures that only certain files Erik >> are acted upon (based on filename, for instance -- you can do this with Erik >> the "fnmatch" module): Erik >> Erik >> Erik >> Erik >> import os.path Erik >> Erik >> htmlDirectory = "" # place the path to your read directory Erik >> between the quotes Erik >> txtDirectory = "" # place the path to your write Erik >> directory between the quotes Erik >> os.chdir(htmlDirectory) Erik >> Erik >> for file in os.listdir(): Erik >> nosuffix = file.split('.')[0] Erik >> infile = open(file).read() Erik >> outfile = open(txtDirectory + nosuffix + '.txt', 'w') Erik >> Erik >> Erik >> Erik >> This will open each file in the target directory for reading, then open Erik >> a similarly-named file in another directory (the difference is that it Erik >> should have the suffix ".txt" instead of ".html") for writing. Note Erik >> that this code doesn't actually do the writing of the first file, I Erik >> didn't include that because this is just a different version of the Erik >> code you already posted, and that code didn't have the writing part Erik >> either. So you still have to implement the writing of data to the Erik >> outfile. Erik >> Erik >> Erik >> HTH, Erik >> Erik >> Erik >> Erik >> Erik Erik >> Erik >> PS: if someone knows of a more efficient solution that doesn't use Erik >> os.chdir() I would be very interested in hearing about it -- it seems Erik >> that using os.chdir() is overkill for this but maybe not? Erik >> os.listdir() takes a optional path to a directory as an argument. So you could do something like: #!/usr/bin/env python import os.path import fnmatch text_directory = "/home/ibraheem/python_scripts/txt/" html_directory = "/home/ibraheem/python_scripts/html/" for filename in os.listdir(html_directory): if fnmatch.fnmatch(filename, "*.html"): nosuffix, ext = os.path.splitext(filename) in_filename = os.path.join(html_directory, filename) out_filename = os.path.join(text_directory, nosuffix + '.txt') infile_data = open(in_filename) outfile_data = open(out_filename,'w') # do something close(in_filename) close(out_filename) Not tested. Kindest regards, --ibz. -- Ibraheem Umaru-Mohammed "ibz" umarumohammed (at) btinternet (dot) com From iumarumo@eidosnet.co.uk Thu Aug 29 16:48:10 2002 From: iumarumo@eidosnet.co.uk (Ibraheem Umaru-Mohammed) Date: Thu, 29 Aug 2002 16:48:10 +0100 Subject: [Tutor] Reading and Writing In-Reply-To: <20020829153309.GC25019@micromuse.com> References: <200208291655.25998.Nicole.Seitz@urz.uni-hd.de> <20020829153309.GC25019@micromuse.com> Message-ID: <20020829154810.GD25019@micromuse.com> ["Ibraheem Umaru-Mohammed"="Ibraheem"] Ibraheem >> Ibraheem >> os.listdir() takes a optional path to a directory as an argument. Ibraheem >> Ibraheem >> So you could do something like: Ibraheem >> Ibraheem >> Ibraheem >> #!/usr/bin/env python Ibraheem >> Ibraheem >> import os.path Ibraheem >> import fnmatch Ibraheem >> Ibraheem >> text_directory = "/home/ibraheem/python_scripts/txt/" Ibraheem >> html_directory = "/home/ibraheem/python_scripts/html/" Ibraheem >> Ibraheem >> for filename in os.listdir(html_directory): Ibraheem >> if fnmatch.fnmatch(filename, "*.html"): Ibraheem >> nosuffix, ext = os.path.splitext(filename) Ibraheem >> in_filename = os.path.join(html_directory, filename) Ibraheem >> out_filename = os.path.join(text_directory, nosuffix + '.txt') Ibraheem >> infile_data = open(in_filename) Ibraheem >> outfile_data = open(out_filename,'w') Ibraheem >> # do something Ibraheem >> close(in_filename) Ibraheem >> close(out_filename) Ibraheem >> Ibraheem >> Ibraheem >> Not tested. Ibraheem >> Ibraheem >> Ibraheem >> Kindest regards, Ibraheem >> Actually, os.listdir must be specified a path as its argument. The code above I think needs to import "os" module as well. Iti also probably neater to use the glob module, as glob returns full pathnames, whereas with the os.listdir function, we find ourselves constructing the path. Kindest regards, --ibz. -- Ibraheem Umaru-Mohammed "ibz" umarumohammed (at) btinternet (dot) com From erikprice@mac.com Thu Aug 29 19:53:26 2002 From: erikprice@mac.com (Erik Price) Date: Thu, 29 Aug 2002 14:53:26 -0400 Subject: [Tutor] Reading and Writing In-Reply-To: <20020829154810.GD25019@micromuse.com> Message-ID: <9A1AA9BE-BB80-11D6-9CB7-00039351FE6A@mac.com> On Thursday, August 29, 2002, at 11:48 AM, Ibraheem Umaru-Mohammed wrote: > Iti also probably neater to use the glob module, as glob returns full > pathnames, whereas with the os.listdir function, we find ourselves > constructing the path. Why does os.path.splitext() and fnmatch.fnmatch() use the Unix-style shell globbing syntax for pattern-matching? I find "glob"-style pattern-matching to be somewhat weak after having used regular expressions (especially PCREs). There must be some way to use (or some module that uses) regexes instead. Is that for easiness for newbies or to appease sysadmins used to bash? (I like bash too but Python seems like it should be more powerful than just globbing.) Either way, it's no match for regular expressions. (Hah! I kill me! ;) Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From thomi@thomi.imail.net.nz Fri Aug 30 07:07:15 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Fri, 30 Aug 2002 18:07:15 +1200 Subject: [Tutor] dictionary speeds? In-Reply-To: <5.1.0.14.0.20020829151608.02b79c00@www.thinkware.se> References: <20020829233539.2ec4cd6f.thomi@thomi.imail.net.nz> <5.1.0.14.0.20020829151608.02b79c00@www.thinkware.se> Message-ID: <20020830180715.41481fd7.thomi@thomi.imail.net.nz> thanks for that, it answers my question... I did realise that i will have to use lists instead of tuples though (DO'H!!) On Thu, 29 Aug 2002 15:39:49 +0200 Thus said Magnus Lycka : > At 23:35 2002-08-29 +1200, Thomi Richards wrote: > >OK, i want to have a very complex dictionary structure, where the key > >is an ordinary old word, like "lion", but the value side is a tuple, > >which has other tuples nested inside it. it could have many thousand > >tuples inside it at once, and these need to be used frequently. My > >question is: > > > >how fast is the dictionary? would it slow down any data types > >_inside_ it? would it be faster to have a dictionary which has the > >word on the right, and an index number on the left?? > > > >I'm looking for speed here, its very important for this project. > > Dictionaries are fast. AFAIK look-up time is more or less constant > regardless of dictionary size. (Assuming you fit in the RAM and > don't start swapping of course.) > > The values are not stored inside the dictionary. The dictionary just > contains pointers to the locations in memory. Look at this example: > > >>> parrot = (1,2,3) > >>> larch = (parrot,4,5,6) > >>> kilimanjaro = {'tree' : larch} > >>> ronObvious = kilimanjaro['tree'] > > larch, ronObvious and kilimanjaro['tree'] will now all refer to > the same object, a tuple containing ((1,2,3),4,5,6). It's not > stored in a dict or in a variable. It's an object, and it's > stored in the part of the compters memory called the heap. > In my particular case it's stored at memory location 22837480 > but that not very interesting... > > >>> id(larch) > 22837480 > >>> id(ronObvious) > 22837480 > >>> id(kilimanjaro['tree']) > 22837480 > > This memory location the contains a tuple, which is basically > four pointers, pointing out the locations of the four objects > in it (the tuple with (1,2,3) and the three integers 4, 5 and 6. > > >>> id(larch[0]) # the tuple (1,2,3) > 22778384 > >>> id(parrot) # same tuple > 22778384 > >>> id(larch[1]) # integer 4 > 3439804 > >>> id(larch[2]) # integer 5 > 3439600 > >>> id(larch[3]) # integer 6 > 3439588 > > Further, python is capable of interning simple objects like integers, > i.e. it will reuse immutable objects that are already used. > > >>> x = 6 > >>> id(x) > 3439588 > > But as you see: > > >>> y = (1,2,3) > >>> id(y) > 22866432 > > it wasn't clever enough to reuse the tuple at 22778384 though... > (In theory it could have done that, since tuples can't change > once they are created, i.e. they are immutable.) > > > -- > Magnus Lyckå, Thinkware AB > Älvans väg 99, SE-907 50 UMEÅ > tel: 070-582 80 65, fax: 070-612 80 65 > http://www.thinkware.se/ mailto:magnus@thinkware.se > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- This message was brought to you by one bored guy, with nothing better to do, And the letter Q. Thomi Richards, thomi@imail.net.nz From thomi@thomi.imail.net.nz Fri Aug 30 08:54:52 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Fri, 30 Aug 2002 19:54:52 +1200 Subject: [Tutor] importing variable contents, and variable naming problms Message-ID: <20020830195452.45774dff.thomi@thomi.imail.net.nz> Hey! i have a rather simple (well, the answer is probably really simple..) problem: i have a variable called item, which contains 'lion'. i also have a module called 'lion', and i want to import it. the catch is, the module will always be called what the contents of the variable is, but the actual name may change. is there some trick you can do with teh format % sign thingies?? similarly, if i have a variable called item, and it contains 'lion', how can i make a variable named the same as the contents of 'item'?? so i would end up with two variables, one called 'item', and one called 'lion'. any ideas guys?? I could never do this in C, maybe python is a little different?? -- DOS: n., A small annoying boot virus that causes random spontaneous system crashes, usually just before saving a massive project. Easily cured by UNIX. See also MS-DOS, IBM-DOS, DR-DOS. (from David Vicker's .plan) Thomi Richards, thomi@imail.net.nz From iumarumo@eidosnet.co.uk Fri Aug 30 11:54:12 2002 From: iumarumo@eidosnet.co.uk (Ibraheem Umaru-Mohammed) Date: Fri, 30 Aug 2002 11:54:12 +0100 Subject: [Tutor] Reading and Writing In-Reply-To: <9A1AA9BE-BB80-11D6-9CB7-00039351FE6A@mac.com> References: <20020829154810.GD25019@micromuse.com> <9A1AA9BE-BB80-11D6-9CB7-00039351FE6A@mac.com> Message-ID: <20020830105412.GE25019@micromuse.com> ["Erik Price"="Erik"] Erik >> Erik >> On Thursday, August 29, 2002, at 11:48 AM, Ibraheem Umaru-Mohammed Erik >> wrote: Erik >> Erik >> >Iti also probably neater to use the glob module, as glob returns full Erik >> >pathnames, whereas with the os.listdir function, we find ourselves Erik >> >constructing the path. Erik >> Erik >> Why does os.path.splitext() and fnmatch.fnmatch() use the Unix-style Erik >> shell globbing syntax for pattern-matching? I find "glob"-style Erik >> pattern-matching to be somewhat weak after having used regular Erik >> expressions (especially PCREs). There must be some way to use (or some Erik >> module that uses) regexes instead. Erik >> Erik >> Is that for easiness for newbies or to appease sysadmins used to bash? Erik >> (I like bash too but Python seems like it should be more powerful than Erik >> just globbing.) Erik >> Erik >> Either way, it's no match for regular expressions. Erik >> (Hah! I kill me! ;) Erik >> You can do this by using the "re" module directly. For example, #!/usr/bin/env python import os import re text_directory = "/home/ibraheem/python_scripts/txt/" html_directory = "/home/ibraheem/python_scripts/html/" # match a filename that matches the following regular expression: # \d = a single digit [0-9] # \w+ = at least one word character [a-zA-Z] # \d = a single digit [0-9] # .htm = a literal pattern = "\d\w+\d.htm" for filename in os.listdir(html_directory): # if we have a match, print the matching string. m = re.match(pattern, filename) if m: print repr(m.group(0)) Gives the following, ibraheem@ignoramus:$ ls ~/python_scripts/html/ 1foo1.htm 2foo2.htm 3foo3.htm 4foo4.htm 5foo5.htm 6foo6.htm 1.html 2.html 3.html 4.html 5.html 6.html ibraheem@ignoramus:$ ./re-example.py '1foo1.htm' '2foo2.htm' '3foo3.htm' '4foo4.htm' '5foo5.htm' '6foo6.htm' ibraheem@ignoramus:$ You can see that the [0-9].html files are NOT matched. Kindest regards, --ibz. -- Ibraheem Umaru-Mohammed "ibz" umarumohammed (at) btinternet (dot) com From iumarumo@eidosnet.co.uk Fri Aug 30 12:06:29 2002 From: iumarumo@eidosnet.co.uk (Ibraheem Umaru-Mohammed) Date: Fri, 30 Aug 2002 12:06:29 +0100 Subject: [Tutor] importing variable contents, and variable naming problms In-Reply-To: <20020830195452.45774dff.thomi@thomi.imail.net.nz> References: <20020830195452.45774dff.thomi@thomi.imail.net.nz> Message-ID: <20020830110629.GF25019@micromuse.com> ["Thomi Richards"="Thomi"] Thomi >> Thomi >> Hey! i have a rather simple (well, the answer is probably really Thomi >> simple..) problem: Thomi >> Thomi >> i have a variable called item, which contains 'lion'. i also have a Thomi >> module called 'lion', and i want to import it. the catch is, the module Thomi >> will always be called what the contents of the variable is, but the Thomi >> actual name may change. is there some trick you can do with teh format % Thomi >> sign thingies?? Thomi >> i think you want to use __import__. e.g item = 'lion' __import__(item) Thomi >> similarly, if i have a variable called item, and it contains 'lion', how Thomi >> can i make a variable named the same as the contents of 'item'?? so i Thomi >> would end up with two variables, one called 'item', and one called Thomi >> 'lion'. any ideas guys?? I could never do this in C, maybe python is a Thomi >> little different?? Thomi >> I believe you want to use exec. e.g item = 'lion' exec ("%s = 'foo'" % item) You can't use eval, because eval doesn't accept statements, only expressions. Kindest regards, --ibz. -- Ibraheem Umaru-Mohammed "ibz" umarumohammed (at) btinternet (dot) com From Morne" This is a multi-part message in MIME format. ------=_NextPart_000_000E_01C25029.FA869380 Content-Type: multipart/alternative; boundary="----=_NextPart_001_000F_01C25029.FA8E34A0" ------=_NextPart_001_000F_01C25029.FA8E34A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi=20 This is what I have 'not graet but on my way" import string def getStuff(file): for line in pppfile: closeline =3D 0 error.count =3D 0 second.count =3D 0 connect.count =3D 0 data_out.count =3D 0 data_in.count =3D 0 =20 if find("IPCP", line) > 0 connectline =3D split(line) connect.count =3D connect.count + 1 continue if find("ERROR", line) > 0 error.count =3D error.count + 1 continue if find("connect time", line) closeline =3D split(line) print connectline[1] "" connectline[2] print close seconds.count =3D seconds.count + atoi(closeline[9]) print summary I need help with a program that can read the attached ppp.log file and = give me the following type of report: PPP Log file summary for 5 Jul 2002 ----------------------------------- Jul 5 18:15:01 Connected to internet (IP 155.239.150.146) Jul 5 18:18:08 Closed connection. ( Connect time: 197 secs: 5091 octets = in, 1864 octets out ) ----------------------------------- Successful connections: 5 Failed connections: 2 Total time online: 456 seconds Total data in: 66576 octets Total Data out: 66349 octets The lines in the file that I will use look like this: Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: myaddr 155.239.150.146 hisaddr =3D 155.239.150.254 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: Connect time: 197 secs: 5091 octets in, 1864 octets out Jul 6 06:30:44 maxigate ppp[34607]: tun0: Warning: Chat script failed ------=_NextPart_001_000F_01C25029.FA8E34A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi
 
This is what I have 'not graet but on = my=20 way"
 
import string
def=20 getStuff(file):
    for line in=20 pppfile:
        closeline =3D=20 0
        error.count =3D=20 0
        second.count =3D=20 0
        connect.count =3D=20 0
        data_out.count =3D=20 0
        data_in.count =3D=20 0
       
    = if=20 find("IPCP", line) > 0
       =20 connectline =3D = split(line)
       =20 connect.count =3D connect.count + = 1
       =20 continue
 
    if find("ERROR", = line) >=20 0
       error.count =3D error.count +=20 1
       continue
    = if=20 find("connect time", line)
       = closeline =3D=20 split(line)
       print connectline[1] = ""=20 connectline[2]
       print = close
 
       = seconds.count=20 =3D seconds.count + atoi(closeline[9])
 
       = print=20 summary
I need help with a program that = can read the=20 attached ppp.log file and give me the
following type of=20 report:


PPP Log file summary for 5 Jul=20 2002
-----------------------------------
Jul  5 18:15:01 = Connected to=20 internet (IP 155.239.150.146)
Jul  5 18:18:08 Closed connection. = (=20 Connect time: 197 secs: 5091 octets in,
1864 octets out=20 )
-----------------------------------
Successful connections: = 5
Failed=20 connections: 2
Total time online: 456 seconds
Total data in: 66576 = octets
Total Data out: 66349 octets


The lines in the file=20 that I will use look like this:

Jul  5 18:45:31 = maxigate=20 ppp[34607]: tun0: IPCP: myaddr 155.239.150.146
hisaddr =3D=20 155.239.150.254
Jul  5 18:48:48 maxigate ppp[34607]: tun0: IPCP: = Connect=20 time: 197 secs:
5091 octets in, 1864 octets out
Jul  6 = 06:30:44=20 maxigate ppp[34607]: tun0: Warning: Chat script=20 failed

------=_NextPart_001_000F_01C25029.FA8E34A0-- ------=_NextPart_000_000E_01C25029.FA869380 Content-Type: application/octet-stream; name="ppp.log" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ppp.log" Jul 5 18:00:00 maxigate newsyslog[87300]: logfile turned over Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = quit=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection dropped.=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = set timeout 180=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = dial=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: bundle: Establish=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: deflink: closed -> = opening=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: deflink: Connected!=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: deflink: opening -> = dial=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: Phone: 0860007249=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: deflink: Dial attempt 1 = of 1=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection closed.=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: Send: AT^M=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 5 18:15:00 maxigate ppp[34607]: tun0: Chat: Received: AT^M^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Send: ATE1Q0^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Received: ATE1Q0^M^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 5 18:15:01 maxigate ppp[34607]: tun0: Chat: Send: = ATx1DT0860007249^M=20 Jul 5 18:15:03 maxigate ppp[34607]: tun0: Chat: Expect(40): CONNECT=20 Jul 5 18:15:22 maxigate ppp[34607]: tun0: Chat: Received: = ATx1DT0860007249^M^M=20 Jul 5 18:15:22 maxigate ppp[34607]: tun0: Chat: Received: CONNECT = 33600/ARQ/V34/LAPM/V42BIS^M=20 Jul 5 18:15:22 maxigate ppp[34607]: tun0: Phase: deflink: dial -> = carrier=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: Phase: deflink: /dev/cuaa0: = CD detected=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: Phase: deflink: carrier -> = login=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: Phase: deflink: login -> lcp=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: LCP: FSM: Using "deflink" as = a transport=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Initial --> Closed=20 Jul 5 18:15:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Stopped=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: deflink: LayerStart=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Stopped=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:24 maxigate ppp[34607]: tun0: LCP: deflink: State change = Stopped --> Req-Sent=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Req-Sent=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Req-Sent=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Req-Sent=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:34 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Req-Sent=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:15:37 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xfead050c=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: LCP: deflink: LayerFinish=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: LCP: deflink: State change = Req-Sent --> Stopped=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: LCP: deflink: State change = Stopped --> Closed=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Initial=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: lcp -> logout = Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: logout -> = hangup=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: Connect time: = 40 secs: 0 octets in, 265 octets out=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: : 1079435 = packets in, 231579 packets out=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: total 6 bytes/sec, = peak 21 bytes/sec on Fri Jul 5 18:15:40 2002=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: deflink: hangup -> = closed=20 Jul 5 18:15:40 maxigate ppp[34607]: tun0: Phase: bundle: Dead=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = quit=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection dropped.=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = set timeout 180=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = dial=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: bundle: Establish=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: deflink: closed -> = opening=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: deflink: Connected!=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: deflink: opening -> = dial=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Phone: 0860007249=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: deflink: Dial attempt 1 = of 1=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection closed.=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Send: AT^M=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Received: AT^M^M=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Send: ATE1Q0^M=20 Jul 5 18:45:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 5 18:45:01 maxigate ppp[34607]: tun0: Chat: Received: ATE1Q0^M^M=20 Jul 5 18:45:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 5 18:45:01 maxigate ppp[34607]: tun0: Chat: Send: = ATx1DT0860007249^M=20 Jul 5 18:45:03 maxigate ppp[34607]: tun0: Chat: Expect(40): CONNECT=20 Jul 5 18:45:22 maxigate ppp[34607]: tun0: Chat: Received: = ATx1DT0860007249^M^M=20 Jul 5 18:45:22 maxigate ppp[34607]: tun0: Chat: Received: CONNECT = 33600/ARQ/V34/LAPM/V42BIS^M=20 Jul 5 18:45:22 maxigate ppp[34607]: tun0: Phase: deflink: dial -> = carrier=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: Phase: deflink: /dev/cuaa0: = CD detected=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: Phase: deflink: carrier -> = login=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: Phase: deflink: login -> lcp=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: LCP: FSM: Using "deflink" as = a transport=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Initial --> Closed=20 Jul 5 18:45:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Stopped=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: deflink: LayerStart=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Stopped=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xd52c5683=20 Jul 5 18:45:24 maxigate ppp[34607]: tun0: LCP: deflink: State change = Stopped --> Req-Sent=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigReq(7) state =3D Req-Sent=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x58cf83ad=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigAck(7) state =3D Req-Sent=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x58cf83ad=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:27 maxigate ppp[34607]: tun0: LCP: deflink: State change = Req-Sent --> Ack-Sent=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Ack-Sent=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:45:28 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xd52c5683=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(179) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0xd52c5683=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigReq(8) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x58cf933e=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigAck(8) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x58cf933e=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigAck(179) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: State change = Ack-Sent --> Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: LayerUp=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: Sending ident magic = d52c5683 text user-ppp 2.3 (built Apr 26 2001)=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: SendIdent(180) = state =3D Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: bundle: Authenticate=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: deflink: his =3D PAP, = mine =3D none=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: Pap Output: itec79 = ********=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: Pap Input: SUCCESS ()=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: Using trigger address = 0.0.0.0=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: FSM: Using "deflink" as = a transport=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Initial --> Closed=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: LayerStart.=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: MPPE: Not usable without = CHAP81=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: = SendConfigReq(1) state =3D Closed=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: DEFLATE[4] win 15=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: PRED1[2] =20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Closed --> Req-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: deflink: lcp -> open=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Phase: bundle: Network=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: FSM: Using "deflink" as = a transport=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Initial --> Closed=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: LayerStart.=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(103) state =3D Closed=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] 0.0.0.0=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: COMPPROTO[6] 16 VJ = slots with slot compression=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Closed --> Req-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigReq(188) state =3D Req-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.254=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigAck(188) state =3D Req-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.254=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Req-Sent --> Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvProtocolRej(9) state =3D Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: -- Protocol = 0x80fd (Compression Control Protocol) was rejected!=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Req-Sent --> Stopped=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigRej(103) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: Sending ident magic = d52c5683 text user-ppp 2.3 (built Apr 26 2001)=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: LCP: deflink: SendIdent(181) = state =3D Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: COMPPROTO[6] 16 VJ = slots with slot compression=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(104) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] 0.0.0.0=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigNak(104) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.146=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] changing = address: 0.0.0.0 --> 155.239.150.146=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(105) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.146=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigAck(105) state =3D Ack-Sent=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Ack-Sent --> Opened=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: deflink: LayerUp.=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: IPCP: myaddr 155.239.150.146 = hisaddr =3D 155.239.150.254=20 Jul 5 18:45:31 maxigate ppp[34607]: tun0: Command: maxigate: !bg = /usr/local/sys/linkup=20 Jul 5 18:46:33 maxigate ppp[34607]: tun0: Phase: deflink: HDLC errors = -> FCS: 2, ADDR: 0, COMD: 0, PROTO: 0=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: Idle timer expired=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: LayerDown: = 155.239.150.146=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Command: maxigate: iface = clear=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: Using trigger address = 0.0.0.0=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: = SendTerminateReq(106) state =3D Opened=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Opened --> Closing=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvTerminateAck(106) state =3D Closing=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: LayerFinish.=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: Connect time: 197 secs: = 5091 octets in, 1864 octets out=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: : 234569 packets in, = 230304 packets out=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: total 35 bytes/sec, = peak 815 bytes/sec on Fri Jul 5 18:48:48 2002=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Closing --> Closed=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: bundle: Terminate=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: CCP: deflink: State change = Stopped --> Closed=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: CCP: deflink: State change = Closed --> Initial=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: LayerDown=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: = SendTerminateReq(180) state =3D Opened=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: State change = Opened --> Closing=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: open -> lcp=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Closed --> Initial=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: = RecvTerminateAck(180) state =3D Closing=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: LayerFinish=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closing --> Closed=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Initial=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: lcp -> logout = Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: logout -> = hangup=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: Connect time: = 228 secs: 6795 octets in, 2567 octets out=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: : 1079551 = packets in, 231625 packets out=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: total 41 bytes/sec, = peak 840 bytes/sec on Fri Jul 5 18:48:48 2002=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: deflink: hangup -> = closed=20 Jul 5 18:48:48 maxigate ppp[34607]: tun0: Phase: bundle: Dead=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Command: /var/run/internet: = quit=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection dropped.=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Command: /var/run/internet: = set timeout 180=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Command: /var/run/internet: = dial=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: bundle: Establish=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: deflink: closed -> = opening=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: deflink: Connected!=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: deflink: opening -> = dial=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Phone: 0860007249=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: deflink: Dial attempt 1 = of 1=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection closed.=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Send: AT^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Received: AT^M^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Send: ATE1Q0^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Received: ATE1Q0^M^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 6 06:30:01 maxigate ppp[34607]: tun0: Chat: Send: = ATx1DT0860007249^M=20 Jul 6 06:30:03 maxigate ppp[34607]: tun0: Chat: Expect(40): CONNECT=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Chat: Expect timeout=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Warning: Chat script failed=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: dial -> = hangup=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: Disconnected! = Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: Connect time: = 43 secs: 0 octets in, 0 octets out=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: : 1079551 = packets in, 231625 packets out=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: total 0 bytes/sec, = peak 0 bytes/sec on Sat Jul 6 06:30:44 2002=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: deflink: hangup -> = closed=20 Jul 6 06:30:44 maxigate ppp[34607]: tun0: Phase: bundle: Dead=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = quit=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection dropped.=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: Connected to local = client.=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = set timeout 180=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: = dial=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: bundle: Establish=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: deflink: closed -> = opening=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: deflink: Connected!=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: deflink: opening -> = dial=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Phone: 0860007249=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: deflink: Dial attempt 1 = of 1=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: = Client connection closed.=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Send: AT^M=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Received: = ATx1DT0860007249^MAT^M^M=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Send: ATE1Q0^M=20 Jul 6 08:30:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK=20 Jul 6 08:30:01 maxigate ppp[34607]: tun0: Chat: Received: ATE1Q0^M^M=20 Jul 6 08:30:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M=20 Jul 6 08:30:01 maxigate ppp[34607]: tun0: Chat: Send: = ATx1DT0860007249^M=20 Jul 6 08:30:03 maxigate ppp[34607]: tun0: Chat: Expect(40): CONNECT=20 Jul 6 08:30:22 maxigate ppp[34607]: tun0: Chat: Received: = ATx1DT0860007249^M^M=20 Jul 6 08:30:22 maxigate ppp[34607]: tun0: Chat: Received: CONNECT = 33600/ARQ/V34/LAPM/V42BIS^M=20 Jul 6 08:30:22 maxigate ppp[34607]: tun0: Phase: deflink: dial -> = carrier=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: Phase: deflink: /dev/cuaa0: = CD detected=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: Phase: deflink: carrier -> = login=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: Phase: deflink: login -> lcp=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: LCP: FSM: Using "deflink" as = a transport=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Initial --> Closed=20 Jul 6 08:30:23 maxigate ppp[34607]: tun0: LCP: deflink: State change = Closed --> Stopped=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: deflink: LayerStart=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(181) state =3D Stopped=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x0cd05494=20 Jul 6 08:30:24 maxigate ppp[34607]: tun0: LCP: deflink: State change = Stopped --> Req-Sent=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigReq(204) state =3D Req-Sent=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x5bc3012a=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigAck(204) state =3D Req-Sent=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x5bc3012a=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:27 maxigate ppp[34607]: tun0: LCP: deflink: State change = Req-Sent --> Ack-Sent=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(181) state =3D Ack-Sent=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 6 08:30:28 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x0cd05494=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigReq(181) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x00000000=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: MRU[4] 1500=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x0cd05494=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigReq(205) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x5bc310bd=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = SendConfigAck(205) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACCMAP[6] 0x000a0000=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: AUTHPROTO[4] 0xc023 = (PAP)=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: MAGICNUM[6] 0x5bc310bd=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: PROTOCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: ACFCOMP[2]=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvConfigAck(181) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: State change = Ack-Sent --> Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: LayerUp=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: Sending ident magic = 0cd05494 text user-ppp 2.3 (built Apr 26 2001)=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: SendIdent(182) = state =3D Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: bundle: Authenticate=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: deflink: his =3D PAP, = mine =3D none=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: Pap Output: itec79 = ********=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: Pap Input: SUCCESS ()=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: Using trigger address = 0.0.0.0=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: FSM: Using "deflink" as = a transport=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Initial --> Closed=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: LayerStart.=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: MPPE: Not usable without = CHAP81=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: = SendConfigReq(1) state =3D Closed=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: DEFLATE[4] win 15=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: PRED1[2] =20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Closed --> Req-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: deflink: lcp -> open=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Phase: bundle: Network=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: FSM: Using "deflink" as = a transport=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Initial --> Closed=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: LayerStart.=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(107) state =3D Closed=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] 0.0.0.0=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: COMPPROTO[6] 16 VJ = slots with slot compression=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Closed --> Req-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigReq(204) state =3D Req-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.254=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigAck(204) state =3D Req-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.254=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Req-Sent --> Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: = RecvProtocolRej(206) state =3D Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: -- Protocol = 0x80fd (Compression Control Protocol) was rejected!=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: CCP: deflink: State change = Req-Sent --> Stopped=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigRej(107) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: Sending ident magic = 0cd05494 text user-ppp 2.3 (built Apr 26 2001)=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: LCP: deflink: SendIdent(183) = state =3D Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: COMPPROTO[6] 16 VJ = slots with slot compression=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(108) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] 0.0.0.0=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigNak(108) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.26=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] changing = address: 0.0.0.0 --> 155.239.150.26=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = SendConfigReq(109) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: IPADDR[6] = 155.239.150.26=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: PRIDNS[6] = 196.25.240.94=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: SECDNS[6] 196.25.1.9=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: = RecvConfigAck(109) state =3D Ack-Sent=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: State change = Ack-Sent --> Opened=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: deflink: LayerUp.=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: IPCP: myaddr 155.239.150.26 = hisaddr =3D 155.239.150.254=20 Jul 6 08:30:31 maxigate ppp[34607]: tun0: Command: maxigate: !bg = /usr/local/sys/linkup=20 Jul 6 08:31:32 maxigate ppp[34607]: tun0: Phase: deflink: HDLC errors = -> FCS: 2, ADDR: 0, COMD: 0, PROTO: 0=20 ------=_NextPart_000_000E_01C25029.FA869380-- From alan.gauld@bt.com Fri Aug 30 12:49:12 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 30 Aug 2002 12:49:12 +0100 Subject: [Tutor] importing variable contents, and variable naming prob lms Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C8BA@mbtlipnt02.btlabs.bt.co.uk> >>> can i make a variable named the same as the contents of 'item'?? You can but its nearly always a bad idea. Usually you woyuld be better creating a dictionary storing your 'variables' by name. vars = {} items = ['foo','bar','baz'] for item in items: vars[item] = ord(item[0]) for item in items: print vars[item] >>> 'lion'. any ideas guys?? I could never do this in C, >>> maybe python is different > I believe you want to use exec. > item = 'lion' > exec ("%s = 'foo'" % item) You can do it but it's risky - too easy to accidentally get name collisions etc. Also running exec is risky from a security point of view: item = 'rm -rf /' # load this from someplace... exec(item) # oops!! Alan g. Author of the 'Learning to Program' web site http://www.freenetpages.co.uk/hp/alan.gauld From erikprice@mac.com Fri Aug 30 13:13:20 2002 From: erikprice@mac.com (Erik Price) Date: Fri, 30 Aug 2002 08:13:20 -0400 Subject: [Tutor] Reading and Writing In-Reply-To: <20020830105412.GE25019@micromuse.com> Message-ID: On Friday, August 30, 2002, at 06:54 AM, Ibraheem Umaru-Mohammed wrote: > # match a filename that matches the following regular expression: > # \d = a single digit [0-9] > # \w+ = at least one word character [a-zA-Z] > # \d = a single digit [0-9] > # .htm = a literal > pattern = "\d\w+\d.htm" > for filename in os.listdir(html_directory): > # if we have a match, print the matching string. > m = re.match(pattern, filename) > if m: print repr(m.group(0)) Oh, I see. You don't have to invoke "glob" at all, you can just do a string test. Great! Thanks, Ibz. (BTW I think that you need to escape your literal dot, otherwise it gets parsed as "any character" -- but then this is just an example so who cares.) Since I was just learning about list comprehensions in another thread, I think I see where one can be used here: pattern = "\d\w+\d\.htm" matches = [ m for filename in os.listdir(html_directory) if re.match(pattern, filename) ] for m in matches: print repr(m.group(0)) But I think your code is still better because it doesn't use two separate for loops (mine has one in the LC and another to do the printing). It is just a mental exercise. Erik [You can't use LCs to do things like "print", right? It just does a kind of elaborate list assignment if I understand correctly.] -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From alan.gauld@bt.com Fri Aug 30 13:13:19 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 30 Aug 2002 13:13:19 +0100 Subject: [Tutor] please help Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C8BB@mbtlipnt02.btlabs.bt.co.uk> > This is what I have 'not great but on my way" > import string > def getStuff(file): > for line in pppfile: Where is pppfile defined? If its really a file you can't just do "for line in" you need to read it into a sequence first - usually a list. pppfile = file.readlines() for line in pppfile: etc... However ppp file is now a bad name since its not really a file its a list so ppplist mifght be better.... > closeline = 0 Now you set the same variables to zero for each line. You only want to initialise themmonce - outside the loop. > error.count = 0 Where are error, second etc defined? > if find("IPCP", line) > 0 > connectline = split(line) You need a colon at the end of the if... You only imported the name 'string' so you need to use string.find(), string.split() etc > continue You don't need the continue because the if statement isn't part of the loop(check the indentation level). If it was you still don't need continue because the loop will automatically continue at the end - thats what loops do! > if find("ERROR", line) > 0 > error.count = error.count + 1 > continue I assume all of these if statements should be inside the loop? They aren't at the moment... Rather than using if/continue,if/continue you would be better to use the if/elif structure: if string.find(xxxx) > 0: # do something elif string.find(yyyy) > 0: # do another elif string.find(zzzz) > 0: # again else: # handle unexpected lines here.... > print connectline[1] "" connectline[2] You need commas to separate the items to be printed print connectline[1], "", connectline[2] > print close Not sure what this is supposed to do? close is a builtin function...? > print summary Similarly where do you define summary? Try starting small and just open the file, then go through it and print out the lines containing the interesting bits. ( How would I convert something like: abc =3D ["abcdef"] into abc =3D "abcdef" What I'm actually trying to do is convert a file.readlines() into a single string and then .split(" "). Is this possible? I've tried every kind of for loop I can think of to make this work, but I can't figure it out. Thank you, -- Kyle From iumarumo@eidosnet.co.uk Fri Aug 30 13:27:26 2002 From: iumarumo@eidosnet.co.uk (Ibraheem Umaru-Mohammed) Date: Fri, 30 Aug 2002 13:27:26 +0100 Subject: [Tutor] Reading and Writing In-Reply-To: References: <20020830105412.GE25019@micromuse.com> Message-ID: <20020830122726.GI25019@micromuse.com> ["Erik Price"="Erik"] Erik >> On Friday, August 30, 2002, at 06:54 AM, Ibraheem Umaru-Mohammed wrote: Erik >> Erik >> ># match a filename that matches the following regular expression: Erik >> ># \d = a single digit [0-9] Erik >> ># \w+ = at least one word character [a-zA-Z] Erik >> ># \d = a single digit [0-9] Erik >> ># .htm = a literal Erik >> >pattern = "\d\w+\d.htm" Erik >> >for filename in os.listdir(html_directory): Erik >> > # if we have a match, print the matching string. Erik >> > m = re.match(pattern, filename) Erik >> > if m: print repr(m.group(0)) Erik >> Erik >> Oh, I see. You don't have to invoke "glob" at all, you can just do a Erik >> string test. Great! Thanks, Ibz. Erik >> Erik >> (BTW I think that you need to escape your literal dot, otherwise it Erik >> gets parsed as "any character" -- but then this is just an example so Erik >> who cares.) Yeah. Your right. Erik >> Erik >> Since I was just learning about list comprehensions in another thread, Erik >> I think I see where one can be used here: Erik >> Erik >> Erik >> pattern = "\d\w+\d\.htm" Erik >> matches = [ m for filename in os.listdir(html_directory) if Erik >> re.match(pattern, filename) ] Erik >> for m in matches: print repr(m.group(0)) Erik >> Erik >> Erik >> But I think your code is still better because it doesn't use two Erik >> separate for loops (mine has one in the LC and another to do the Erik >> printing). It is just a mental exercise. Erik >> This list comprehension above won't work as "m" is not defined. You will get a NameError exception. It will only return a file name if the regular expression is matched, it doesn't return the actual match object instance. Erik >> Erik >> Erik >> Erik Erik >> Erik >> [You can't use LCs to do things like "print", right? It just does a Erik >> kind of elaborate list assignment if I understand correctly.] Erik >> Nope, because print is statement. Elements of a list must be expressions. You could do something like the following: #!/usr/bin/env python import os import re text_directory = "/home/ibraheem/python_scripts/txt/" html_directory = "/home/ibraheem/python_scripts/html/" for item in [ filename for filename in os.listdir(html_directory) if re.match("\d\w+\d\.htm", filename) ]: print item If you really wanted to... Kindest regards, --ibz. -- Ibraheem Umaru-Mohammed "ibz" umarumohammed (at) btinternet (dot) com From erikprice@mac.com Fri Aug 30 13:44:18 2002 From: erikprice@mac.com (Erik Price) Date: Fri, 30 Aug 2002 08:44:18 -0400 Subject: [Tutor] Reading and Writing In-Reply-To: <20020830122726.GI25019@micromuse.com> Message-ID: <333D28FC-BC16-11D6-9064-00039351FE6A@mac.com> On Friday, August 30, 2002, at 08:27 AM, Ibraheem Umaru-Mohammed wrote: > Erik >> matches = [ m for filename in os.listdir(html_directory) if > Erik >> re.match(pattern, filename) ] > Erik >> for m in matches: print repr(m.group(0)) > Erik >> > Erik >> > Erik >> But I think your code is still better because it doesn't use > two > Erik >> separate for loops (mine has one in the LC and another to do > the > Erik >> printing). It is just a mental exercise. > Erik >> > > This list comprehension above won't work as "m" is not defined. You > will get a NameError > exception. It will only return a file name if the regular expression is > matched, it doesn't return the actual match object instance. Thanks for clarifying this, I mistakenly used "m" instead of "filename". > for item in [ filename for filename in os.listdir(html_directory) if > re.match("\d\w+\d\.htm", filename) ]: > print item I didn't even think of that -- spares the trouble of temporarily assigning to an identifier, and does the exact same thing. I'm liking list comprehensions more and more, though I have to say that their pithiness reminds me of Perl. Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From erikprice@mac.com Fri Aug 30 13:50:28 2002 From: erikprice@mac.com (Erik Price) Date: Fri, 30 Aug 2002 08:50:28 -0400 Subject: [Tutor] convert array into string In-Reply-To: <20020830122555.5AABF93772@server2.fastmail.fm> Message-ID: <0F4EAFDA-BC17-11D6-9064-00039351FE6A@mac.com> On Friday, August 30, 2002, at 12:25 PM, Kyle Babich wrote: > How would I convert something like: > abc = ["abcdef"] > into > abc = "abcdef" > > What I'm actually trying to do is convert a file.readlines() into a > single string and then .split(" "). Is this possible? I've tried > every kind of for loop I can think of to make this work, but I can't > figure it out. Well, file.readlines() takes a file and reads each line into a separate string, then puts each string into a list. So you get a list of strings. Two ways to put that back into one giant string are 1) join() method found in the string module - glues a sequence together using whatever string you specify 2) don't use file.readlines() - just use f.read(), which reads the whole file into a string You can split(" ") afterward. I don't recommend the first option because it's redundant -- use the second one. Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From iumarumo@eidosnet.co.uk Fri Aug 30 13:39:48 2002 From: iumarumo@eidosnet.co.uk (Ibraheem Umaru-Mohammed) Date: Fri, 30 Aug 2002 13:39:48 +0100 Subject: [Tutor] convert array into string In-Reply-To: <20020830122555.5AABF93772@server2.fastmail.fm> References: <20020830122555.5AABF93772@server2.fastmail.fm> Message-ID: <20020830123948.GJ25019@micromuse.com> ["Kyle Babich"="Kyle"] Kyle >> How would I convert something like: Kyle >> abc = ["abcdef"] Kyle >> into Kyle >> abc = "abcdef" Kyle >> Assuming you have stored your string in a list, you can just index into the list as follows: abc = ["abcdef"] abc = abc[0] But you may also want to use the "str" function, but in this case it is unnecessary. Kyle >> What I'm actually trying to do is convert a file.readlines() into a Kyle >> single string and then .split(" "). Is this possible? I've tried Kyle >> every kind of for loop I can think of to make this work, but I can't Kyle >> figure it out. Kyle >> You can use the read() method instead of readlines() to read everything into a variable, and then apply the split() method on the result. e.g abc = open("/path/to/foo").read().split() then you can just index into the list referenced by abc, e.g abc[0] for the first line, abc[1] for the second line etc etc. Kyle >> Thank you, Kyle >> -- Kyle >> Kyle Kyle >> Kindest regards, --ibz. -- Ibraheem Umaru-Mohammed "ibz" umarumohammed (at) btinternet (dot) com From Robert.Simons@us.pilkington.com Fri Aug 30 16:23:57 2002 From: Robert.Simons@us.pilkington.com (Robert.Simons@us.pilkington.com) Date: Fri, 30 Aug 2002 11:23:57 -0400 Subject: [Tutor] Getting Python to work... Message-ID: <8B870C773468D6119B4000805F9FCEF107F145@lofgw> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C25039.4280F220 Content-Type: text/plain; charset="iso-8859-1" Hi to all you programming gurus... I have downloaded to a Win98 box: Python 2.2.1 (said most stable) WxPython 2.2.3.1 - python.exe Boa.constructor 0.1.0 -alpha.win32.exe All the downloads were "runnable" so I ran them. Python 2.2.1 looks like it ran and installed (did not require a reboot. Hmmmmm) WxPython, finally required a reboot. Placed the pertinate files inside the python22 folder then it did a proper install I think. Ran the boa and it expanded into the wxPython tools sub directory. I cannot run the Boa program... I cannot get a 2.2.1 python window to run an 1.5 version program. I am using odbc and the wxPython should register it, but the simple program I am trying to run claims no knowledge of the ODBC. I attach the code from the project maybe you can tell me exactly what I am doing wrong, but feel free to help me fininsh? The installation. TIA <> Rob ____________________________________________________________________________ This message and any attachments are confidential, for the exclusive use of the addressee and may be legally privileged. Any other distribution, use or reproduction is unauthorized and prohibited. If you have received this message in error, please notify the sender immediately and delete the message from your system. Visit our internet site at http://www.pilkington.com ------_=_NextPart_000_01C25039.4280F220 Content-Type: application/octet-stream; name="pgs.py" Content-Disposition: attachment; filename="pgs.py" import ODBC.Windows db = ODBC.Windows.Connect('PGS','sa','') c = db.cursor() c.execute('select count(*) from loglongtermhistory') c.fetchone() fsc.tables(None,None,None,None) ODBC.print_resultset(c) c.close() db.close() ------_=_NextPart_000_01C25039.4280F220-- From dyoo@hkn.eecs.berkeley.edu Fri Aug 30 16:35:37 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Fri, 30 Aug 2002 08:35:37 -0700 (PDT) Subject: [Tutor] convert array into string In-Reply-To: <20020830122555.5AABF93772@server2.fastmail.fm> Message-ID: On Fri, 30 Aug 2002, Kyle Babich wrote: > How would I convert something like: > abc = ["abcdef"] > into > abc = "abcdef" > > What I'm actually trying to do is convert a file.readlines() into a > single string and then .split(" "). Is this possible? Yes --- it sounds like you'd like to join all the strings in your list together. The string.join() function is especially good for this: ### >>> sentence = ["there", "is", "no", "spoon"] >>> string.join(sentence, " ") 'there is no spoon' ### In Python 2, the joining functionality was migrated directly into the string class itself --- join() is now a method that all strings have: ### >>> ' '.join(sentence) 'there is no spoon' >>> '+'.join(sentence) 'there+is+no+spoon' ### But if the source of your data is a file, there's a way of pulling the whole file into a string, without going through this intermediate string join step: ### story_file = open("mystory.txt") contents = story_file.read() ### The read() method will, by default, suck everything out of a file, and is probably a better way of approaching this problem than the readlines()/join(). Good luck! From kyle@sent.com Fri Aug 30 17:50:54 2002 From: kyle@sent.com (Kyle Babich) Date: Fri, 30 Aug 2002 16:50:54 UT Subject: [Tutor] text module Message-ID: <20020830165054.E0AA19378A@server2.fastmail.fm> I've seen a few people write to this list with questions on how to count words, lines, etc. from a file. So based on this last night I started to write a module (called it the text module, any better ideas?) that will do all of this. Before I got to far into this I thought I would ask people opinions on this idea and what I have so far. First of all I would appeciate it if you could test what I have so far. Here is the source (text.py): #################### import string def WordCount(location): subj =3D file(location, "r") body =3D subj.readlines() subj.close() items =3D [] words =3D 0 for each in body: items.append(string.strip(each)) =20 items =3D string.join(items, " ") =20 for each in items.split(" "): words =3D words + 1 print words def CharCount(location, spaces): subj =3D file(location, "r") body =3D subj.readlines() subj.close() items =3D [] chars =3D 0 if spaces =3D=3D 0: for each in body: items.append(string.strip(each)) items =3D string.join(items, " ") items =3D string.replace(items, " ", "") for each in items: chars =3D chars + 1 print chars elif spaces =3D=3D "0": for each in body: items.append(string.strip(each)) items =3D string.join(items, " ") items =3D string.replace(items, " ", "") for each in items: chars =3D chars + 1 print chars elif spaces =3D=3D 1: for each in body: items.append(string.strip(each)) items =3D string.join(items, " ") for each in items: chars =3D chars + 1 print chars elif spaces =3D=3D "1": for each in body: items.append(string.strip(each)) items =3D string.join(items, " ") for each in items: chars =3D chars + 1 print chars def LineCount(location): subj =3D file(location, "r") body =3D subj.readlines() subj.close() lines =3D 0 for each in body: lines =3D lines + 1 print lines #################### What it does: WordCount(location) counts all words (seperated by spaces). It works like WordCount("c:\\windows\\desktop\\testfile.txt") and returns a number. LineCount(location) works the same way and counts lines seperated with a \n. CharCount(location, spaces) works in a similar way, but if you enter a 0 for spaces \n and spaces will not be counts as characters and if you enter 1 they will be. Note: the string module is required to run WordCount() and CharCount() Any suugestions, ideas? Do you think that a module like this (assuming I continue development on it, I mean it's not even 24 hours old) will ever get anywhere? Thank you, -- Kyle From alan.gauld@bt.com Fri Aug 30 17:41:49 2002 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 30 Aug 2002 17:41:49 +0100 Subject: [Tutor] convert array into string Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C8C3@mbtlipnt02.btlabs.bt.co.uk> > How would I convert something like: > abc = ["abcdef"] > into > abc = "abcdef" abc = abc[0] I think the str() function works on lists too. > What I'm actually trying to do is convert a file.readlines() into a > single string and then .split(" "). Is this possible? Use read() instead - it returns onre enormous string... Alan G. From lumbricus@gmx.net Fri Aug 30 18:18:22 2002 From: lumbricus@gmx.net (lumbricus@gmx.net) Date: Fri, 30 Aug 2002 19:18:22 +0200 (MEST) Subject: [Tutor] text module References: <20020830165054.E0AA19378A@server2.fastmail.fm> Message-ID: <31095.1030727902@www11.gmx.net> Hi! > (called it the text module, any better > ideas?) Yes - wc.py, because it does just, what the *NIX wc(1) (word count) command does :-) > that will do all of this. Before I got to far into this I > thought I would ask people opinions on this idea and what I have so > far. > > First of all I would appeciate it if you could test what I have so far. > Here is the source (text.py): [ snip ] > def LineCount(location): > subj = file(location, "r") > body = subj.readlines() > subj.close() > > lines = 0 > for each in body: > lines = lines + 1 > print lines Why not def LineCount(location): subj=file(location, "r") body=subj.readlines() subj.close() return len(body) [ snip ] HTH, HAND J"o! -- -- Wir beschliessen etwas, stellen das dann in den Raum und warten dann einige Zeit ab, was passiert. Wenn es dann kein grosses Geschrei gibt und keine Aufstaende, weil die meisten gar nicht begreifen, was da beschlossen wurde, dann machen wir weiter - Schritt fuer Schritt, bis es kein Zurueck mehr gibt. -- J-C Juncker GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From kyle@sent.com Fri Aug 30 18:27:24 2002 From: kyle@sent.com (Kyle Babich) Date: Fri, 30 Aug 2002 17:27:24 UT Subject: [Tutor] text module Message-ID: <20020830172724.480DB937D1@server2.fastmail.fm> On Fri, 30 Aug 2002 19:18:22 +0200 (MEST), lumbricus@gmx.net said: > Hi! >=20 > > (called it the text module, any better > > ideas?)=20 >=20 > Yes - wc.py, because it does just, what the *NIX wc(1) (word count) > command does :-) >=20 > > that will do all of this. Before I got to far into this I > > thought I would ask people opinions on this idea and what I have so > > far. > >=20 > > First of all I would appeciate it if you could test what I have so fa= r. > > Here is the source (text.py): >=20 > [ snip ] > =20 > > def LineCount(location): > > subj =3D file(location, "r") > > body =3D subj.readlines() > > subj.close() > >=20 > > lines =3D 0 > > for each in body: > > lines =3D lines + 1 > > print lines >=20 > Why not > def LineCount(location): > subj=3Dfile(location, "r") > body=3Dsubj.readlines() > subj.close() > return len(body) Because I always make more work for myself than I need too. :) I just changed it to the len(body) way. I also fully commented it and changed all of the prints to returns. I think I will rename it to wc or something similar soon also. >=20 > [ snip ] >=20 > HTH, HAND > J"o! >=20 > --=20 >=20 > --=20 > Wir beschliessen etwas, stellen das dann in > den Raum und warten dann einige Zeit ab, was > passiert. Wenn es dann kein grosses Geschrei > gibt und keine Aufstaende, weil die meisten > gar nicht begreifen, was da beschlossen > wurde, dann machen wir weiter - Schritt fuer > Schritt, bis es kein Zurueck mehr gibt.=20 > -- J-C Juncker >=20 > GMX - Die Kommunikationsplattform im Internet. > http://www.gmx.net >=20 >=20 > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor >=20 -- Kyle From cyberdiction@hotmail.com Fri Aug 30 19:47:39 2002 From: cyberdiction@hotmail.com (Stephen Harris) Date: Fri, 30 Aug 2002 11:47:39 -0700 Subject: [Tutor] Search and Replace Browser Plugin Message-ID: This is a multi-part message in MIME format. ------=_NextPart_000_001E_01C2501B.0AA4B260 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hello, I have been thinking about a project prompted by a thread on the python usenet group. It is a plugin which would let you search an online webpage or perhaps .pdf also. Something a little more sophisticated than "Find". SR32 makes a window with all occasions of the searched term and a few surrounding words for context. The problem with this is that the webpage would have to be saved to a default file and the search utility set to the same default directory as the webpage. I have looked at ht://Dig which seems to powerful and IBabble which is written in Java and is described as a browser helper app. But apparenly works with just unicode or SGML. For Linux I saw kfilereplace but I dont know if this could be tied to the browser. Perhaps in Mozilla the find utility could just be expanded? Is Python the right tool for this? I'm thinking about a graphical R.E. tool that can search webpages and webpages displaying .pdf without performing an indexing operation. This would be my first project so maybe it is more difficult than I realize. Searching text in postscript seems to take a long time. Regards, Stephen ------=_NextPart_000_001E_01C2501B.0AA4B260 Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
Hello,
 
I have been thinking about a project = prompted by a=20 thread
on the python usenet group. It is a = plugin which=20 would
let you search an online webpage or = perhaps .pdf=20 also.
 
Something a little more sophisticated = than "Find".=20 SR32
makes a window with all occasions of = the searched=20 term
and a few surrounding words for = context. The=20 problem
with this is that the webpage would = have to be=20 saved to
a default file and the search utility = set to the=20 same default
directory as the webpage.
 
I have looked at ht://Dig  which seems to powerful and
IBabble which is written in Java and is described as
a browser helper app. But apparenly works with
just unicode or SGML. For Linux I saw kfilereplace
but I dont know if this could be tied to the browser.
 
Perhaps in Mozilla the find utility = could just be=20 expanded?
Is Python the right tool for this? I'm = thinking=20 about a graphical
R.E. tool that can search webpages and = webpages=20 displaying
.pdf without performing an indexing = operation. This=20 would be
my first project so maybe it is more = difficult than=20 I realize.
Searching text in postscript seems to = take a long=20 time.
 
Regards,
Stephen
 
------=_NextPart_000_001E_01C2501B.0AA4B260-- From fgranger@altern.org Fri Aug 30 21:30:42 2002 From: fgranger@altern.org (Francois Granger) Date: Fri, 30 Aug 2002 22:30:42 +0200 Subject: [Tutor] text module In-Reply-To: <20020830165054.E0AA19378A@server2.fastmail.fm> References: <20020830165054.E0AA19378A@server2.fastmail.fm> Message-ID: --============_-1181382861==_============ Content-Type: text/plain; charset="us-ascii" ; format="flowed" At 16:50 +0000 30/08/02, in message [Tutor] text module, Kyle Babich wrote: > Before I got to far into this I >thought I would ask people opinions on this idea and what I have so >far. Nice >#################### >import string import string, sys # needed for command line arguments later >def CharCount(location, spaces): def CharCount(location, spaces = 1): # give it a default value.... >def LineCount(location): > subj = file(location, "r") > body = subj.readlines() > subj.close() > > lines = 0 > for each in body: > lines = lines + 1 > print lines def main(): for file in sys.argv[1:]: print 'File : ', file print 'Char count : ', CharCount(file) print 'Word count : ', WordCount(file) print 'Line count : ', LineCount(file) if __name__ == '__main__': """Allow for command line argument. handling the argument for space handling is not included. """ main() HTH file enclosed... --============_-1181382861==_============ Content-Id: Content-Type: multipart/appledouble; boundary="============_-1181382861==_D============" --============_-1181382861==_D============ Content-Transfer-Encoding: base64 Content-Type: application/applefile; name="%wc1.py" Content-Disposition: attachment; filename="%wc1.py" ; modification-date="Fri, 30 Aug 2002 22:30:27 +0200" AAUWBwACAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAADAAAASgAAAAYAAAAJAAAAUAAAACAA AAAIAAAAcAAAABAAAAACAAAAgAAAAdZ3YzEucHlURVhUUGVwcgEAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAUCroMFAq6DS20MAAUCr1MAAAEAAAABkAAAAJAAAABGAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAAJTW9uYWNvAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAEALkADALEAh4AuQAMAsQCHrmVoawAAAaLAAAH9gAABFkB AAAAAEBQeXRob24AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAAMBAAFwAAAAUAAA AAAAAAaLAAAAAAAAB/YACalgAAABAAAAAZAAAACQAAAARlNPUlQEGgCAABwARgABTVBT UgAAABJQcHJzAAAAHgPt//8AAAAAAx74VACA//8AAABMAx//GA== --============_-1181382861==_D============ Content-Type: application/octet-stream; name="wc1.py" Content-Disposition: attachment; filename="wc1.py" Content-Transfer-Encoding: base64 aW1wb3J0IHN0cmluZywgc3lzICMgbmVlZGVkIGZvciBjb21tYW5kIGxpbmUNCg0KZGVm IFdvcmRDb3VudChsb2NhdGlvbik6DQogICAgc3ViaiA9IGZpbGUobG9jYXRpb24sICJy IikNCiAgICBib2R5ID0gc3Viai5yZWFkbGluZXMoKQ0KICAgIHN1YmouY2xvc2UoKQ0K DQogICAgaXRlbXMgPSBbXQ0KICAgIHdvcmRzID0gMA0KDQogICAgZm9yIGVhY2ggaW4g Ym9keToNCiAgICAgICAgaXRlbXMuYXBwZW5kKHN0cmluZy5zdHJpcChlYWNoKSkNCiAg ICAgICAgDQogICAgaXRlbXMgPSBzdHJpbmcuam9pbihpdGVtcywgIiAiKQ0KICAgIA0K ICAgIGZvciBlYWNoIGluIGl0ZW1zLnNwbGl0KCIgIik6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AgICAg ICAgICAgaXRlbXMuYXBwZW5kKHN0cmluZy5zdHJpcChlYWNoKSkNCg0KICAgICAgICBp dGVtcyA9IHN0cmluZy5qb2luKGl0ZW1zLCAiICIpDQoNCiAgICAgICAgZm9yIGVhY2gg aW4gaXRlbXM6DQogICAgICAgICAgICBjaGFycyA9IGNoYXJzICsgMQ0KDQogICAgICAg IHByaW50IGNoYXJzDQoNCiAgICBlbGlmIHNwYWNlcyA9PSAiMSI6DQogICAgICAgIGZv ciBlYWNoIGluIGJvZHk6DQogICAgICAgICAgICBpdGVtcy5hcHBlbmQoc3RyaW5nLnN0 cmlwKGVhY2gpKQ0KDQogICAgICAgIGl0ZW1zID0gc3RyaW5nLmpvaW4oaXRlbXMsICIg IikNCg0KICAgICAgICBmb3IgZWFjaCBpbiBpdGVtczoNCiAgICAgICAgICAgIGNoYXJz ID0gY2hhcnMgKyAxDQoNCiAgICAgICAgcHJpbnQgY2hhcnMNCg0KZGVmIExpbmVDb3Vu dChsb2NhdGlvbik6DQogICAgc3ViaiA9IGZpbGUobG9jYXRpb24sICJyIikNCiAgICBi b2R5ID0gc3Viai5yZWFkbGluZXMoKQ0KICAgIHN1YmouY2xvc2UoKQ0KDQogICAgbGlu ZXMgPSAwDQogICAgZm9yIGVhY2ggaW4gYm9keToNCiAgICAgICAgbGluZXMgPSBsaW5l cyArIDENCiAgICBwcmludCBsaW5lcw0KDQpkZWYgbWFpbigpOg0KICAgIGZvciBmaWxl IGluIHN5cy5hcmd2WzE6XToNCiAgICAgICAgcHJpbnQgJ0ZpbGUgOiAnLCBmaWxlDQog ICAgICAgIHByaW50ICdDaGFyIGNvdW50IDogJywgQ2hhckNvdW50KGZpbGUpDQogICAg ICAgIHByaW50ICdXb3JkIGNvdW50IDogJywgV29yZENvdW50KGZpbGUpDQogICAgICAg IHByaW50ICdMaW5lIGNvdW50IDogJywgTGluZUNvdW50KGZpbGUpDQoNCmlmIF9fbmFt ZV9fID09ICdfX21haW5fXyc6DQogICAgIiIiQWxsb3cgZm9yIGNvbW1hbmQgbGluZSBh cmd1bWVudC4NCiAgICBoYW5kbGluZyB0aGUgYXJndW1lbnQgZm9yIHNwYWNlIGhhbmRs aW5nIGlzIG5vdCBpbmNsdWRlZC4NCiAgICAiIiINCiAgICBtYWluKCkNCg== --============_-1181382861==_D============-- --============_-1181382861==_============-- From scot@possum.in-berlin.de Sat Aug 31 00:41:30 2002 From: scot@possum.in-berlin.de (Scot W. Stevenson) Date: Sat, 31 Aug 2002 01:41:30 +0200 Subject: [Tutor] text module In-Reply-To: <20020830165054.E0AA19378A@server2.fastmail.fm> References: <20020830165054.E0AA19378A@server2.fastmail.fm> Message-ID: <200208310141.30176.scot@possum.in-berlin.de> Hello Kyle, > started to write a module (called it the text module, any better > ideas?) I would agree with J"o that "wc.py" might be a better name, even though you might end up explaining to non-Unix-people that it doesn't involve toilet paper =8). > body = subj.readlines() This is okay if you know that the file is going to be small and you machine is big, but for large files on small machines, it could be a problem: readlines loads the whole file into memory in one big gulp. xreadlines was created in Python 2.1 (I think) to avoid this problem, but if you have Python 2.2 or later, the really cool thing to do is to use iterators and simply create a loop such as: for line in subj: (etc) which reads one line at a time as a string. You can get the number of characters in that line (with spaces) as len(line) and the number of spaces as line.count(" ") which, put together, should be a simpler way of calculating the number of characters. wordlist = line.split(" ") gives you the a list of words split by spaces, and the length of that list is therefore the number of words in the line. So to figure out everything in one loop at once, you could try (in Python 2.2 only): ======================================== def CountAll(location): nbr_lines = nbr_words = nbr_allchars = nbr_blackchars = 0 subj = file(location, 'r') for line in subj: nbr_lines = nbr_lines + 1 nbr_words = nbr_words + len(line.split(" ")) temp = len(line) nbr_allchars = nbr_allchars + temp nbr_blackchars = nbr_blackchars + temp - line.count(" ") subj.close() print nbr_lines, nbr_words, nbr_allchars, nbr_blackchars ========================================= which, of course, is not quite what you wanted to do...but you should be able to adapt it to your setup quite easily. Again, this will only work for Python 2.2, so if you have a different version, you are going to have to use xreadlines and such. Hope this helped, Y, Scot -- Scot W. Stevenson wrote me on Saturday, 31. Aug 2002 in Zepernick, Germany on his happy little Linux system that has been up for 1774 hours and has a CPU that is falling asleep at a system load of 0.30. From amd@atlas.ucpel.tche.br Sat Aug 31 00:44:06 2002 From: amd@atlas.ucpel.tche.br (=?ISO-8859-1?Q?Aur=E9lio_Magalh=E3es_Dias?=) Date: Fri, 30 Aug 2002 20:44:06 -0300 (BRT) Subject: [Tutor] Article !!! Message-ID: Hi list, Well I need to write down a simple article (3 pages, mo more than this) about exceptions in Python. Any references will be welcome, mainly pratical examples. Thanks in advance, Aur=E9lio. ----------------------------------------- Aur=E9lio Magalh=E3es Dias Ci=EAncia da Computa=E7=E3o UCPel - RS - Brasil ----------------------------------------- From amd@atlas.ucpel.tche.br Sat Aug 31 01:06:13 2002 From: amd@atlas.ucpel.tche.br (=?ISO-8859-1?Q?Aur=E9lio_Magalh=E3es_Dias?=) Date: Fri, 30 Aug 2002 21:06:13 -0300 (BRT) Subject: [Tutor] Article !!! In-Reply-To: <20020831001450.73006.qmail@web11701.mail.yahoo.com> Message-ID: Sorry, It is exceptions handling, in a very general view! ----------------------------------------- Aur=E9lio Magalh=E3es Dias Ci=EAncia da Computa=E7=E3o UCPel - RS - Brasil ----------------------------------------- On Fri, 30 Aug 2002, B. M. Ericsson wrote: > exceptions abound. > > =3D=3D=3D=3D=3D > www.geocities.com/bmericsson > > Check out my website, sign > the Guestbook, look around. > > __________________________________________________ > Do You Yahoo!? > Yahoo! Finance - Get real-time stock quotes > http://finance.yahoo.com > From kyle@sent.com Sat Aug 31 01:39:50 2002 From: kyle@sent.com (Kyle Babich) Date: Sat, 31 Aug 2002 00:39:50 UT Subject: [Tutor] text module Message-ID: <20020831003950.DAB2293782@server2.fastmail.fm> On Fri, 30 Aug 2002 22:30:42 +0200, "Francois Granger" said: > At 16:50 +0000 30/08/02, in message [Tutor] text module, Kyle Babich > wrote: > > Before I got to far into this I > >thought I would ask people opinions on this idea and what I have so > >far. >=20 > Nice >=20 > >#################### > >import string >=20 > import string, sys # needed for command line arguments later >=20 > >def CharCount(location, spaces): >=20 > def CharCount(location, spaces =3D 1): # give it a default value.... >=20 > >def LineCount(location): > > subj =3D file(location, "r") > > body =3D subj.readlines() > > subj.close() > > > > lines =3D 0 > > for each in body: > > lines =3D lines + 1 > > print lines >=20 >=20 > def main(): > for file in sys.argv[1:]: > print 'File : ', file > print 'Char count : ', CharCount(file) > print 'Word count : ', WordCount(file) > print 'Line count : ', LineCount(file) >=20 > if __name__ =3D=3D '__main__': > """Allow for command line argument. > handling the argument for space handling is not included. > """ > main() I added something similar: def main(): for file in sys.argv[1:]: print "File: ", file print "Word Count: ", WordCount(file) print "Character Count: ", CharCount(file) print "Line Count: ", LineCount(file), "\n" if __name__ =3D=3D "__main__": main() But the output is this: C:\Python22>c:\python22\python c:\python22\wc.py c:\windows\desktop\temp.txt File: c:\windows\desktop\temp.txt Word Count: 7 Character Count: 29 None Line Count: 5 Where is the None coming from though? >=20 > HTH >=20 > file enclosed... From emile@fenx.com Sat Aug 31 02:26:47 2002 From: emile@fenx.com (Emile van Sebille) Date: Fri, 30 Aug 2002 18:26:47 -0700 Subject: [Tutor] Re: the address is the information- say what? References: <3D6DAA2B.E904C88B@netzero.net> Message-ID: Kirk: > OK, we're getting metaphysical here. This mantra haunts me from reading > some stuff down at the public library. If indeed the address is the > information, could we not reverse the process, and by providing > information generate an address? > > 1. me > 2. here > 3. you > 4. there > 5. foo > 6. pizza > 7. snacks > 8. pepto bismol > > Plug in key 6, you get pizza. Plug in pizza, get 6? Well, not with a > dictionary, they can change placement at the interpreter's convince, but > a list or tuple can do it. I'm not sure what you'd do with it, but text string that can serve as labels/variable names are interned, allowing you to do: Python 2.1.3 (#35, Apr 8 2002, 17:47:50) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>> ii = 'spam' >>> id(ii) 8915248 >>> id('spam') 8915248 >>> You're on your own for 'pepto bismol' however... ;-) Emile van Sebille emile@fenx.com From emile@fenx.com Sat Aug 31 02:34:32 2002 From: emile@fenx.com (Emile van Sebille) Date: Fri, 30 Aug 2002 18:34:32 -0700 Subject: [Tutor] Re: Why lambda could be considered evil References: <200208290135.27475.scot@possum.in-berlin.de> <788B18B8-BB44-11D6-9CB7-00039351FE6A@mac.com> Message-ID: Erik > Can someone explain why the code imports both from * and from "__all__" > ? I've never seen the import __all__ before. (It looks like this: > > if engine == "sre": > # New unicode-aware engine > from sre import * > from sre import __all__ > It's because import * doesn't import labels that start with an underscore. Try the following: Python 2.1.3 (#35, Apr 8 2002, 17:47:50) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>> dir() ['__builtins__', '__doc__', '__name__'] >>> import os >>> os.__file__ 'C:\\Zope\\v2.5\\bin\\lib\\os.pyc' >>> from os import * >>> __file__ Traceback (most recent call last): File "", line 1, in ? NameError: name '__file__' is not defined >>> HTH, Emile van Sebille emile@fenx.com From shalehperry@attbi.com Sat Aug 31 03:13:57 2002 From: shalehperry@attbi.com (Sean 'Shaleh' Perry) Date: Fri, 30 Aug 2002 19:13:57 -0700 Subject: [Tutor] text module In-Reply-To: <20020831003950.DAB2293782@server2.fastmail.fm> References: <20020831003950.DAB2293782@server2.fastmail.fm> Message-ID: <200208301913.57196.shalehperry@attbi.com> On Friday 30 August 2002 17:39, Kyle Babich wrote: > > But the output is this: > C:\Python22>c:\python22\python c:\python22\wc.py > c:\windows\desktop\temp.txt > File: c:\windows\desktop\temp.txt > Word Count: 7 > Character Count: 29 > None > Line Count: 5 > > Where is the None coming from though? > one of the prints within char count it looks like. From yduppen@xs4all.nl Sat Aug 31 09:33:55 2002 From: yduppen@xs4all.nl (Yigal Duppen) Date: Sat, 31 Aug 2002 10:33:55 +0200 Subject: [Tutor] Article !!! In-Reply-To: References: Message-ID: <200208311033.55904.yduppen@xs4all.nl> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Saturday 31 August 2002 02:06, Aur=E9lio Magalh=E3es Dias wrote: > Sorry, It is exceptions handling, in a very general view! Don't know much about good references to Python exception handling. But what you _can_ do is read up on Java exceptions (there are many good=20 tutorials on exceptions and java and Python's exception semantics are=20 similar) and then remember that in Python: 1) try/except and try/finally are two separate constructs (as opposed to=20 Java's try/catch/finally) -- search the c.l.p. archives for a good=20 explanation on this and write about this in your article - there were som= e=20 pretty good posts on this subject some time ago. 2) exceptions _can_ be pure strings, although this is deprecated behaviou= r --=20 this might be in c.l.p. as well, although I never read about it By this time, your paper will probably have reached the 3 page limit. If you're really masochistic or into the more intricate depths of CS, goo= gle=20 on the combination of exceptions and continuations. Maybe read the articl= es=20 written about Stackless Python... HTH, YDD - --=20 http://www.xs4all.nl/~yduppen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9cH9zLsKMuCf5EdwRAlSsAKCZU/M/SphWR/cj2DCAK6VEH3C/xQCg1mhK 3JfmrazWFv3copf06ekWnc0=3D =3DLAzK -----END PGP SIGNATURE----- From erikprice@mac.com Sat Aug 31 13:36:18 2002 From: erikprice@mac.com (Erik Price) Date: Sat, 31 Aug 2002 08:36:18 -0400 Subject: Iterators (was: Re: [Tutor] text module) In-Reply-To: <200208310141.30176.scot@possum.in-berlin.de> Message-ID: <3F86314E-BCDE-11D6-9B69-00039351FE6A@mac.com> On Friday, August 30, 2002, at 07:41 PM, Scot W. Stevenson wrote: > This is okay if you know that the file is going to be small and you > machine > is big, but for large files on small machines, it could be a problem: > readlines loads the whole file into memory in one big gulp. xreadlines > was > created in Python 2.1 (I think) to avoid this problem, but if you have > Python 2.2 or later, the really cool thing to do is to use iterators > and > simply create a loop such as: > > for line in subj: > (etc) Not having any idea what iterators are, I went to the docs (http://python.org/doc/current/whatsnew/node4.html) and read about them. But as always I am not sure of everything. I understand the construction that Scot uses above, because the docs explain that file objects incorporate the __iter__() method, and "for" loops now act upon this method for all sequence objects (and file objects too). It's the first part of the explanation of iterators that I'm not totally clear on, the part that explains how you can incorporate your own iterators into your own class definitions. Is it that you specify an "__iter__()" method, and then you implement the code that would go about returning a "next" item each time the __iter__() method is called? How do you store the state of the object such that it knows which item to return next time the __iter__() method is called? Am I correct in assuming that you must implement the StopIterator exception yourself in the code for situations in which there are no more items to be iterated over? And finally, do you write a separate class definition for an iterator, and then have your original class definition use the iterator object, or is this something that can be entirely kept within the class definition for the object in question? It's a confusing document IMHO. I would appreciate any discussion and thoughts that anyone cares to contribute. Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From thomi@thomi.imail.net.nz Sat Aug 31 13:38:51 2002 From: thomi@thomi.imail.net.nz (Thomi Richards) Date: Sun, 1 Sep 2002 00:38:51 +1200 Subject: [Tutor] importing variable contents, and variable naming problms In-Reply-To: <20020830110629.GF25019@micromuse.com> References: <20020830195452.45774dff.thomi@thomi.imail.net.nz> <20020830110629.GF25019@micromuse.com> Message-ID: <20020901003851.51f85df6.thomi@thomi.imail.net.nz> Thanks! that's exactly what i was looking for.. -- The software required Win95 or better, so I installed Linux. Thomi Richards, thomi@imail.net.nz From magnus@thinkware.se Sat Aug 31 15:02:10 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Sat, 31 Aug 2002 16:02:10 +0200 Subject: [Tutor] Getting Python to work... In-Reply-To: <8B870C773468D6119B4000805F9FCEF107F145@lofgw> Message-ID: <5.1.0.14.0.20020831155515.02b50d30@www.thinkware.se> At 11:23 2002-08-30 -0400, Robert.Simons@us.pilkington.com wrote: >Hi to all you programming gurus... >I have downloaded to a Win98 box: > Python 2.2.1 (said most stable) > WxPython 2.2.3.1 - python.exe > Boa.constructor 0.1.0 -alpha.win32.exe ... > the simple program I am >trying to run claims no knowledge of the ODBC. There is no ODBC module in the software you mentioned above. You need the windows extensions. Either you install ActivePython instead of standard Python, or (simpler now that you already installed) you download and install Mark Hammond's Win32all package from http://starship.python.net/crew/mhammond/win32/Downloads.html There is another option for ODBC, and that is the mxODBC package, but that's not free for commercial use. And you might find a lot of other useful things in win32all in addition to the ODBC module. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From erikprice@mac.com Sat Aug 31 15:45:19 2002 From: erikprice@mac.com (Erik Price) Date: Sat, 31 Aug 2002 10:45:19 -0400 Subject: [Tutor] q about method(self) Message-ID: <45388CCA-BCF0-11D6-9B69-00039351FE6A@mac.com> A class method generally takes "self" as its first argument. I had been wondering for some time why this is, since it seems redundant if it's there for all class methods. But I just realized -- you can call an object's method without using dot notation in Python, like this: method(instance_reference, args) rather than only like this: instance_reference.method(args) I didn't realize that until just now. But what I'm wondering is, why/when would you want to use this form? Is it just an aesthetic thing, or is it something that is required b/c of the way that Python handles user-defined classes and objects? Or something else? One other quickie question -- not that I would ever need to do this, but could a different identifier other than "self" ever be used? (such as "this") It -appears- that "self" is just a reference within a class, but perhaps there's magic going on that I don't know about. Thanks, Erik -- Erik Price email: erikprice@mac.com jabber: erikprice@jabber.org From benmanow@hotmail.com Sat Aug 31 16:31:53 2002 From: benmanow@hotmail.com (hotmail) Date: Sat, 31 Aug 2002 16:31:53 +0100 Subject: [Tutor] help required Message-ID: This is a multi-part message in MIME format. ------=_NextPart_000_001D_01C2510B.EA1DB220 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable i was wondering if it is possible to make a gui for python programs to = make the use of them easier and also i was wondering if it si possible = to out put images as well as text in programs. thanks for any help in advance ------=_NextPart_000_001D_01C2510B.EA1DB220 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
i was wondering if it is possible = to make a=20 gui  for python programs to make the use of them easier and also i = was=20 wondering if it si possible to out put images as well as text in=20 programs.
 
thanks for any help in=20 advance
------=_NextPart_000_001D_01C2510B.EA1DB220-- From emile@fenx.com Sat Aug 31 17:23:31 2002 From: emile@fenx.com (Emile van Sebille) Date: Sat, 31 Aug 2002 09:23:31 -0700 Subject: [Tutor] Re: Iterators (was: Re: text module) References: <200208310141.30176.scot@possum.in-berlin.de> <3F86314E-BCDE-11D6-9B69-00039351FE6A@mac.com> Message-ID: Erik: [snip iter stuff] > It's a confusing document IMHO. I would appreciate any discussion and > thoughts that anyone cares to contribute. > Here's a simple example that subclasses list overriding __iter__ to walk the list backwards. class Backwards(list): def __iter__(self): idx = len(self) while idx: idx-=1 yield self[idx] lst = range(10) for i in lst: print i, print lst = Backwards(range(10)) for i in lst: print i, From emile@fenx.com Sat Aug 31 17:28:10 2002 From: emile@fenx.com (Emile van Sebille) Date: Sat, 31 Aug 2002 09:28:10 -0700 Subject: [Tutor] Re: q about method(self) References: <45388CCA-BCF0-11D6-9B69-00039351FE6A@mac.com> Message-ID: Erik: > A class method generally takes "self" as its first argument. It is named self by convention only. You can call it 'this' if you want. > I had > been wondering for some time why this is, since it seems redundant if > it's there for all class methods. But I just realized -- you can call > an object's method without using dot notation in Python, like this: > > method(instance_reference, args) This might also be seen as function(inst_ref, args) which serves to show that a class method is not really much different from any function. In this case, the instance being passed could come from any class. > > rather than only like this: > > instance_reference.method(args) > > I didn't realize that until just now. But what I'm wondering is, > why/when would you want to use this form? Normally, you probably wouldn't. I imagine if you write utilities or systems that execute unknown code you might find a need. ISTM that when you get to the point of having a class method that turns out to be more useful as a function, you'd want to refactor it that way. Time permitting of course, which may be why you'd use it this other form. ;-) Emile van Sebille emile@fenx.com