Re: [Tutor] How to use Python 2.6 with IDLE?

2009-07-31 Thread Dick Moores
output of the script 26.py . I call Ulipad with a Win XP shortcut, <http://www.rcblue.com/Misc/Ulipad_Shortcut2.png>. The contents of the "Target:" textbox is "E:\Python26\pythonw.exe E:\Programs\Ulipad3.7\Ulipad.pyw" (no quotes). Dick Moores __

Re: [Tutor] How to use Python 2.6 with IDLE?

2009-07-28 Thread Dick Moores
On Tue, Jul 28, 2009 at 02:20, Dave Angel wrote: > Dick Moores wrote: >> >> >> I'm not sure how to edit it. What's required for Ulipad is quite >> different, I believe. >> >> This is what I got from Dave Angel: >> e: >> cd \Python

Re: [Tutor] How to use Python 2.6 with IDLE?

2009-07-27 Thread Dick Moores
On Mon, Jul 27, 2009 at 14:32, Alan Gauld wrote: > > "Dick Moores" wrote > >>> So edit the Target field of the shortcut to say: >>> >>> E:\Python26\pythonw.exe E:\Programs\Ulipad37\ulipad.pyw >> >> No, I'd already tried that

Re: [Tutor] How to use Python 2.6 with IDLE?

2009-07-27 Thread Dick Moores
On Mon, Jul 27, 2009 at 12:50, ALAN GAULD wrote: > > >> > What I do for these things is create a shortcut which specifies the full >> > path to the interpreter and to the pyw file. I also set the working foldeer >> > to wherever is most appropriate - usually my project folder. That's fairly >> > bu

Re: [Tutor] How to use Python 2.6 with IDLE?

2009-07-27 Thread Dick Moores
On Mon, Jul 27, 2009 at 09:32, Alan Gauld wrote: > > "Dick Moores" wrote > >>> I suggest you have to change the association of *.pyw files to the >>> program, which is used to 'open' it. >>> >> Yes! After I did that, now when I cal

Re: [Tutor] How to use Python 2.6 with IDLE?

2009-07-27 Thread Dick Moores
On Mon, Jul 27, 2009 at 04:27, Gregor Lingl wrote: > Dick Moores schrieb: >> >> I've taken a long break from Python, and now I want to try scripting >> with 2.62. I downloaded and installed 2.62, changed Win XP >> environmental variables to use Python26. Enteri

[Tutor] How to use Python 2.6 with IDLE?

2009-07-27 Thread Dick Moores
use 2.6. When I click on E:\Python26\Lib\idlelib\idle.pyw, I get an IDLE instance that says: Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for mor

Re: [Tutor] Threading

2008-09-11 Thread Dick Moores
here are some good examples of threading in the Python cookbook, or this one: http://www.chrisarndt.de/projects/threadpool/ This may be of use: < http://blog.doughellmann.com/2008/01/pymotw-threading_13.html> Dick Moores ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Threading

2008-09-11 Thread Dick Moores
here are some good examples of threading in the Python cookbook, or this one: http://www.chrisarndt.de/projects/threadpool/ This may be of use: < http://blog.doughellmann.com/2008/01/pymotw-threading_13.html> Dick Moores ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] How to revise script to call my non-default browser?

2008-09-10 Thread Dick Moores
a browser at all. I just want it to call to call RealPlayer at a certain time to start playing KUOW. So I suppose I'm looking at revising line 66? Help? Thanks, Dick Moores ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-14 Thread Dick Moores
At 06:36 AM 8/14/2008, Jeff Johnson wrote: I use Dabo's Editor.py. It has templates to provide code highlighting, etc. in many languages. I also like the way it runs Python programs. Could you tell us what you like about the way it runs Python programs? Thanks, Dick Moores By th

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-14 Thread Dick Moores
At 04:54 PM 8/14/2008, bob gailer wrote: Dick Moores wrote: At 08:58 PM 8/13/2008, bob gailer wrote: One thing I really like about Python Win is the integrated debugger, which takes no time to start up. SPE OTOH uses WinPDB which runs as a separate process that takes (in the demo video) 15

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-13 Thread Dick Moores
heavily on the debugger that delay would drive me crazy! Hm, I just measured how long Ulipad takes to get going with WinPDB, a plug-in: 20 seconds, but 10 seconds for a restart. Other than the time to start, could you compare debugging with Python Win and debugging with WinPDB? Thanks, Dick

[Tutor] Python 2 green arrows up for August!

