Re: [Tutor] Good approach regarding classes attributes

2014-09-11 Thread Brian van den Broek
a new employer that tells my students my name is 'Van Den Broek' when I tell them that it is 'van den Broek.' This is the third time this week I've encountered this as a programming example. Perhaps the use of the example is responsible for the false belief amongst programm

Re: [Tutor] How inefficient is this code?

2014-05-07 Thread Brian van den Broek
On May 7, 2014 8:42 PM, "C Smith" wrote: > > I guess intuiting efficiency doesn't work in Python because it is such > high-level? Or is there much more going on there? Hi, The level is a good part, yes. If, like me, you don't know what C constructs are under python constructs, you are guessing

Re: [Tutor] How inefficient is this code?

2014-05-07 Thread Brian van den Broek
On May 7, 2014 7:30 PM, "C Smith" wrote: > Someone suggested projecteuler.net and I started blazing through > things I had done before, when I realized this would be a good time to > start more efficient practices instead of code that just happens to > work and may be very inefficient. > > #sum

Re: [Tutor] sending email via SMTP: code review requested

2014-05-05 Thread Brian van den Broek
On 5 May 2014 13:53, Steven D'Aprano wrote: > On Sun, May 04, 2014 at 07:00:24PM -0400, Brian van den Broek wrote: >> Hi all, >> >> I am playing with the smtp and email modules from the standard library >> of Python 2.7.3 (I also want it to run on 2.6.6). I

Re: [Tutor] Alice_in_wonderland Question

2014-05-04 Thread Brian van den Broek
On May 4, 2014 11:13 PM, "Jake Blank" wrote: > > To figure that last part out I just did a simple if statement. > for k in sorted(word_count, key=lambda x:word_count[x], reverse=True): > if word_count[k] >=300: > print (k, word_count[k]) > And the output was correct. Jake,

Re: [Tutor] Alice_in_wonderland Question

2014-05-04 Thread Brian van den Broek
he user specifying the file is a little off but > besides that I am able to return all of the words in the story with the > number of times they occur alphabetically. In order to return the sorted > list by number of times that each word occurs I am a little confused if i > have to change

Re: [Tutor] Alice_in_wonderland Question

2014-05-04 Thread Brian van den Broek
On May 4, 2014 8:31 PM, "Jake Blank" wrote: > > Hi, > So I'm doing a problem on the Alice_in_wonderland.txt where I have to write a > program that reads a piece of text from a file specified by the user, counts > the number of occurrences of each word, and writes a sorted list of words and > th

[Tutor] sending email via SMTP: code review requested

2014-05-04 Thread Brian van den Broek
Hi all, I am playing with the smtp and email modules from the standard library of Python 2.7.3 (I also want it to run on 2.6.6). I've not found the going easy; the SMTP and RFC 2822 standards are not ones I have worked with before. I have something that works, but I am not confident I am doing the

Re: [Tutor] Cantor pairing in three dimensions?

2013-12-25 Thread Brian van den Broek
On 24 December 2013 16:21, Brian van den Broek wrote: > On 23 December 2013 13:32, Danny Yoo wrote: >> >> I've got a puzzle: so there's a well-known function that maps the >> naturals N to N^2: it's called Cantor pairing: >> >> http://en.wi

Re: [Tutor] Cantor pairing in three dimensions?

2013-12-24 Thread Brian van den Broek
On 23 December 2013 13:32, Danny Yoo wrote: > > I've got a puzzle: so there's a well-known function that maps the > naturals N to N^2: it's called Cantor pairing: > > http://en.wikipedia.org/wiki/Pairing_function > > It's one of those mind-blowing things that I love. I ran across it a > few y

Re: [Tutor] [OT] Replies go to individuals, not the list?

2013-08-20 Thread Brian van den Broek
On Aug 20, 2013 3:04 PM, "Andy McKenzie" wrote: > > On Tue, Aug 20, 2013 at 2:53 PM, Alan Gauld wrote: >> >> On 20/08/13 13:15, Andy McKenzie wrote: >> >>> Yep. Someone decided it didn't make sense for "reply" to go to the list >>> that sent the message >> >> >> Lists never send messages. People

Re: [Tutor] Clear screen questions

2013-05-05 Thread Brian van den Broek
On 5 May 2013 23:12, Steven D'Aprano wrote: > > On 06/05/13 12:37, Brian van den Broek wrote: >> Try: >> >> def pragmatic_as_if_clear(): >> print '\n' * 100 >> >> which isn't too far off of what clear does in bash. > &

Re: [Tutor] Clear screen questions

