[Tutor] Could I modify codes and validate immediately without restart program?

2011-05-26 Thread charlze
Hi, guys. Here is a demo program like this: aa = 3 bb = 4 cc = 53 dd = 6 print cc I put a breakpoint at the first line, then debug the program. After 'aa' is set to '3', I modify '53' in the 3rd line to '34', then save the source file and run remain codes. As expected, the output is '53'. Does p

Re: [Tutor] Non programmer wanting to become programmer

2011-05-26 Thread Wayne Werner
On Thu, May 26, 2011 at 2:36 PM, amt <0101...@gmail.com> wrote: > First of all, hello! I want to start learning programming. I'm looking > into becoming more than a hobbyist programmer. I searched a lot on Google on > what programming language should I learn first and I see a lot of good words >

Re: [Tutor] Python Interview Questions..

2011-05-26 Thread Marc Tompkins
On Thu, May 26, 2011 at 5:22 PM, Alan Gauld wrote: > > Indeed, I personally dislike Java, I think it encourages some very bad > programming design habits, especially in the OOP area, but sadly it is the > de facto standard... (And increasingly, so are the bad habits! :-( ) I despise it root an

Re: [Tutor] Python Interview Questions..

2011-05-26 Thread Alan Gauld
"Marc Tompkins" wrote ...Java has come to dominate academia and busness applications. Which, as Joel Spolsky has famously pointed out, is not universally a Good Thing: Indeed, I personally dislike Java, I think it encourages some very bad programming design habits, especially in the OOP a

Re: [Tutor] nested / concatenated function docstrings?

2011-05-26 Thread Alan Gauld
"Prasad, Ramit" wrote I would like to have the docstring for function first also contain the docstring for second because it should support/pass any argument second contains. You can explicitly set the docstring by assigning to __doc__: def f(): ... '''here is f's doc string ''' ...

Re: [Tutor] Non programmer wanting to become programmer

2011-05-26 Thread Alan Gauld
"michael scott" wrote Alan's tutorial (alan is a very active member here) http://www.freenetpages.co.uk/hp/alan.gauld/ Note the new site in my sig... It has a lot of buglets fixed for v2 and importantly has a v3 version too (albeit still under construction, but complete enough for beginner

Re: [Tutor] Python Interview Questions..

2011-05-26 Thread Marc Tompkins
On Thu, May 26, 2011 at 4:37 PM, Alan Gauld wrote: > > "Prasad, Ramit" wrote > > Is C still the standard interviewing basis for the computer science basics >> (e.g. data structures, algorithms, etc)? >> > > In the UK at least it is almost universally Java nowadays. > > C (and C++) are still yuse

Re: [Tutor] Non programmer wanting to become programmer

2011-05-26 Thread Alan Gauld
"amt" <0101...@gmail.com> wrote 1)What book should I start with? ( I have checked Python for non programmers but there are a lot of titles there, what should I pick first?I was thinking about Invent your own computer games with Python.) Tutorials are a matter of taste. Take a look at a few,

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Alan Gauld
"James Reynolds" wrote As far as the null point goes, it shouldn't be null at all once it gets to the point Alan pointed out. The pointer is set in (for example) stat_avg seq = PySequence_Fast(obj, "Expected a Sequence"); Can the function fail? If so what does it return? That was my p

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Alan Gauld
"James Reynolds" wrote I'll look into your suggestion regarding comprehension (i'm not sure what that means in a programing sense, but I'm sure I'll find out!) Its the English meaning of the word. Studies have shown that the layout of code (indentation, placement of braces etc) have a big e

Re: [Tutor] Python Interview Questions..

2011-05-26 Thread Alan Gauld
"Prasad, Ramit" wrote Is C still the standard interviewing basis for the computer science basics (e.g. data structures, algorithms, etc)? In the UK at least it is almost universally Java nowadays. C (and C++) are still yused in industrial settings, especially in embedded systems, but Java

Re: [Tutor] Python Extensions in C

2011-05-26 Thread ALAN GAULD
> I suppose it's up to the programmer. It is, provided the programmer is remembering that the audience is not him/herself buty the many other programmers who will have to read and maintain the code over the years to follow. So if the programmer genuinely believes that one form is clearer the

Re: [Tutor] Clunky Password maker