2008-08-13 Thread Dick Moores
<http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html> Dick Moores ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-13 Thread Dick Moores
At 07:58 AM 8/13/2008, W W wrote: As far as any keyboard commands that I use, I've not seen any difference between vim, vi, and gvim. The main difference is syntax highlighting. Uh, oh. What's the difference between syntax highlighting in vim and in gvim? Thanks, Dick

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-13 Thread Dick Moores
At 07:04 AM 8/13/2008, W W wrote: On Wed, Aug 13, 2008 at 7:31 AM, Dick Moores <[EMAIL PROTECTED]> wrote: And read this: http://www.moolenaar.net/habits.html Hey, that looks very useful! Thanks. How about the O'Reilly book? < http://www.bestbookdeal.com/book/detail/059652

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-13 Thread Dick Moores
At 07:04 AM 8/13/2008, W W wrote: On Wed, Aug 13, 2008 at 7:31 AM, Dick Moores <[EMAIL PROTECTED]> wrote: And read this: http://www.moolenaar.net/habits.html Hey, that looks very useful! Thanks. How about the O'Reilly book? < http://www.bestbookdeal.com/book/detail/059652

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-13 Thread Dick Moores
At 04:22 AM 8/13/2008, W W wrote: On Tue, Aug 12, 2008 at 11:17 PM, Dick Moores <[EMAIL PROTECTED]> wrote: At 05:11 PM 8/12/2008, Alan Gauld wrote: I use Pythonwin for most of my short programming tasks (with occasional forays into other tools like PyCrust and SPE) but for s

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-13 Thread Dick Moores
ures are: Code snippets window FTP window can group files in "sessions" "live" regex search and replace search in files syntax checker spell check pylint svn support a great many keybindings, mostly for the editor And last but not least, a developer who is quick to respond to email,

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-12 Thread Dick Moores
take a look at vim for Windows. I just downloaded the "Self-installing executable   gvim##.exe" which is listed on < http://www.vim.org/download.php#pc>. Is this the sort of vim you're talking about? Dick Moores Python 2.51 Win XP =

Re: [Tutor] Questions about the new turtle module in Python 2.6b2

2008-08-10 Thread Dick Moores
At 11:57 PM 8/9/2008, you wrote: Dick Moores schrieb: Gregor, <http://docs.python.org/dev/library/turtle.html#turtle.setup> 1. I want the window to open with the right edge 0 pixels from the right edge of my screen. However, setup(width=.75, height=.915, startx=-0, starty=0) doesn'

Re: [Tutor] Questions about the new turtle module in Python 2.6b2

2008-08-09 Thread Dick Moores
At 03:12 AM 8/9/2008, Dick Moores wrote: 4. For my random_rectangles.py program I've started to try out the new turtle. (See the current state of random_rectanglesV16_web.py at < http://py77.python.pastebin.com/d3e842821>.) The only downside I've found is that the new turtle is

[Tutor] Questions about the new turtle module in Python 2.6b2

2008-08-09 Thread Dick Moores
Gregor, 1. I want the window to open with the right edge 0 pixels from the right edge of my screen. However, setup(width=.75, height=.915, startx=-0, starty=0) doesn't work. I have to do the nearest thing, setup(width=.75, height=.91

[Tutor] To Tutor subscribers: should I send detailed questions about the Python 2.6b2's Turtle to the list?

2008-08-08 Thread Dick Moores
The thread I started continues, and now concerns mainly the new Turtle module in Python 2.6b2. I am very interested in this, but I'm wondering is there are other 'kids" out there who are. Should I ask our resident expert, Gregor Lingl directly, or through the list? Opinions, pleas

Re: [Tutor] Ongoing trouble with Turtle's end_fill() - caused by abug in turtle.py

2008-08-07 Thread Dick Moores
On Thu, Aug 7, 2008 at 4:04 PM, Gregor Lingl <[EMAIL PROTECTED]> wrote: > Hi Dick, > > first of all, thanks for your efforts using the new turtle module > and reporting about your experiences and the problems you ran into. Sure. And I'm not finished. There seem to be some interesting new things wo

Re: [Tutor] Ongoing trouble with Turtle's end_fill() - caused by abug in turtle.py

2008-08-07 Thread Dick Moores
On Thu, Aug 7, 2008 at 4:04 PM, Gregor Lingl <[EMAIL PROTECTED]> wrote: > Hi Dick, > > first of all, thanks for your efforts using the new turtle module > and reporting about your experiences and the problems you ran into. Sure. And I'm not finished. There seem to be some interesting new things wo

Re: [Tutor] Ongoing trouble with Turtle's end_fill() - caused by abug in turtle.py