2013-05-05 Thread Brian van den Broek
On 5 May 2013 22:10, boB Stepp wrote: > On Sun, May 5, 2013 at 7:54 PM, Steven D'Aprano > wrote: > > > > >> So my main question is there a truly clean, cross-platform solution to > >> the clear screen dilemma? If my online searching is accurate, then the > >> answer appears to be no, unless

Re: [Tutor] creating dictionary from a list

2013-04-13 Thread Brian van den Broek
On 12 Apr 2013 21:25, "Steven D'Aprano" wrote: > Also, you might find it easier to process the list if you strip out empty items. There are two simple ways to do it: > > > lst = [x for x in list if x != ''] > # or > lst = filter(None, lst) Hi all, For the first, I would use lst = [x for x in l

Re: [Tutor] Additional help

2013-02-10 Thread Brian van den Broek
On 10 February 2013 15:29, Ghadir Ghasemi wrote: > Hi guys, I wondered if you knew what I could add to this code so that when > the user enters 1 from the menu and then doesn't enter a valid binary number > the program should ask them over and over again until valid binary number is > entered.

Re: [Tutor] using 'and ' and 'or' with integers

2013-01-09 Thread Brian van den Broek
On 9 January 2013 01:56, ken brockman wrote: > I was looking through some lab material from a computer course offered at UC > Berkeley and came across some examples in the form of questions on a test > about python. > 1 and 2 and 3 > answer 3 > I've goggled it till i was red in the fingers, but t

Re: [Tutor] writing effective unittests

2013-01-04 Thread Brian van den Broek
On 4 January 2013 03:34, Alan Gauld wrote: > On 04/01/13 07:10, Brian van den Broek wrote: > ... > >> confirm that the code works as intended when written, but that it >> continues to work several moths later > > > moths? They'll be the bugs I guess? >

Re: [Tutor] writing effective unittests

2013-01-03 Thread Brian van den Broek
On 3 January 2013 14:46, Luke Thomas Mergner wrote: > * Albert-Jan Roskam wrote: > >> >> >> > Hi, >> >> > >> > I am trying to learn a bit of test-driven programming using unittests and >> > nosetests. I am having trouble finding resources that explain how to write >> > effective tests. I am not a

Re: [Tutor] still confused about for loops

2012-12-19 Thread Brian van den Broek
On 19 December 2012 01:19, Brandon Merritt wrote: > Sorry, I am just so confused and aggravated as to why this won't work - why > doesn't it print out the whole list? : > > number = raw_input('Enter a 7-unit number: ') > > for i in number: > count = [] > count.append(i) > > print count > >

[Tutor] Fwd: Re: Tutor Digest, Vol 106, Issue 31

2012-12-14 Thread Brian van den Broek
Forwarding to the list what I sent privately. Stupid android UI. -- Forwarded message -- From: "Brian van den Broek" Date: 14 Dec 2012 10:01 Subject: Re: [Tutor] Tutor Digest, Vol 106, Issue 31 To: "Waters, Mike [ITSCA Non-J&J]" On 14 Dec 2012 08:43, &q

Re: [Tutor] reverse diagonal

2012-12-01 Thread Brian van den Broek
On 1 December 2012 20:12, Dave Angel wrote: > On 12/01/2012 11:28 AM, Brian van den Broek wrote: >> On 1 December 2012 10:40, richard kappler wrote: >>> I'm working through Mark Lutz's "Python," reviewing the section on lists. I >>> understand the

Re: [Tutor] reverse diagonal

2012-12-01 Thread Brian van den Broek
On 1 December 2012 10:40, richard kappler wrote: > I'm working through Mark Lutz's "Python," reviewing the section on lists. I > understand the list comprehension so far, but ran into a snag with the > matrix. I've created the matrix M as follows: > > M = [[1, 2, 3[, [4, 5, 6], [7, 8, 9]] > > then

Re: [Tutor] run with default value if input not given

2012-10-29 Thread Brian van den Broek
On 29 Oct 2012 02:30, "Saad Javed" wrote: > > I've come up with this: > > try: > sys.argv[1] > x = sys.argv[1] > main(x) > except IndexError: > main(x) > > It works but seems hackish. > > Saad Saad, The first sys.argv is not needed. Notice how i have replied below the text i am quoting? That is

Re: [Tutor] urllib2.urlopen()

2012-10-13 Thread Brian van den Broek
On 14 October 2012 02:15, Ray Jones wrote: > On 10/13/2012 07:50 PM, Steven D'Aprano wrote: >> If you can do `print e.info()`, then you can also do `info = e.info()` >> and inspect the info programmatically. >> > One would expect that to be true. But when I do info = e.info(), info is > . > > Wh

Re: [Tutor] urllib2.urlopen()

