Re: [Tutor] Python and algorithms

2010-02-18 Thread C.T. Matsumoto
Shashwat Anand wrote: Solving problems on ACM UVA , SPOJ , Codechef helps too plus it is fun. On Thu, Feb 18, 2010 at 11:48 PM, Alan Gauld mailto:alan.ga...@btinternet.com>> wrote: "C.T. Matsumoto" mailto:c.t.matsum..

Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5

2010-02-18 Thread Wayne Watson
There's a bit of an anomaly. I've compiled 3 small programs now, and in cmd prompt a Dir does not find the file. It finds the py file, but not the completed file. Nevertheless, if I type in the prefix, the desired program executes. On 2/18/2010 4:48 PM, Wayne Watson wrote: Got it. Fooled mysel

Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5

2010-02-18 Thread Wayne Watson
Got it. Fooled myself. I'm converting to Win7 and have my XP keyboard and monitor side by side with the same for XP. I did the world program in XP and py2exe module in W7!! world compiled and ran successfully. Now for a bigger program with matplotlib and tkinter. Maybe I'll just settle for a

Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5

2010-02-18 Thread Wayne Watson
It imported setup fine from the IDLE cmd prompt. Win Cmd prompt is fine to operate it. Just curious about IDLE. I looked in setup.py and don't see what the complaint is. It sure thinks py2exe is not available. I'm now in IDLE's path browser. I see pkgs in ...\lib\site-packages like dateutil, n

Re: [Tutor] "Sounding" Off, IDLE (Win7)

2010-02-18 Thread Luke Paireepinart
System Speaker is just the driver for the builtin speaker in your computer (but it will redirect sound to your main speakers if you have some). You'll get sounds out of your regular speakers, you just won't get system beeps anymore, if you disable System Speaker. On Thu, Feb 18, 2010 at 6:09 PM,

Re: [Tutor] "Sounding" Off, IDLE (Win7)

2010-02-18 Thread Wayne Watson
Nothing to do with Ctrl-G. Cmd Prompt not open. So if you have a syntax error, no bell rings? I don't want to disable all sounds. On 2/17/2010 2:48 AM, Michael M Mason wrote: Wayne Watson wrote on 16 February 2010 at 17:58:- In Win7 IDLE, when I type in something with a syntax problem, a

Re: [Tutor] Python and algorithms

2010-02-18 Thread Shashwat Anand
Solving problems on ACM UVA , SPOJ, Codechef helps too plus it is fun. On Thu, Feb 18, 2010 at 11:48 PM, Alan Gauld wrote: > > "C.T. Matsumoto" wrote > > I'd say sharpening my problem solving skills. I thought that was often >

Re: [Tutor] Python and algorithms

2010-02-18 Thread Alan Gauld
"C.T. Matsumoto" wrote I'd say sharpening my problem solving skills. I thought that was often tied to building an algorithm. The example Walter Prins provided I thought fit what I was looking for. "To keep this simple and practical, as a suggestion, consider the problem of sorting a list (a

Re: [Tutor] Python and algorithms

2010-02-18 Thread Alan Gauld
"C.T. Matsumoto" wrote Can someone point me to any resources that can teach me about algorithms in python? algorithm books tend to be fairly language neutral. Search for books by Donald Knuth, his books tend to be considered the canonical references on algorithms in computing. I'm interes

Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5

2010-02-18 Thread Robert Berman
> -Original Message- > From: tutor-bounces+bermanrl=cfl.rr@python.org [mailto:tutor- > bounces+bermanrl=cfl.rr@python.org] On Behalf Of Wayne Watson > Sent: Wednesday, February 17, 2010 10:07 PM > To: tutor@python.org > Subject: Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP

[Tutor] pyMVPA and OSError

2010-02-18 Thread Juli
Dear All, I am very much new to python, therefore I am likely to feel stupid about asking this. I need pyMPVA module to play around with some fMRI data. I have installed Python2.6 on Mac OS X Leopard. When I input >>> import mvpa i get a deprecation warning, which is not a problem, however when I

Re: [Tutor] Python and algorithms

2010-02-18 Thread C.T. Matsumoto
Kent Johnson wrote: On Thu, Feb 18, 2010 at 9:43 AM, C.T. Matsumoto wrote: Here is the example. "To keep this simple and practical, as a suggestion, consider the problem of sorting a list (a pack of cards, or a list of names or whatever you want) into order." Yes, there are many built-ins

Re: [Tutor] Python and algorithms

2010-02-18 Thread Kent Johnson
On Thu, Feb 18, 2010 at 9:43 AM, C.T. Matsumoto wrote: > Here is the example. > > "To keep this simple and practical, as a suggestion, consider the problem of > sorting a list (a pack of cards, or a list of names or whatever you want) > into order." > > Yes, there are many built-ins that wrap goo

Re: [Tutor] Python and algorithms

2010-02-18 Thread C.T. Matsumoto
Kent Johnson wrote: On Thu, Feb 18, 2010 at 8:17 AM, C.T. Matsumoto wrote: Kent Johnson wrote: But is that what you are asking for, or are you trying to sharpen your problem-solving skills? Many progamming problems are solved by simple loops and data structures without explicitly