2008-08-07 Thread Dick Moores
On Thu, Aug 7, 2008 at 11:26 AM, Alan Gauld <[EMAIL PROTECTED]> wrote: > "Dick Moores" <[EMAIL PROTECTED]> wrote > >> 1. The turtle has some behavior I don't see how to eliminate. If you >> refer to lines 223, 225, 227, 229, etc., you'll see that

Re: [Tutor] Ongoing trouble with Turtle's end_fill() - caused by a bug in turtle.py

2008-08-07 Thread Dick Moores
On Thu, Aug 7, 2008 at 9:54 AM, Dick Moores <[EMAIL PROTECTED]> wrote: > 4. I've attempted to make the turtle invisible, but haven't succeeded. Got it! hideturtle() <http://docs.python.org/dev/library/turtle.html#turtle.hideturtle> Dick

Re: [Tutor] Ongoing trouble with Turtle's end_fill() - caused by a bug in turtle.py

2008-08-07 Thread Dick Moores
On Wed, Aug 6, 2008 at 5:09 PM, Gregor Lingl <[EMAIL PROTECTED]> wrote: > This is due to a bug in turtle.py - interestingly after so many years of use > and improvement of turtle.py there still appear new bugs from time to time. > > The bug consists in a missing update of the Canvas in the fill() f

Re: [Tutor] Ongoing trouble with Turtle's end_fill()

2008-08-06 Thread Dick Moores
On Wed, Aug 6, 2008 at 4:50 AM, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Tue, Aug 5, 2008 at 6:49 PM, Dick Moores <[EMAIL PROTECTED]> wrote: >> For a while now I've had trouble with end_fill(). Sometimes I can use >> it to fill a figure such as a square, triangl

[Tutor] Ongoing trouble with Turtle's end_fill()

2008-08-05 Thread Dick Moores
x, y = 50, 50 color(color_name) print color_name up() goto(x, y) down() goto(x, -y) goto(-x, -y) goto(-x, y) goto(x, y) end_fill() print "end_fill()" time.sleep(1) clear() ===

Re: [Tutor] I can't believe this needs to be this complex

2008-08-03 Thread Dick Moores
At 05:15 AM 8/3/2008, Kent Johnson wrote: On Sun, Aug 3, 2008 at 4:00 AM, Alan Gauld <[EMAIL PROTECTED]> wrote: > "Dick Moores" <[EMAIL PROTECTED]> wrote > >>>> code I time. What's an example of code that would have System be greater >>>&g

Re: [Tutor] I can't believe this needs to be this complex

2008-08-03 Thread Dick Moores
At 05:15 AM 8/3/2008, Kent Johnson wrote: On Sun, Aug 3, 2008 at 4:00 AM, Alan Gauld <[EMAIL PROTECTED]> wrote: > "Dick Moores" <[EMAIL PROTECTED]> wrote > >>>> code I time. What's an example of code that would have System be greater >>>&g

Re: [Tutor] I can't believe this needs to be this complex