2012-10-13 Thread Brian van den Broek
On 13 October 2012 19:44, Ray Jones wrote: > I am attempting to capture url headers and have my script make decisions > based on the content of those headers. > > Here is what I am using in the relative portion of my script: > > try: > urllib2.urlopen('http://myurl.org') > except urllib2.HTTPE

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Brian van den Broek
On 6 Oct 2012 22:40, "Richard D. Moores" wrote: > I remain bewildered. Where did these strangely named things come from, > strftime and strptime? I see that Hi Dick, These names carry over from well entrentched names from C. My guess is format time and print time are what they are supposed to

Re: [Tutor] MAXIMUM LOOP LOGIC

2012-10-04 Thread Brian van den Broek
On 4 Oct 2012 13:22, "medusa" wrote: > > Hello > > i got stuck with the last bit of my programming practice. > Instead of printing off a number beside the email, i got another email and i > dont know how to fix it. > Hi, Is your code

Re: [Tutor] Why difference between printing string & typing its object reference at the prompt?

2012-10-02 Thread Brian van den Broek
On 2 Oct 2012 23:17, "boB Stepp" wrote: > I am puzzled by the results of the following: > > >>> x = "Test" > >>> x > 'Test' > >>> print(x) > Test > > I understand that 'Test' is the stored value in memory where the > single quotes designate the value as being a string data type. So it > makes s

Re: [Tutor] HELP!

2012-10-01 Thread Brian van den Broek
On 1 Oct 2012 19:58, "Mark Rourke" wrote: > > hello, I am a college student in my first year of computer programming, I was > wondering if you could look at my code to see whats wrong with it. > > # Mark Rourke > # Sept 29, 2012 > # Write a program to calculate the sales tax at the rate of 4% and

Re: [Tutor] Lotka-Volterra Model Simulation Questions

2012-10-01 Thread Brian van den Broek
On 1 October 2012 19:30, Alan Gauld wrote: > translation for them, not just complain of their 'ignorance'. But that's now > taking things way, way off topic!! :-) I think you meant ``way^2 off topic'' ;-) Brian vdB ___ Tutor maillist - Tutor@python

Re: [Tutor] Lotka-Volterra Model Simulation Questions

2012-10-01 Thread Brian van den Broek
On 30 September 2012 04:37, Alan Gauld wrote: > > One of the things that makes math hard for people to grasp is its insistence > on abstracting functions/values to single letter names etc. (especially when > those names are in a foreign language/symbology, > like Greek!) Of course, the abstracti

Re: [Tutor] html checker

2012-10-01 Thread Brian van den Broek
On 1 Oct 2012 15:28, "Matthew Dalrymple" wrote: > > I don't need to hear how bad my programs are...either you are gonna help or your not...if Matthew, Bob didn't cuddle you and he may have been a bit more brusque than you'd have liked. However, his response to you was intended as help, it provid

Re: [Tutor] running more than one python program at the same time

2012-08-28 Thread Brian van den Broek
On 28 Aug 2012 18:33, "Benjamin Fishbein" wrote: > > Hello, > I wrote a program that I want to have running 24/7. But the problem is that I also want to write and run other programs. I'm using Idle and it won't let me run more than one script at a time. Do you know if there's a way to do this? Or

Re: [Tutor] How to print something just after 3 attempts?

2012-07-17 Thread Brian van den Broek
On 17 Jul 2012 12:39, "Mark Lawrence" wrote: > > On 17/07/2012 16:28, Paul McNally wrote: >> I was able to get it working like this... >> >> password = "foobar" >> attempt = 0 >> while (password != "unicorn") and (attempt <= 3): > > > Please we're talking Python here not C so strip out those un

Re: [Tutor] str object is not callable