Re: [Tutor] Python and algorithms

2010-02-18 Thread Kent Johnson
On Thu, Feb 18, 2010 at 8:17 AM, C.T. Matsumoto wrote: > Kent Johnson wrote: >> But is that what you are asking for, or are you trying to sharpen your >> problem-solving skills? Many progamming problems are solved by simple >> loops and data structures without explicitly using any algorithms that

Re: [Tutor] Python and algorithms

2010-02-18 Thread Shashwat Anand
One approach can be to go for CLRS and code the algorithms in python. However I am not too sure you can grasp it at your level. Also if you think your maths skills are not there yet, I suggest improve your math skills first. On Thu, Feb 18, 2010 at 6:47 PM, C.T. Matsumoto wrote: > Kent Johnson wr

Re: [Tutor] Python and algorithms

2010-02-18 Thread C.T. Matsumoto
Kent Johnson wrote: On Thu, Feb 18, 2010 at 4:59 AM, C.T. Matsumoto wrote: Hello Tutors, Can someone point me to any resources that can teach me about algorithms in python? I'm interested in learning how to analyze and make an algorithm. I have been reading The Algorithm Design Manu

Re: [Tutor] How to delete the last line from a file efficiently?

2010-02-18 Thread Rohit Kumar
Here is the efficient code than your code: ==CODE== lines = file('file1.txt', 'r').readlines() print lines del lines[-1] print lines file('file1.txt', 'w').writelines(lines) Please let me know if any issues. Reg

Re: [Tutor] Python and algorithms

2010-02-18 Thread Kent Johnson
On Thu, Feb 18, 2010 at 4:59 AM, C.T. Matsumoto wrote: > Hello Tutors, > > Can someone point me to any resources that can teach me about algorithms in > python? > > I'm interested in learning how to analyze and make an algorithm. I have been reading The Algorithm Design Manual http://www.algorist

Re: [Tutor] Python and algorithms

2010-02-18 Thread Christian Witts
C.T. Matsumoto wrote: Thanks Christian, I'd found that resource and at first glance it looks above my head. The book also has examples based on existing algorithms and analyzes them. When I said analyze I suppose I meant analyze a problem and make an algorithm out of that. Not to mention the

Re: [Tutor] pure symbol -- __subtype__

2010-02-18 Thread Steven D'Aprano
On Thu, 18 Feb 2010 08:13:33 pm spir wrote: > Hello, > > I was lately implementing a kind of "pure symbol" type. What I call > pure symbols is these kinds of constants that refer to pure "idea", > so that they have no real obvious value. We usually _arbitrarily_ > give them as value an int, a strin

Re: [Tutor] How to delete the last line from a file efficiently?

2010-02-18 Thread Christian Witts
Joson wrote: Hi all, Now I have a text file about 1MB. Sometimes I need to remove the last line. The current method I use is reading all content, finding the last sentence, remove it and write the new content to the file. So, it need to read a 1MB file and write a 1MB file. It's i

Re: [Tutor] Python and algorithms

2010-02-18 Thread C.T. Matsumoto
Thanks Christian, I'd found that resource and at first glance it looks above my head. The book also has examples based on existing algorithms and analyzes them. When I said analyze I suppose I meant analyze a problem and make an algorithm out of that. Not to mention the math is out of my skil

Re: [Tutor] Python and algorithms

2010-02-18 Thread Christian Witts
C.T. Matsumoto wrote: Hello Tutors, Can someone point me to any resources that can teach me about algorithms in python? I'm interested in learning how to analyze and make an algorithm. Oh, I have no background in math, but a sturdy knowledge of python, and I want to make more efficient cod

[Tutor] Python and algorithms

2010-02-18 Thread C.T. Matsumoto
Hello Tutors, Can someone point me to any resources that can teach me about algorithms in python? I'm interested in learning how to analyze and make an algorithm. Oh, I have no background in math, but a sturdy knowledge of python, and I want to make more efficient code. Cheers, Todd _

[Tutor] How to delete the last line from a file efficiently?

2010-02-18 Thread Joson
Hi all, Now I have a text file about 1MB. Sometimes I need to remove the last line. The current method I use is reading all content, finding the last sentence, remove it and write the new content to the file. So, it need to read a 1MB file and write a 1MB file. It's ineffictient, I thi

Re: [Tutor] pure symbol -- __subtype__

2010-02-18 Thread spir
PS: see also on the topic: http://en.wikipedia.org/wiki/Enumerated_type On Thu, 18 Feb 2010 10:13:33 +0100 spir wrote: > Hello, > > I was lately implementing a kind of "pure symbol" type. What I call pure > symbols is these kinds of constants that refer to pure "idea", so that they > have no

[Tutor] pure symbol -- __subtype__

2010-02-18 Thread spir
Hello, I was lately implementing a kind of "pure symbol" type. What I call pure symbols is these kinds of constants that refer to pure "idea", so that they have no real obvious value. We usually _arbitrarily_ give them as value an int, a string, a boolean, an empty object: BLACK, WHITE = Fal