2008-08-03 Thread Dick Moores
At 01:00 AM 8/3/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote code I time. What's an example of code that would have System be greater than zero? And what's the distinction between User and System? (I'm using Win XP, if that's relevant.

Re: [Tutor] I can't believe this needs to be this complex

2008-08-02 Thread Dick Moores
At 10:08 AM 8/2/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote BTW Kent, I'm going to take this opportunity to ask you about "System" in the IPython timing results. It's always zero for the code I time. What's an example of code tha

Re: [Tutor] I can't believe this needs to be this complex

2008-08-02 Thread Dick Moores
At 05:02 AM 8/2/2008, Kent Johnson wrote: On Sat, Aug 2, 2008 at 6:07 AM, Dick Moores <[EMAIL PROTECTED]> wrote: > I'm pretty new to Python's dictionaries, but I had a need for a function > that would find the values in a dict that have more than one key each. From your sa

Re: [Tutor] I can't believe this needs to be this complex

2008-08-02 Thread Dick Moores
At 03:49 AM 8/2/2008, Dick Moores wrote: At 03:27 AM 8/2/2008, Andre Engels wrote: Content-Transfer-Encoding: base64Content-Disposition: inlineOn Sat, Aug 2, 2008 at 11:07 AM, Dick Moores <[EMAIL PROTECTED]> wrote: > I'm pretty new to Python's dictionaries, but I had a

Re: [Tutor] I can't believe this needs to be this complex

2008-08-02 Thread Dick Moores
At 03:27 AM 8/2/2008, Andre Engels wrote: Content-Transfer-Encoding: base64Content-Disposition: inlineOn Sat, Aug 2, 2008 at 11:07 AM, Dick Moores <[EMAIL PROTECTED]> wrote: > I'm pretty new to Python's dictionaries, but I had a need for a function > that would find the

[Tutor] I can't believe this needs to be this complex

2008-08-02 Thread Dick Moores
wn, and with the dict of colors at <http://py77.python.pastebin.com/f796752ff>. But I can't believe the function needs to be so complex. And also, I suppose I've reinvented the wheel (again). Please instruct me. My apologies in advance to Kent for not using a single list comp

Re: [Tutor] Turtle problem: how to exit the .exe?

2008-07-29 Thread Dick Moores
At 12:38 AM 7/29/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote Very odd, I assume the python script when executed normally doesn't exhibit such odd behaviour? When I try to stop the script from running not by a Ctrl+Q on the console window, but on t

Re: [Tutor] Turtle problem: how to exit the .exe?

2008-07-28 Thread Dick Moores
At 05:30 PM 7/28/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote Tkinter is involved, turtle usesw Tkinter. Yes, I allowed for that when I made the .exe: python Makespec.py -FKc E:\PyInstaller\MyScripts\randomTriangles_wo_named_colorsV13.exe Means not

Re: [Tutor] Turtle problem: how to exit the .exe?

2008-07-28 Thread Dick Moores
At 03:32 PM 7/28/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote But I'd like to make a version of the script that doesn't report any data. How can I write it so that the .exe can be easily exited by the user? If Tkinter instead of Turtle were invol

[Tutor] Turtle problem: how to exit the .exe?

2008-07-28 Thread Dick Moores
y done by a Ctrl+Q on the console window. But I'd like to make a version of the script that doesn't report any data. How can I write it so that the .exe can be easily exited by the user? If Tkinter instead of Turtle were involved, I could have an Exit button connected to command=root.q

Re: [Tutor] Online class/education for Python?

2008-07-27 Thread Dick Moores
At 11:16 AM 7/27/2008, Danyelle Gragsone wrote: On Sun, Jul 27, 2008 at 7:54 AM, Dick Moores <[EMAIL PROTECTED]> wrote: At 04:09 AM 7/27/2008, Danyelle Gragsone wrote: Aren't those different books? than PPftAB? Your acronym has lost me, but _Programming Python for the Absolut

Re: [Tutor] Online class/education for Python?

2008-07-27 Thread Dick Moores
_Beginning Game Development with Python and Pygame_, Apress, 2007? Dick Moores === Have you seen Kelie Feng's video introducing the terrific and free IDE, Ulipad? <http://www.rcblue.com/u3/> Get Ulipad 3.9 from <http://code.google.com/p/u

Re: [Tutor] Online class/education for Python?

2008-07-27 Thread Dick Moores
At 04:09 AM 7/27/2008, Danyelle Gragsone wrote: Aren't those different books? than PPftAB? Your acronym has lost me, but _Programming Python for the Absolute Beginner_, 2nd ed. is essentially the same book as the much more expensive _Guide to Programming with Python_. Dick

Re: [Tutor] Online class/education for Python?

2008-07-27 Thread Dick Moores
At 05:03 PM 7/26/2008, Alan Gauld wrote: "wesley chun" <[EMAIL PROTECTED]> wrote from the 2nd review for this author's "other" Python book, it could be some nefarious actions from the publisher itself... no wonder it's "out-of-print!" http://amazon.com/dp/1423901126 At $88 for 500 pages it

Re: [Tutor] Online class/education for Python?

2008-07-26 Thread Dick Moores
=Other&isbn=978%2D1%2D59863%2D112%2D8> does anyone know if a 3rd edition is being worked on? publisher contact info: <http://www.courseptr.com/ptr_customerService.cfm> I used to have the author's email, but I've lost it. Dick Moores

Re: [Tutor] Is there a better way to get a current mid-rate Yen quote with Python?

2008-07-25 Thread Dick Moores
At 04:11 PM 7/25/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote Certainly Beautiful Soup will not be muh longer and a lot more elegant and probably more resilient. Alan, expand a bit, please. Longer? Resilient? Longer as in lines of code. BS is good for ex

Re: [Tutor] Is there a better way to get a current mid-rate Yen quote with Python?

2008-07-25 Thread Dick Moores
At 09:47 AM 7/25/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote Here's one opinion, an answer to my second question. Dick And to answer your first: It depends on how you define better. Certainly Beautiful Soup will not be muh longer and a lot more eleg

Re: [Tutor] Is there a better way to get a current mid-rate Yen quote with Python?

2008-07-25 Thread Dick Moores
Here's one opinion, an answer to my second question. Dick Date: Fri, 25 Jul 2008 08:54:53 -0500 From: "W W" <[EMAIL PROTECTED]> To: "Dick Moores" <[EMAIL PROTECTED]> Subject: Re: [Tutor] Is there a better way to get a current mid-rate Yen quote with Pyt

[Tutor] Is there a better way to get a current mid-rate Yen quote with Python?

2008-07-25 Thread Dick Moores
Better than this? <http://py77.python.pastebin.com/fc7553a4> I've heard about BeautifulSoup. <http://www.crummy.com/software/BeautifulSoup/>. Is it worth learning? Is it crummy? ;-) So 2 questions. Thanks, Dick Moores _

Re: [Tutor] Advice for my function, isPrime(n), please

2008-07-21 Thread Dick Moores
At 01:42 PM 7/21/2008, Terry Carroll wrote: On Mon, 21 Jul 2008, Daniel Sarmiento wrote: > What about the following function? > > if x == 0: > return False > return True I don't like it, myself. You have multiple points of exit, and, yes, you can see that the fallthough is only executed if

Re: [Tutor] Online class/education for Python?

2008-07-19 Thread Dick Moores
ython^2.5^Programming&departmentnum=WP&path=1 This does look good. I'm thinking about the $129. 1. Is there a problem set for each lesson? Are they corrected or commented on? 2. How do you ask for help from the instructor? By email? In a forum? Was he helpful?

Re: [Tutor] Advice for my function, isPrime(n), please

2008-07-19 Thread Dick Moores
At 04:44 AM 7/19/2008, Kent Johnson wrote: On Sat, Jul 19, 2008 at 5:03 AM, Dick Moores <[EMAIL PROTECTED]> wrote: >> > Readability counts. <-- >> >> Personally I think my way is more readable. It says what it means >> without any fluff. IMO it is ex

Re: [Tutor] Advice for my function, isPrime(n), please

2008-07-19 Thread Dick Moores
At 08:40 PM 7/18/2008, Kent Johnson wrote: On Fri, Jul 18, 2008 at 4:45 PM, Dick Moores <[EMAIL PROTECTED]> wrote: > At 12:38 PM 7/18/2008, Kent Johnson wrote: >> >> On Fri, Jul 18, 2008 at 2:25 PM, Dick Moores <[EMAIL PROTECTED]> wrote: >> > At 10

Re: [Tutor] IPython problem: Difficulty in setting editor to TextPad

2008-07-18 Thread Dick Moores
At 03:41 PM 7/18/2008, arsyed wrote: I just set the EDITOR environment variable under windows to textpad and %ed works fine from ipython. It also gets used by subversion and other programs for commit messages, etc. >echo %EDITOR% "C:\Program Files\TextPad 5\TextPad.exe" I'd already done tha

Re: [Tutor] Advice for my function, isPrime(n), please

2008-07-18 Thread Dick Moores
At 12:38 PM 7/18/2008, Kent Johnson wrote: On Fri, Jul 18, 2008 at 2:25 PM, Dick Moores <[EMAIL PROTECTED]> wrote: > At 10:03 AM 7/18/2008, Kent Johnson wrote: >> >> On Fri, Jul 18, 2008 at 11:32 AM, Dick Moores <[EMAIL PROTECTED]> wrote: >> >if x == 0: &

Re: [Tutor] Advice for my function, isPrime(n), please

2008-07-18 Thread Dick Moores
At 10:03 AM 7/18/2008, Kent Johnson wrote: On Fri, Jul 18, 2008 at 11:32 AM, Dick Moores <[EMAIL PROTECTED]> wrote: >if x == 0: >return False >else: >return True Could be just return x!=0 I see this works, but it's Greek to me. HOW does it work

[Tutor] Advice for my function, isPrime(n), please

2008-07-18 Thread Dick Moores
t that test, isPrime(3.7) returns true, and isPrime('44') returns False. I've gone with testing for integerhood, and with returning None when n fails the test. Thus, In [3]: print isPrime(3.7) None In [4]: print isPrime('44') None Advice? Thanks, Dick Moores __

Re: [Tutor] IPython problem: Difficulty in setting editor to TextPad

2008-07-17 Thread Dick Moores
At 08:13 AM 7/17/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote In my ipy_user_conf.py I have put this line: ipy_editors.install_editor("C:\Program Files\TextPad 5\TextPad.exe") escape the spaces and backslashes(raw string might work as well) Yeah

[Tutor] IPython problem: Difficulty in setting editor to TextPad

2008-07-17 Thread Dick Moores
with the spaces in the path, but I don't know what to do about them. Help, please. Dick Moores Have you seen the video introducing the terrific and free IDE, Ulipad? Download it from my website. <http://www.rcblue.com/u3/> ___

Re: [Tutor] Does IPython have a "restart"?

2008-07-17 Thread Dick Moores
At 07:55 AM 7/16/2008, Dick Moores wrote: I mean something equivalent to what you get when you do a Ctrl+F6 in IDLE: >>> import math >>> math.log(3) 1.0986122886681098 >>> === RESTART

Re: [Tutor] Does IPython have a "restart"?

2008-07-16 Thread Dick Moores
At 02:07 PM 7/16/2008, Kent Johnson wrote: On Wed, Jul 16, 2008 at 4:31 PM, Dick Moores <[EMAIL PROTECTED]> wrote: > At 10:31 AM 7/16/2008, Kent Johnson wrote: >> >> Just quit and relaunch? >> >> Kent > > Well, if that what Kent, a long-time IPython user do

Re: [Tutor] Does IPython have a "restart"?

2008-07-16 Thread Dick Moores
At 10:31 AM 7/16/2008, Kent Johnson wrote: Just quit and relaunch? Kent Well, if that what Kent, a long-time IPython user does, I guess I'm stuck with doing that, but I don't like it. Dick ___ Tutor maillist - Tutor@python.org http://mail.pyth

[Tutor] Does IPython have a "restart"?

2008-07-16 Thread Dick Moores
back (most recent call last): File "", line 1, in math.log(3) NameError: name 'math' is not defined >>> Thanks, Dick Moores ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Another assert() question

2008-07-14 Thread Dick Moores
At 12:51 AM 7/14/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote 5.10 Boolean operations "In the context of Boolean operations, and also when expressions are used by control flow statements, the following values are interpreted as false: |False|, |N

Re: [Tutor] Another assert() question

2008-07-13 Thread Dick Moores
At 03:57 PM 7/13/2008, bob gailer wrote: When all else fails RTFM: 5.10 Boolean operations "In the context of Boolean operations, and also when expressions are used by control flow statements, the following values are interpreted as false: |False|, |None|, numeric zero of all types, and

Re: [Tutor] Another assert() question

2008-07-13 Thread Dick Moores
At 08:46 PM 7/12/2008, Marc Tompkins wrote: On Sat, Jul 12, 2008 at 8:10 PM, Dick Moores <[EMAIL PROTECTED]> wrote: But why will a tuple with two elements will always evaluate to True? In [2]: (3,5) == True Out[2]: False In [3]: ("qwerty", "asdfg") == True Ou

Re: [Tutor] Another assert() question

2008-07-13 Thread Dick Moores
At 12:40 PM 7/13/2008, Martin Walsh wrote: Dick Moores wrote: > At 11:44 AM 7/13/2008, Steve Willoughby wrote: >> Dick Moores wrote: >>> Yes! A rule, not logic. I'm not contradicting Kent, just helping >>> myself understand. First the rule, then logic in the ap

Re: [Tutor] Another assert() question

2008-07-13 Thread Dick Moores
At 11:44 AM 7/13/2008, Steve Willoughby wrote: Dick Moores wrote: Yes! A rule, not logic. I'm not contradicting Kent, just helping myself understand. First the rule, then logic in the application of the rule. And I assume the rule is there in Python because it makes things work better. Yes,

Re: [Tutor] Another assert() question

2008-07-13 Thread Dick Moores
At 12:50 AM 7/13/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote But why will a tuple with two elements will always evaluate to True? Thats the rule for evaluationg collections in Python. An empty collection is False. Anything else is therefore true Yes! A rule

Re: [Tutor] Another assert() question

2008-07-12 Thread Dick Moores
At 07:39 PM 7/12/2008, Kent Johnson wrote: On Sat, Jul 12, 2008 at 6:03 PM, Dick Moores <[EMAIL PROTECTED]> wrote: > At 01:34 PM 7/12/2008, Kent Johnson wrote: >> In [2]: assert(False, "Asserted false") >> >> This is "assert condition" where the c

Re: [Tutor] Another assert() question

2008-07-12 Thread Dick Moores
At 01:34 PM 7/12/2008, Kent Johnson wrote: On Sat, Jul 12, 2008 at 4:01 PM, Dick Moores <[EMAIL PROTECTED]> wrote: > _Python in a NutShell_, p. 138 has a bit on the assert statement which I > don't completely understand. > > It says the syntax is > > assert cond

Re: [Tutor] Another assert() question

2008-07-12 Thread Dick Moores
At 01:24 PM 7/12/2008, Danny Yoo wrote: Content-Transfer-Encoding: 7bit Content-Disposition: inline > In my code I have > > assert(len(list(set(colors_used_this_cycle))) == > len(colors_used_this_cycle), "A color has been used twice!") > > But it doesn't work. Cases where a color has been used m

Re: [Tutor] Another assert() question

2008-07-12 Thread Dick Moores
At 01:28 PM 7/12/2008, Michiel Overtoom wrote: Dick wrote: > I was hoping to put some sort of explanation of failure in an > assert statement. But how to do it? > So I'd like to know what that 'expression' in the syntax can be, > and how to use it. I think it would help if you separate the dete

[Tutor] Another assert() question

2008-07-12 Thread Dick Moores
lors_used_this_cycle) works perfectly. So I'd like to know what that '_expression_' in the syntax can be, and how to use it. Thanks, Dick Moores ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] assert() question