2011-05-26 Thread ian douglas
On 05/26/2011 02:45 PM, Wolf Halton wrote: Now I am looking at how to make it have an admin function to set the valid characters, and have a way to output the password into main() Simple, just learn to use the 'return' statement: [code] def new_pass(p): pp = int(raw_input("Enter the len

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Rachel-Mikel ArceJaeger
I suppose it's up to the programmer. Personally, I find something like this: variable += something a lot easier to read than temp = something variable += temp For me, it's just another variable I have to worry about allocating/deallocating/seeing if it's used anywhere else/accidentally using

Re: [Tutor] Clunky Password maker

2011-05-26 Thread Wolf Halton
I have a 0.2 version [code] def new_pass(p): valchars = string.ascii_letters + string.digits + string.punctuation series = list(valchars) pp = int(raw_input("Enter the length you want your password to be:[%i] " % (p)) or p) # length of password chosen or default length

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Stefan Behnel
James Reynolds, 26.05.2011 21:34: On Thu, May 26, 2011 at 3:07 PM, Stefan Behnel wrote: Stefan Behnel, 26.05.2011 18:10: James Reynolds, 26.05.2011 17:22: As an intellectual exercise, I wanted to try my hand at writing some extensions in C. This is fine for en exercise, and I hope you had

Re: [Tutor] Non programmer wanting to become programmer

2011-05-26 Thread michael scott
I am a beginner so I can relate with you, although python is my first programming language, it sounds as if you are coming from another language. Either way, here are some sites I'll collected that have tutorials and are free. Alan's tutorial (alan is a very active member here) http://www.freene

Re: [Tutor] Non programmer wanting to become programmer

2011-05-26 Thread Corey Richardson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/26/2011 03:36 PM, amt wrote: > First of all, hello! I want to start learning programming. I'm looking into > becoming more than a hobbyist programmer. I searched a lot on Google on what > programming language should I learn first and I see a lot

Re: [Tutor] Non programmer wanting to become programmer

2011-05-26 Thread spawgi
Hello amt, Please find my responses below - On Fri, May 27, 2011 at 1:06 AM, amt <0101...@gmail.com> wrote: > First of all, hello! I want to start learning programming. I'm looking > into becoming more than a hobbyist programmer. I searched a lot on Google on > what programming language should

[Tutor] Non programmer wanting to become programmer

2011-05-26 Thread amt
First of all, hello! I want to start learning programming. I'm looking into becoming more than a hobbyist programmer. I searched a lot on Google on what programming language should I learn first and I see a lot of good words about Python so I decided to go for it but have some questions: 1)What b

Re: [Tutor] Python Extensions in C

2011-05-26 Thread James Reynolds
On Thu, May 26, 2011 at 3:07 PM, Stefan Behnel wrote: > Stefan Behnel, 26.05.2011 18:10: > > James Reynolds, 26.05.2011 17:22: >> >>> As an intellectual exercise, I wanted to try my hand at writing some >>> extensions in C. >>> >> >> This is fine for en exercise, and I hope you had fun doing thi

[Tutor] nested / concatenated function docstrings?

2011-05-26 Thread Prasad, Ramit
Module 1: Def first(arg1,arg2, *args, **kwargs): # some code that wraps around second(*args, **kwargs) Module 2: Def second(...): # some code here Function first is basically a wrapper around second. Both are generators but first is more refined/selective about what it yields. I would l

Re: [Tutor] Python Extensions in C

2011-05-26 Thread James Reynolds
Someone once told me I was a "kinetic learner" and it seemed to fit with my learning habbits, I wasn't aware there is an entire branch of education theory revolving around "learning specialties", which was interesting to learn about. On Thu, May 26, 2011 at 1:52 PM, Patty wrote: > > - Or

Re: [Tutor] Python Extensions in C

2011-05-26 Thread James Reynolds
Thank you Rachel and Alan for the feedback. Oddly enough, I had created an exception between the time I sent this and your response to catch occasions when the list is empty (I will need to test a few other things, like what if the list holds items other than strictly numbers?) I did utilize some

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Stefan Behnel
Stefan Behnel, 26.05.2011 18:10: James Reynolds, 26.05.2011 17:22: As an intellectual exercise, I wanted to try my hand at writing some extensions in C. This is fine for en exercise, and I hope you had fun doing this. However, for real code, I suggest you use Cython instead. Your module would

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Stefan Behnel
Rachel-Mikel ArceJaeger, 26.05.2011 17:46: A couple small things that will help improve memory management Rather than avg = sumall / count; return avg; Just return sumall/count instead. Then you don't have to waste a register or assignment operation. Division is expensive. Avoid it when you can

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Patty
"Alan Gauld" wrote in message news:irm3ae$vpl$1...@dough.gmane.org... "Rachel-Mikel ArceJaeger" wrote Consider these the ravings of an ex maintenance programmer who spent far too much of his life deciphering other folks "clever" C code... It wasn't clever and it wasn't working! Alan G.

Re: [Tutor] Python Interview Questions..

2011-05-26 Thread ian douglas
If I were interviewing for a Perl or PHP position, then yes. However, if I just wanted to see if they knew the algorithm, I'd let them use whatever language they were most comfortable in, provided those of us interviewing also knew the language. I think C++ is more common now for data structur

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Patty
- Original Message - From: "Stefan Behnel" To: Sent: Thursday, May 26, 2011 9:10 AM Subject: Re: [Tutor] Python Extensions in C James Reynolds, 26.05.2011 17:22: As an intellectual exercise, I wanted to try my hand at writing some extensions in C. This is fine for en exercise, a

Re: [Tutor] Python Interview Questions..

2011-05-26 Thread Prasad, Ramit
> When giving an interview, I ask interviewees to write samples of code. Would you ask your code samples for a python (or XXX language) position do you have them code it in...C or actually code it in Python (or XXX language)? > Another favorite of mine was asking a candidate to write a piece of c

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Alan Gauld
"Rachel-Mikel ArceJaeger" wrote avg = sumall / count; return avg; Just return sumall/count instead. Then you don't have to waste a register or assignment operation. Readibility counts in C too. And premature optimisation is even more of an evil since C is harder to read to start with Thi

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Alan Gauld
"James Reynolds" wrote I was wondering if you all could look over my code and give some feedback. Here is the link for the code: http://pastebin.com/jw3ihfsN Some style issues, the indentation is inconsistent. Also the braces positioning is one of the worst for comprehension (See the book C

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Stefan Behnel
James Reynolds, 26.05.2011 17:22: As an intellectual exercise, I wanted to try my hand at writing some extensions in C. This is fine for en exercise, and I hope you had fun doing this. However, for real code, I suggest you use Cython instead. Your module would have been substantially simpler

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Rachel-Mikel ArceJaeger
A couple small things that will help improve memory management Rather than avg = sumall / count; return avg; Just return sumall/count instead. Then you don't have to waste a register or assignment operation. Division is expensive. Avoid it when you can. Here, for (a=0; a != count; a++) {

[Tutor] Python Extensions in C

2011-05-26 Thread James Reynolds
Hello All: As an intellectual exercise, I wanted to try my hand at writing some extensions in C. I was wondering if you all could look over my code and give some feedback. Here is the link for the code: http://pastebin.com/jw3ihfsN I have zero experience coding in C (and not much more coding in

Re: [Tutor] Python Variables Changing in Other Functions

2011-05-26 Thread Rachel-Mikel ArceJaeger
Yes it does! Thank you. Rachel On May 25, 2011, at 8:34 PM, Wayne Werner wrote: > On Wed, May 25, 2011 at 10:17 PM, Rachel-Mikel ArceJaeger > wrote: > You asked for the traceback. All I get is this: > - > > python a2.py > File "a2.py", line 20 > titles = [title in my

Re: [Tutor] PI

2011-05-26 Thread delegbede
Do import math first I.e type import math You could also do from math import pi Provided pi is the only function u need in the math module. from math import * This imports every function of the math module. HTH Sent from my BlackBerry wireless device from MTN -Original Message- From: David

Re: [Tutor] aubio usage in python

2011-05-26 Thread Alan Gauld
"김태윤" wrote but I can't find any document for "aubio" library OK, I spoke too soon, I found the doc page. http://aubio.org/documentation It has a page on extracting pitch information wioth python. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/

Re: [Tutor] aubio usage in python

2011-05-26 Thread Alan Gauld
"김태윤" wrote I am new to python I want to detect pitch in portion of some sound Since you specifically spell aubio with a 'b' I assume you are trying to use the aubio library/module. http://aubio.org/doc/index.html This list is for helping people learn Python and any support for third party

[Tutor] aubio usage in python

2011-05-26 Thread 김태윤
hello I am new to python I want to detect pitch in portion of some sound there are pretty good tutorials for ctype but I can't find any document for "aubio" library my platform is windows xp sp3 I want to know what function are there and how to use it could somebody tell me how? thanks in advanced!