2012-07-10 Thread Brian van den Broek
On 10 Jul 2012 11:31, "Chris Hare" wrote: > > > This piece of code works: > > Big-Mac:Classes chare$ more tmp.py > import re > > return not bool(search(string)) > However, when I use the EXACT same code in the context of the larger code, I get the error > > return not bool(search

[Tutor] [OT] Re: Optimally configuring Emacs for W7-64bit and Python

2012-05-27 Thread Brian van den Broek
On 23 May 2012 05:17, "boB Stepp" wrote: > > but I will not be able to provide much (any?) help in the immediate future. > > > > (If emacs seems like you will stick to it, do have a look at orgmode.) > > > > Brian, does org-mode amount to a personal information manager? What > are the things you

Re: [Tutor] Meaningless

2012-05-27 Thread Brian van den Broek
On 27 May 2012 20:52, "Dave Angel" wrote: > > On 05/27/2012 01:03 PM, Kimberly McManus wrote: > > help > > > > > > Sure. Head for the nearest exit, stopping before each door to make sure > it's not hot before opening it. > Hi Kimberly, While I share Dave's sadness at the general decline of list

Re: [Tutor] Optimally configuring Emacs for W7-64bit and Python

2012-05-22 Thread Brian van den Broek
On 22 May 2012 06:58, "boB Stepp" wrote: > > Many thanks for all of the helpful input to my original questions. The > deciding factors came down to the fact that GNU Emacs, vintage year > 2001, is available on the Sun Blade at work, I already own the book > "Learning GNU Emacs" and it would be nic

Re: [Tutor] While learning Py: To IDE or not to IDE?

2012-05-21 Thread Brian van den Broek
On 21 May 2012 01:19, "boB Stepp" wrote: > > On Sun, May 20, 2012 at 4:44 PM, Brian van den Broek > wrote: > > With you polyglot agenda, I would say you would be much better off to learn > > a powerful multipurpose editor well than to try to find the best of bre

[Tutor] [OT] Re: While learning Py: To IDE or not to IDE?

2012-05-21 Thread Brian van den Broek
On 21 May 2012 03:39, "Steven D'Aprano" wrote: > > boB Stepp wrote: >> now on learning an IDE if it will save me time overall. IF it would be >> beneficial now to learn an IDE, then it begs the question > > > No it doesn't. It RAISES the question -- begging the question means to *assume the ans

Re: [Tutor] While learning Py: To IDE or not to IDE?

2012-05-20 Thread Brian van den Broek
On 20 May 2012 23:04, "boB Stepp" wrote: > Goals: Learn Python. While learning Python, learn all of the good > C.Sc. stuff that I should have learned the first go-around, Learn Java > and C/C++. Reevaluate. > > Finally to the question: With the stated goals above, would it be > better to inv

Re: [Tutor] How to read blog posts in python

2012-05-17 Thread Brian van den Broek
On 17 May 2012 16:31, "Surya K" wrote: > > Hi, > > I want to write a python code which read blog's RSS/ Atom feeds and gives us the all post's content of blog... > > I am currently trying to use FeedParser (Universal Feed Parser). I am able to get all post's titles and URL's but not a content.. >

Re: [Tutor] Sorting the Parts of a Dictionary into a List

2012-05-08 Thread Brian van den Broek
On 8 May 2012 23:23, Jacob Bender wrote: > Dear Tutors, > > My original email was this: > > "Dear tutors, > > I'm trying to create a neural network program. Each neuron is in a > dictionary and each of its connections and their strengths are in a nested > dictionary. So {0:{1:4, 2:5}}, 1:{0:6}, 2:

Re: [Tutor] which gets called

2012-04-06 Thread Brian van den Broek
On 6 April 2012 15:54, John Fabiani wrote: > Hi, > > I want to create a class that inherits two other classes. > > class NewClass( A,B) > > But both "A" and "B" contain a method with the same name ("onKeyDown"). > > If my "NewClass" does not contain something to override the methods which one > wo

Re: [Tutor] How is the return statement working in this function?

2012-04-05 Thread Brian van den Broek
On 6 Apr 2012 02:43, "Greg Christian" wrote: > > I am just wondering if anyone can explain how the return statement in this function is working (the code is from activestate.com)? Where does x come from – it is not initialized anywhere else and then just appears in the return statement. Any help w

Re: [Tutor] Any book to study Python

2012-03-19 Thread Brian van den Broek
On 19 Mar 2012 11:42, "Yan, Xianming" wrote: > > I'm following http://docs.python.org/tutorial/interpreter.html to type in the first script into python. > > According to the link, I typed below: > > >>> the_world_is_flat = 1 > >>> if the_world_is_flat: > ... print "Be careful not to fall off!"

Re: [Tutor] seeing the results of a python program in windows7

2012-03-14 Thread Brian van den Broek
On 15 Mar 2012 04:14, "bob gailer" wrote: > > On 3/14/2012 12:12 PM, Tamar Osher wrote: >> I can run a python program in Notepad++, but what happens is that the black box flashes and disappears immediately, so that I never see the results. >> >> How can I style it so that the results of the pro

Re: [Tutor] Cannot run python programs on my windows7 computer

2012-03-14 Thread Brian van den Broek
On 14 Mar 2012 02:56, "Tamar Osher" wrote: > > Hello. Is there someone who can tutor me about how to "run" Python files on my windows7 computer? I have IDLE (the white box, the Python shell). I have the command prompt (the black box). And I also have Notepad++ on my computer. I have a total o

Re: [Tutor] return integer from function

2012-02-22 Thread Brian van den Broek
On 22 February 2012 12:57, David Craig wrote: > Hi, > I have a function that calculates the distance between two points on a > sphere. It works but I cant get it to return a float for use in another > script. Anyone know how I do that?? > >    cos = (math.sin(phi1)*math.sin(phi2)*math.cos(theta

Re: [Tutor] string integers?

2012-02-12 Thread Brian van den Broek
On 13 February 2012 01:34, William Stewart wrote: > > this is the code I have > > str1 = raw_input("Type in a String: ") > str2 = raw_input("Type in a String: ") > int1 = raw_input("Type in a integer variable: ") > int2 = raw_input("Type in a integer variable: ") > print str1 + str2 + int1 + int2

Re: [Tutor] string integers?

2012-02-12 Thread Brian van den Broek
On 12 February 2012 21:27, William Stewart wrote: > > thanks i tried the code and it doesnt make anydiffference what I need is it > to multiply now I fixed the error message but how do I get the 2 numbers that > the person enters to multiply > > --- On Sun, 2/12/12, B

Re: [Tutor] exercise with classes 2nd attempt

2012-02-12 Thread Brian van den Broek
On 12 Feb 2012 05:23, "Tonu Mikk" wrote: > > I am learning Python using the "Learn Python the Hard Way" book by Zed Shaw. I reached exercise 42 where we learn about Python classes. The exercise shows a game with one class that includes all the definitions for playing the game. For extra credit

Re: [Tutor] string integers?

2012-02-12 Thread Brian van den Broek
On 12 Feb 2012 15:28, "William Stewart" wrote: > > I am trying to get 2 string variables and 2 integer variables to be able to be multiplied > can anyone tell me what I did wrong > > str1 = raw_input("Type in a String: ") > str2 = raw_input("Type in a String: ") > int1 = raw_input("Type in a integ

Re: [Tutor] Learn Python The Hard Way, Ex19-3

2012-02-11 Thread Brian van den Broek
On 12 Feb 2012 00:29, "amt" <0101...@gmail.com> wrote: > > Hello! I'm currently stuck at the Extra Credit 3 from LPTHW. > > Link to the actual exercise: http://learnpythonthehardway.org/book/ex19.html > The exercise: > Write at least one more function of your own design, and run it 10 > different w

Re: [Tutor] How to make def where arguments are either stated when called or entered via raw_input

2012-02-09 Thread Brian van den Broek
On 9 Feb 2012 13:34, "David Craig" wrote: > > Hi, > I'm trying to write a function that will either take arguments when the function is called, such as myFunc(x,y,z) or if the user does not enter any arguments, myFunc() the raw_input function will ask for them. But I dont know how to check how man

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Brian van den Broek
Kent Johnson said unto the world at 15/01/09 12:33 PM: On Thu, Jan 15, 2009 at 11:48 AM, Brian van den Broek wrote: The (recognized by me as) relevant bits of output are: Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\texlive\2008\bin\win32;C:\Python26 PATHEXT

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Brian van den Broek
Brian van den Broek said unto the world at 15/01/09 11:27 AM: Alan Gauld said unto the world at 14/01/09 07:34 PM: "Brian van den Broek" wrote DOS prompt and replies including Alan's suggestion to get a text file dump of environment variables.> With the full pat

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Brian van den Broek
Alan Gauld said unto the world at 14/01/09 07:34 PM: "Brian van den Broek" wrote icon for Idle launching as expected. When run from IDLE, `print sys.executable' yields `C:\\Python26\\pythonw.exe'. He reports that C:\Python26 contains both python.exe and pythonw.exe.

[Tutor] help with getting python to run from command prompt on Windows XP

2009-01-14 Thread Brian van den Broek
Hi all, I'm trying, via email, to help a friend set up python on his Windows XP computer. I've been strictly linux for some time now, and don't have a Windows machine on which to investigate. We've hit a problem, and I'd appreciate a push. He's got python 2.6.1 installed as evidenced by the Star

[Tutor] help with getting python to run from command prompt on Windows XP

2009-01-14 Thread Brian van den Broek
Hi all, I'm trying, via email, to help a friend set up python on his Windows XP computer. I've been strictly linux for some time now, and don't have a Windows machine on which to investigate. We've hit a problem, and I'd appreciate a push. He's got python 2.6.1 installed as evidenced by the

Re: [Tutor] hi...

2008-08-24 Thread broek
- Message from [EMAIL PROTECTED] - Date: Sun, 24 Aug 2008 01:31:28 -0500 From: Alberto Perez <[EMAIL PROTECTED]> Reply-To: Alberto Perez <[EMAIL PROTECTED]> Subject: [Tutor] hi... To: tutor@python.org run a program in interactive mode, the program run very good, but i

[Tutor] puzzling EOFError when mocking raw_input in doctest

2008-08-10 Thread broek
Hi all, I've continued playing about with mocking raw_input in doctests in light of Kent's reply. I've hit an odd thing---if my substitute for raw_input returns '', I get an EOFError. The code below shows the problem. It arises equally if myrawalt is used in the doctest in place of myraw

Re: [Tutor] using generators to mock raw_input for doctest

2008-08-10 Thread broek
- Message from [EMAIL PROTECTED] - Date: Sun, 10 Aug 2008 14:03:38 -0400 From: Kent Johnson <[EMAIL PROTECTED]> Reply-To: Kent Johnson <[EMAIL PROTECTED]> Subject: Re: [Tutor] using generators to mock raw_input for doctest On Sun, Aug 10, 2008 at 1:38 AM, <[EMAIL PROTECTED

[Tutor] using generators to mock raw_input for doctest

2008-08-09 Thread broek
Hi all, I'm building a tool that will be run in a shell and depends heavily on raw_input. I'm also using doctest (mostly via doctest.testfile) to create unit tests for it. After thinking a while about how to use doctest for invocations of raw_input, I came up with the general sort of idea shown

Re: [Tutor] TypeError: not enough arguments for format string

2008-07-02 Thread broek
- Message from [EMAIL PROTECTED] - Date: Wed, 02 Jul 2008 14:32:27 -0400 From: bob gailer <[EMAIL PROTECTED]> [EMAIL PROTECTED] wrote: [snip] In a case like print '%s%s' %42 , 333 ... TypeError: not enough arguments for format string it would be ambiguous whether 3

Re: [Tutor] TypeError: not enough arguments for format string

2008-07-02 Thread broek
- Message from [EMAIL PROTECTED] - Date: Wed, 2 Jul 2008 16:49:19 +1200 From: John Fouhy <[EMAIL PROTECTED]> On 02/07/2008, Christopher Spears <[EMAIL PROTECTED]> wrote: File "point.py", line 13, in __str__ point_str = "(%f,%f)" % self.x, self.y TypeError: not enoug

Re: [Tutor] Removing files based upon time stamps

2008-06-25 Thread broek
- Message from [EMAIL PROTECTED] - Date: Thu, 26 Jun 2008 04:53:14 +0700 From: Lie Ryan <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] Subject: [Tutor] Removing files based upon time stamps To: tutor@python.org I'm not sure what caused your problem, but... ?os.ch

Re: [Tutor] Using Python in Windows

2008-06-25 Thread broek
- Message from [EMAIL PROTECTED] - Date: Tue, 24 Jun 2008 18:27:59 -0700 From: Ben <[EMAIL PROTECTED]> Hi, I'm trying to learn Python in Windows XP. I've been going through the Python version of Allen Downey's open source textbook. I frequently find that the instructions h

Re: [Tutor] Astonishing timing result

2008-06-24 Thread broek
- Message from [EMAIL PROTECTED] - Date: Tue, 24 Jun 2008 13:44:00 -0700 From: Dick Moores <[EMAIL PROTECTED]> At 12:44 PM 6/24/2008, Kent Johnson wrote: On Tue, Jun 24, 2008 at 1:43 PM, Dick Moores <[EMAIL PROTECTED]> wrote: Output: t1 is 0.000104, no function t2 is 5.87e

Re: [Tutor] From Newbie

2008-06-22 Thread broek
But when i write while a != 0: and then i press enter, python terminal tell me : while a ! = 0: File "", line 1 while a ! = 0: ^ SyntaxError: invalid syntax Can you find my mistake, guys ? Sorry to bother you, I try to Hi, Python's trying to give you a hint: while

Re: [Tutor] my own error code when no argument is sent

2008-06-17 Thread broek
when i execute my program without an argument i receive, infile = sys.argv[1] IndexError: list index out of range is there a way that i could suppress this and add my own error code Hi Bryan, You are probably better off pursuing Danny's suggestion. But, this is what you asked for:

[Tutor] OT: tutor list equivalent for lisp?

2008-06-05 Thread broek
Hi all, I've an off-topic query; hope no one minds. I've poked into the lisp world a bit before (started SICP, etc., but never used it in anger), and put it on my `when I've more time' shelf. Well, my desire to extend emacs has made me want to get more serious about it. Does anyone kno

Re: [Tutor] Key Error

2007-07-07 Thread Brian van den Broek
Sara Johnson said unto the world upon 07/08/2007 01:34 AM: > Sorry, this is probably too general a question, but I can't find > any specific information on it. What exactly is a "key error" and > how do I clear it? > > I entered something like this: > > abcd=h[key]['ABCD'] > > and when I run it

Re: [Tutor] Money matters

2007-06-28 Thread Brian van den Broek
Terry said unto the world upon 06/28/2007 02:55 PM: > I am going to need to be handling money calculations and was wondering > about the float problem > in my calculations. > > Should I simply run the results of all calculations through something > like this: > > from __future__ import division

[Tutor] subprocess and launching an editor

2007-06-22 Thread Brian van den Broek
Hi all, I want to have a script launch an editor open to a particular file and wait until that editor has closed before continuing. The aim is to allow the user to make edits to the file, have to script know that the edits are completed, and then make use of the newly saved file contents. gedi

Re: [Tutor] More trouble debugging my game of life program

2007-06-03 Thread Brian van den Broek
Matt Smith said unto the world upon 06/03/2007 04:12 PM: > Hi, > > I've got my program working correctly (or so it seems) with my original > data file (r-pentomino.txt - attached) but when I run it with a larger > (30*30) file (big-r-pentomino - also attached) in an attempt to make it > work with

Re: [Tutor] Design Question

2007-06-01 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 06/01/2007 10:46 AM: > I think I may have sent an incomplete version of this question a moment ago > (sorry). Here is the complete question: > > I'm designing something along the lines of a flash card program. It's mostly > just an exercise in learning

Re: [Tutor] [Fwd: Re: trouble with "if"]

2007-05-30 Thread Brian van den Broek
Adam Urbas said unto the world upon 05/30/2007 11:01 AM: > I can't exactly show you the error message anymore, because the program is > now screwed up in so many ways that I can't even get it to do the things it > used to. > > It says things like ERROR: Inconsistent indentation detected! > 1) Your

[Tutor] [Fwd: Re: trouble with "if"]

2007-05-29 Thread Brian van den Broek
Another fwd, folks. Brian vdB Original Message Subject: Re: [Tutor] trouble with "if" Date: Tue, 29 May 2007 23:28:46 -0500 From: Adam Urbas <[EMAIL PROTECTED]> To: Brian van den Broek <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> <[

[Tutor] [Fwd: Re: trouble with "if"]

2007-05-29 Thread Brian van den Broek
hanism you want to use to reply to the list and the original sender rather than just the sender. Best, Brian vdB Original Message Subject: Re: [Tutor] trouble with "if" Date: Tue, 29 May 2007 23:07:57 -0500 From: Adam Urbas <[EMAIL PROTECTED]> To: Brian van

Re: [Tutor] gmail

2007-05-29 Thread Brian van den Broek
Adam Urbas said unto the world upon 05/29/2007 11:57 PM: > Ok, I'm not sure if I'm in the right gmail. When I type I don't see > any buttons that say rich text or plain text. Only Send, Save Draft, > and Discard. > > And I have no idea what jim is talking about. Please clarify. > > On 5/29/07,

Re: [Tutor] trouble with "if"

2007-05-29 Thread Brian van den Broek
adam urbas said unto the world upon 05/29/2007 12:39 PM: > The scary part is, I think I understand this. I copied your last > example and put it in IDLE and it doesn't like you code. Never > mind. I figured it out. So that is so it will notify you if your > choice is invalid. Nice lil tidbit o

Re: [Tutor] trouble with indents

2007-05-27 Thread Brian van den Broek
adam urbas said unto the world upon 05/28/2007 12:24 AM: > Thanks for the clarification, but I'm still a tad confused. I'm > not sure when to indent. I understand that it has to be done. > That link was really confusing. Very newb non-friendly. Arrg... > That site is doom. So confusing. I nee

Re: [Tutor] trouble with "if"

2007-05-27 Thread Brian van den Broek
adam urbas said unto the world upon 05/27/2007 01:49 PM: > Thank you for the help Brian. I would like to ask you about these > things. Which one of the examples you gave would be most fool > proof. Hi Adam and all, Adam was asking about how to use raw_input to drive a basic command prompt m

Re: [Tutor] trouble with "if"

2007-05-23 Thread Brian van den Broek
adam urbas said unto the world upon 05/23/2007 01:04 PM: > Sorry, I don't think Hotmail has turn off HTML. If it does I > havn't been able to find it. I think you're going to have to > explain your little bit of text stuff down there at the bottom. I > have no idea what most of that means. All

Re: [Tutor] trouble with "if"

2007-05-23 Thread Brian van den Broek
adam urbas said unto the world upon 05/23/2007 11:57 AM: > > Hi all, > > I've been working with this new program that I wrote. I started out > with it on a Ti-83, which is much easier to program than python. Now > I'm trying to transfer the program to python but its proving to be quite > dif

Re: [Tutor] Rounding to nearest cent

2007-05-22 Thread Brian van den Broek
Jessica Brink said unto the world upon 05/22/2007 09:08 AM: > How would I round to the nearest cent when doing calculations with dollar > amounts? > > -Jess > Hi Jess, The decimal module was introduced in large part to facilitate financial calculations. Have a look at

Re: [Tutor] Function for converting ints from base10 to base2?

2007-02-21 Thread Brian van den Broek
Dick Moores said unto the world upon 02/21/2007 08:08 PM: > At 05:17 PM 2/21/2007, Terry Carroll wrote: >> I like the approach of mapping hex or octal digits posted by Alan and Bob, >> but, not thinking of that, this would be my straightforward approach: >> >> def computeBin(n): >> """conve

Re: [Tutor] shebang problem

2006-11-05 Thread Brian van den Broek
Alan Gauld said unto the world upon 11/04/2006 06:47 PM: > [EMAIL PROTECTED]:~/test$ ls -la shebangtest.py > -rwxr-xr-- 1 brian brian 68 2006-11-04 02:29 shebangtest.py > > so the file is called shebangtest.py... > >> [EMAIL PROTECTED]:~/test$ shebangtest >> bash: shebangtest: command not found >

[Tutor] shebang problem

2006-11-04 Thread Brian van den Broek
Hi all, I'm still getting comfortable with Linux and this might be an OS rather than a python problem. I am trying to make a script directly executable. I've reviewed the 2nd ed of the Nutshell, and I cannot work out what I'm doing wrong. I'm running ubunutu 6.10 (edgy eft). Here's a copy past of

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Brian van den Broek
Asrarahmed Kadri said unto the world upon 19/10/06 12:55 PM: > My algorithm is like this: > first count the number of lines in the file by using a loop. > Use a second loop and when teh counter reaches the num_of_lines values: > take > the line. > > Is there any other way to do it?? > > > > On

Re: [Tutor] What is a Python "project"?

2006-10-03 Thread Brian van den Broek
Dick Moores said unto the world upon 03/10/06 01:41 PM: > At 10:01 AM 10/3/2006, Mike Hansen wrote: >> I've been doing some web programming, so my "projects" consist of >> cheetah template files, CSS, config files, a handful of python >> modules... > > Why do you make python modules part of a p

Re: [Tutor] Lists in lists

2006-09-17 Thread Brian van den Broek
Kent Johnson said unto the world upon 16/09/06 07:49 PM: > Brian van den Broek wrote: >> Kent Johnson said unto the world upon 16/09/06 04:35 PM: >>> Brian van den Broek wrote: > >>>> You say you are new to Python. Well, it might not now be obvious why >&g

Re: [Tutor] folder and module

2006-09-17 Thread Brian van den Broek
linda.s said unto the world upon 17/09/06 02:03 PM: > I checked sys.path and environemntal variables: > since the desktop directory is not listed in either of them, > why there is no error report when I import a module which is in the > desktop into test.py which is under a different folder? > L

Re: [Tutor] Lists in lists

2006-09-16 Thread Brian van den Broek
Kent Johnson said unto the world upon 16/09/06 04:35 PM: > Brian van den Broek wrote: >> Morten Juhl Johansen said unto the world upon 16/09/06 08:29 AM: >>> # Newbie warning >>> I am making a timeline program. It is fairly simple. >>> I base it on appending

Re: [Tutor] Lists in lists

2006-09-16 Thread Brian van den Broek
Morten Juhl Johansen said unto the world upon 16/09/06 08:29 AM: > # Newbie warning > I am making a timeline program. It is fairly simple. > I base it on appending lists to a list. > Ex. > [[year1, "headline1", "event text1"], [year2, "headline2", "event text2"]] > > This seemed like a brilliant i

[Tutor] [OT] Re: Limiting Characters

2006-08-22 Thread Brian van den Broek
tware that gives you your last name as your user name, except when it doesn't ;-) Brian van den Broek ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] All of Kermit's E-Mails

2006-08-17 Thread Brian van den Broek
Kermit Rose said unto the world upon 17/08/06 02:38 PM: > Now if I can only get Thunderbird to quit treating the up and down arrow > as a page up or page down, > whenever it's at the top line or bottom line of what it thinks is a page. Hi Kermit, I'm glad you've given Thunderbird a try and tha

Re: [Tutor] Which Book

2006-08-17 Thread Brian van den Broek
Nagendra Singh said unto the world upon 17/08/06 12:14 PM: > Hi All, > > I have very little programming experience, I have decided to learn > Python..there are tons of material and refernces on the web-pages, can > you guys please suggest what is the best way to start or which ONE > book which I s

Re: [Tutor] All of Kermit's E-Mails

2006-08-17 Thread Brian van den Broek
Danny Yoo said unto the world upon 17/08/06 12:16 PM: >> Suggest an alternative way of transmitting code. > > Hi Kermit, > Just as a side note: you may want to investigate a good email client such > as Thunderbird if you have spare time. > > http://www.mozilla.com/thunderbird/ > > Much

  1   2   3   4   >