2008-07-06 Thread Dick Moores
At 02:30 PM 7/6/2008, Kent Johnson wrote: On Sun, Jul 6, 2008 at 2:49 AM, Dick Moores <[EMAIL PROTECTED]> wrote: > I have a module, mycalc.py, which is a collection of functions designed to > be imported independently. > > I've heard about using assert() to check up on w

Re: [Tutor] assert() question

2008-07-06 Thread Dick Moores
At 06:01 AM 7/6/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote Traceback (most recent call last): File "E:\PythonWork\Untitled 2.py", line 42, in assert(fact(10,4) == 3.629e+6) AssertionError I'm not sure but I suspect you are running i

Re: [Tutor] assert() question

2008-07-06 Thread Dick Moores
At 01:23 AM 7/6/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote I've heard about using assert() to check up The top three work silently, but I found that I could not figure out how to use assert() with the functions that print rather than return. E.g., m

[Tutor] assert() question

2008-07-05 Thread Dick Moores
lapsed > 60:     print "Time was", hmsToText(timeElapsed)     else:     print "Time was %.4g seconds" % timeElapsed Thanks, Dick Moores ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] random.choice()

2008-07-02 Thread Dick Moores
At 03:46 AM 7/2/2008, Kent Johnson wrote: On Wed, Jul 2, 2008 at 3:54 AM, wesley chun <[EMAIL PROTECTED]> wrote: > in the former, you have a function object. it's just like any other > Python object, but with one heaping distinction: it's callable -- > this means that u can slap on a pair of p

Re: [Tutor] random.choice()

2008-07-02 Thread Dick Moores
At 12:54 AM 7/2/2008, wesley chun wrote: ok, someone has to be the bad guy and show an example of equivalent code that's more difficult to read: choice([use_for_float_demo, use_for_integer_demo])() seriously tho, the bottom line of what people have been telling you is that for the function (or

Re: [Tutor] random.choice()

2008-07-01 Thread Dick Moores
At 06:23 AM 7/1/2008, Cédric Lucantis wrote: Le Tuesday 01 July 2008 15:04:11 Dick Moores, vous avez écrit : > At 05:43 AM 7/1/2008, Tim Golden wrote: > >Dick Moores wrote: > >>So I want to randomly choose between them. I thought that I might > >>be able to

Re: [Tutor] random.choice()

2008-07-01 Thread Dick Moores
At 05:52 AM 7/1/2008, Cédric Lucantis wrote: Le Tuesday 01 July 2008 14:38:36 Dick Moores, vous avez écrit : > I'm writing a demonstration version of a program which does things > with integers, and with floats, which are randomly generated. I want > to also randomly pick wheth

Re: [Tutor] random.choice()

2008-07-01 Thread Dick Moores
At 05:43 AM 7/1/2008, Tim Golden wrote: Dick Moores wrote: So I want to randomly choose between them. I thought that I might be able to use choice() to do that. So, (bunch of functions here) if __name__ == '__main__': choice([use_for_float_demo(), use_for_integer_demo()]) I

[Tutor] random.choice()

2008-07-01 Thread Dick Moores
even for a radically biased coin, coin = choice(["Heads", "Tails", "Heads", "Tails", "Heads", "Tails", "Tails"]) Thanks, Dick Moores ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] s[len(s):len(s)] = [x] ??

2008-06-30 Thread Dick Moores
At 01:39 PM 6/30/2008, Dick Moores wrote: At 11:01 PM 6/29/2008, wesley chun wrote: > > e.g. can you predict the result of the following operations without trying it? > > > > a = [1, 2, 3, 4] > > a[1:3] = [7, 8] > > print a > >  [1, 7, 8, 4]   Whew! >  (I r

Re: [Tutor] s[len(s):len(s)] = [x] ??

2008-06-30 Thread Dick Moores
At 11:01 PM 6/29/2008, wesley chun wrote: > > e.g. can you predict the result of the following operations without trying it? > > > > a = [1, 2, 3, 4] > > a[1:3] = [7, 8] > > print a > >  [1, 7, 8, 4]   Whew! >  (I really wasn't positive that it shouldn't be [1, [7, 8], 4] !) good job dick! of cou

Re: [Tutor] s[len(s):len(s)] = [x] ??

2008-06-29 Thread Dick Moores
At 03:39 PM 6/29/2008, John Fouhy wrote: On 28/06/2008, Dick Moores <[EMAIL PROTECTED]> wrote: > I'm very familiar with appending x to a list, s, using s.append(x), however, > I've never understood what the docs mean by > > s.append(x) same as s[len(s):len(s)] = [

Re: [Tutor] s[len(s):len(s)] = [x] ??

2008-06-29 Thread Dick Moores
At 03:39 PM 6/29/2008, John Fouhy wrote: On 28/06/2008, Dick Moores <[EMAIL PROTECTED]> wrote: > I'm very familiar with appending x to a list, s, using s.append(x), however, > I've never understood what the docs mean by > > s.append(x) same as s[len(s):len(s)] = [

Re: [Tutor] How to print numbers in scientific notation form?

2008-06-28 Thread Dick Moores
At 06:17 AM 6/28/2008, Cédric Lucantis wrote: '%e' % 1.0 '1.00e+00' and to set the number of significant digits (it seems to only set the number of digits after the comma, so you have to subtract 1 from it) : >>> '%.3e' % 1.0 '1.000e+00' Perfect! Thanks. Dick

[Tutor] How to print numbers in scientific notation form?

2008-06-28 Thread Dick Moores
>>> print "%.4g" % 187686876876238746 1.877e+017 How can I print all numbers in scientific notation form, and designate the number of significant digits? Thanks, Dick Moores ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] need help with a regular expression

2008-06-28 Thread Dick Moores
uld you give examples of what you will permit, and will not permit? Dick Moores > This is what I have so far. I think it meets all the criteria except for the > last one. Haven't figured out the answer yet. > > re.compile(r'_{0,3}[A-Z][A-Z0-9\-]*[A-Z0-9]') _

Re: [Tutor] "local variable 'l1' referenced before assignment"

2008-06-28 Thread Dick Moores
At 01:52 AM 6/28/2008, wesley chun wrote: > Sorry to be dense, but how, in what way, is a1's l1 different from a2's > l1"? Both are [1,2,3]*100 . dick, alan and everyone else are correct, but let me just put it as simply as this: - in a1(), you're accessing l1 as a global variable - in a2(),

Re: [Tutor] "local variable 'l1' referenced before assignment"

2008-06-28 Thread Dick Moores
At 02:22 AM 6/28/2008, Martin Walsh wrote: Douglas Drumond wrote: > > In a2() you do l1 += l2, ie, l1 = l1 + l2 A subtle clarification is warranted I think. l1 += l2 is not the same as l1 = l1 + l2, when l1 and l2 are lists. And wow, can the times for each differ from each other! See, for exa

Re: [Tutor] "local variable 'l1' referenced before assignment"

2008-06-28 Thread Dick Moores
At 01:05 AM 6/28/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote I'm puzzled by the below error msg. If I change the line in a2() from l1 = [1,2,3]*100 This is not in a2() this is in the global namespace outside of a2. a2() consists of a single assi

Re: [Tutor] "local variable 'l1' referenced before assignment"

2008-06-28 Thread Dick Moores
At 12:44 AM 6/28/2008, Dick Moores wrote: At 12:11 AM 6/28/2008, Douglas Drumond wrote: But if you don't have l1 defined yet, you can't add to l2 It's like: def a2():     l1 = foo + l2 UnboundLocalError: local variable 'foo' referenced before assignment It

Re: [Tutor] "local variable 'l1' referenced before assignment"

2008-06-27 Thread Dick Moores
s because l1 (and foo at above example) is a local variable. a1's l1 is different from a2's l1. Sorry to be dense, but how, in what way, is a1's l1  different from a2's l1"?  Both are [1,2,3]*100 . Dick On Sat, Jun 28, 2008 at 01:39, Dick Moores <[EMAIL PROTECTED]> wrot

[Tutor] "local variable 'l1' referenced before assignment"

2008-06-27 Thread Dick Moores
quot;E:\PythonWork\timing_2_stupidsV2.py", line 15, in a2     l1 += l2 UnboundLocalError: local variable 'l1' referenced before assignment === Thanks, Dick Moores ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

  1   2   3   4   5   6   >