Re: [Tutor] Input handling?

2012-09-17 Thread Dave Angel
On 09/18/2012 02:12 AM, Steven D'Aprano wrote: > On Tue, Sep 18, 2012 at 12:04:22AM -0400, Dave Angel wrote: >> On 09/17/2012 11:11 PM, Scott Yamamoto wrote: >>> I've been trying to find possible erros with input(such as NameError or >>> SyntaxError) to handle them with an except clause. however,

Re: [Tutor] Input handling?

2012-09-17 Thread Steven D'Aprano
On Mon, Sep 17, 2012 at 09:19:41PM -0700, Scott Yamamoto wrote: > 2.7.2 on python for ios(platform is darwin) > problem reoccured What problem? Your code works for me. Please describe: 1) what you expect to happen 2) what actually happens 3) if there is a traceback, COPY AND PASTE the ENTIRE tra

Re: [Tutor] Input handling?

2012-09-17 Thread Steven D'Aprano
On Tue, Sep 18, 2012 at 12:04:22AM -0400, Dave Angel wrote: > On 09/17/2012 11:11 PM, Scott Yamamoto wrote: > > I've been trying to find possible erros with input(such as NameError or > > SyntaxError) to handle them with an except clause. however, I've found > > that hitting enter/return while pr

Re: [Tutor] simple random string generator

2012-09-17 Thread Dave Angel
On 09/18/2012 01:15 AM, Mark Lawrence wrote: > @Matthew Dalrymple I don't know what is happening but that's at least > two messages from you that show precisely nothing, just original > comments from others. Anyone else seeing the same thing? I'm reading > through gmane on Windows Vista with Thun

Re: [Tutor] simple random string generator

2012-09-17 Thread Mark Lawrence
@Matthew Dalrymple I don't know what is happening but that's at least two messages from you that show precisely nothing, just original comments from others. Anyone else seeing the same thing? I'm reading through gmane on Windows Vista with Thunderbird. -- Cheers. Mark Lawrence. ___

Re: [Tutor] simple random string generator

2012-09-17 Thread Matthew Dalrymple
> Look at what your timing code does: > > start = time.time() > for i in range(1): > anagramSolution2(word,word) > end1 = time.time() > solu2 = end1 - start > > > Translated into English: > > * start the timer > * iteration 1 begins > * call the anagram function > * grab the

Re: [Tutor] Input handling?

2012-09-17 Thread Scott Yamamoto
2.7.2 on python for ios(platform is darwin) problem reoccured Script: import random username = "" def playername(): global username Mlist = ["name1","name2","name3"] Flist = ["name4","name5", "name6"] Llist = ["Lname1","Lname2","Lname3"] username = raw_input("input your desired username:

Re: [Tutor] Input handling?

2012-09-17 Thread Dave Angel
On 09/17/2012 11:11 PM, Scott Yamamoto wrote: > I've been trying to find possible erros with input(such as NameError or > SyntaxError) to handle them with an except clause. however, I've found > that hitting enter/return while prompted without inputting creates some kind > of problem. usern

Re: [Tutor] Input handling?

2012-09-17 Thread Scott Yamamoto
Didnt show up at first. Result was an eof error (using input not raw_input) Found with interactive interpreter___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Input handling?

2012-09-17 Thread Scott Yamamoto
I've been trying to find possible erros with input(such as NameError or SyntaxError) to handle them with an except clause. however, I've found that hitting enter/return while prompted without inputting creates some kind of problem. >>>username = raw_input("Input a username: ") Input a username:

Re: [Tutor] simple random string generator

2012-09-17 Thread Steven D'Aprano
On 18/09/12 06:09, Matthew Dalrymple wrote: thanks for everyone that gave me a hand...i think i got most of the program done... now i just need to time how long it takes to run each anagramSolution functions to see which one is faster...now i think i might have got it done but for some reason bo

Re: [Tutor] combining c and python

2012-09-17 Thread Oscar Benjamin
On 2012-09-17, Walter Prins wrote: > Hi Chris, > > On 17 September 2012 18:43, Chris Fuller > wrote: >> To run C alongside Python, you need to use the API. >> >> You can interface Cython with straight C, of course, but not in a way that >> will work with the standard interpreter. > > Just to be c

Re: [Tutor] simple random string generator

2012-09-17 Thread Matthew Dalrymple
oh :S ok im sorry...i will change that thenthanks > Date: Mon, 17 Sep 2012 18:19:50 -0400 > From: d...@davea.name > To: computer_dud...@hotmail.com > CC: tutor@python.org > Subject: Re: [Tutor] simple random string generator > > On 09/17/2012 05:40 PM, Matthew Dalrymple wrote: > > > > > >>> >

Re: [Tutor] simple random string generator

2012-09-17 Thread Dave Angel
On 09/17/2012 05:40 PM, Matthew Dalrymple wrote: > > >>> >>> >> >> Did you look for bugs before trying to time it? For example, did you >> intend that it test the sizes from 10 thru 195 in steps of 5, or did you >> intend from 10 to 100, as you stated in your first post? >> >> Would you care to

Re: [Tutor] Tutor Digest, Vol 103, Issue 82

2012-09-17 Thread Emile van Sebille
On 9/17/2012 2:24 PM Aaron Pilgrim said... Hello, I am new to python. Here is what I wrote. my lower() function does not work and it can not take capital letters. def func3(): alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',

Re: [Tutor] Tutor Digest, Vol 103, Issue 82

2012-09-17 Thread Dave Angel
On 09/17/2012 05:24 PM, Aaron Pilgrim wrote: Why are you replying to a digest? Reply to one of the messages on the thread you're responding to, and it'll get the subject line right. It'll also thread it together. >> Message: 7 >> Date: Mon, 17 Sep 2012 21:34:05 +0530 >> From: Santosh Kumar >>

Re: [Tutor] reducing a list evenly when deleting elements by index

2012-09-17 Thread Stephen Haywood
Someone has already tried. https://github.com/sebleier/RDP On Mon, Sep 17, 2012 at 5:50 PM, Pete O'Connell wrote: > When I have a bit more time I am going to try to implement the > Ramer–Douglas–Peucker algorithm to improve the accuracy of my curve > simplification: > > http://en.wikipedia.org/w

Re: [Tutor] reducing a list evenly when deleting elements by index

2012-09-17 Thread Pete O'Connell
> 1) You have a Bezier curver consisting of 20 control points and would like > to > approximate it with a simpler cubic Bezier curve consisting of only 4 > points. > I would call this "approximating a Bezier with a lower order Bezier". > > Hi Oscar. Thanks for your reply. This one above is the one

Re: [Tutor] simple random string generator

2012-09-17 Thread Matthew Dalrymple
> > > > > > Did you look for bugs before trying to time it? For example, did you > intend that it test the sizes from 10 thru 195 in steps of 5, or did you > intend from 10 to 100, as you stated in your first post? > > Would you care to add a docstring to those functions to indicate what > the

Re: [Tutor] simple random string generator

2012-09-17 Thread Dave Angel
On 09/17/2012 04:09 PM, Matthew Dalrymple wrote: > thanks for everyone that gave me a hand...i think i got most of the program > done... now i just need to time how long it takes to run each anagramSolution > functions to see which one is faster...now i think i might have got it done > but for s

Re: [Tutor] Tutor Digest, Vol 103, Issue 82

2012-09-17 Thread Aaron Pilgrim
> Message: 7 > Date: Mon, 17 Sep 2012 21:34:05 +0530 > From: Santosh Kumar > To: tutor > Subject: [Tutor] Trying to get next item from a list > Message-ID: > > Content-Type: text/plain; charset=UTF-8 > > Here is the script: > > alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j

Re: [Tutor] simple random string generator

2012-09-17 Thread Matthew Dalrymple
thanks for everyone that gave me a hand...i think i got most of the program done... now i just need to time how long it takes to run each anagramSolution functions to see which one is faster...now i think i might have got it done but for some reason both lines are pretty close to the same

Re: [Tutor] combining c and python

2012-09-17 Thread Walter Prins
Hi Chris, On 17 September 2012 18:43, Chris Fuller wrote: > To run C alongside Python, you need to use the API. > > You can interface Cython with straight C, of course, but not in a way that > will work with the standard interpreter. Just to be clear, one of the main reasons for Cython's existen

Re: [Tutor] combining c and python

2012-09-17 Thread Chris Fuller
The official documentation covers this in some detail: http://docs.python.org/extending/ http://docs.python.org/c-api/ Cython is an alternate implementation of Python. It's more of a blending of Python and C. It won't, in general, run Python source code or your favorite third-party library. To

Re: [Tutor] combining c and python

2012-09-17 Thread Oscar Benjamin
On 2012-09-17, Bala subramanian wrote: > Friends, > I code in python and so far able to write simple scripts for my needs. > Now i want to try the combination of c and python. > > 1) could someone please suggest me some good documentation on how > python and C can be combined. Some tutorials with

[Tutor] combining c and python

2012-09-17 Thread Bala subramanian
Friends, I code in python and so far able to write simple scripts for my needs. Now i want to try the combination of c and python. 1) could someone please suggest me some good documentation on how python and C can be combined. Some tutorials with simple examples. 2) If i know that a specific part

Re: [Tutor] How to run this block of code dozens of times

2012-09-17 Thread Ray Jones
On 09/17/2012 02:46 AM, eryksun wrote: > On Sun, Sep 16, 2012 at 11:17 PM, Steven D'Aprano wrote: >> Other uses are: >> >> * a single leading underscore usually means "private, don't touch" >> >> * double leading and trailing underscore names have special meaning >> to Python, e.g.: > There's al

Re: [Tutor] Trying to get next item from a list

2012-09-17 Thread Sarma Tangirala
On 17 September 2012 12:04, Santosh Kumar wrote: > Here is the script: > > alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', > 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', > 'z'] > i = input("Press any English alphabet: ") > current = alphabets.index(i)

Re: [Tutor] Trying to get next item from a list

2012-09-17 Thread Joel Goldstick
On Mon, Sep 17, 2012 at 12:04 PM, Santosh Kumar wrote: > Here is the script: > > alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', > 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', > 'z'] > i = input("Press any English alphabet: ") You ask for a letter, but

[Tutor] Trying to get next item from a list

2012-09-17 Thread Santosh Kumar
Here is the script: alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] i = input("Press any English alphabet: ") current = alphabets.index(i) print(current) next = current+1 print(next) print(alphabets.inde

Re: [Tutor] How to run this block of code dozens of times

2012-09-17 Thread Oscar Benjamin
On 2012-09-17, Emile van Sebille wrote: > > Be sure you don't at some point depend on _ having a specific value > however, as return values of functions are given the _ name in the > absense of a designated label for the returned value: > > ActivePython 2.6.6.15 (ActiveState Software Inc.) based

Re: [Tutor] How to run this block of code dozens of times

2012-09-17 Thread Emile van Sebille
On 9/16/2012 8:17 PM Steven D'Aprano said... On 17/09/12 10:56, Scurvy Scott wrote: Why would you use an underscore rather than a letter or name like I've always seen. I've never seen an underscore used before. An underscore on its own is often used to mean "don't care". Like a scratch variab

Re: [Tutor] Resources to create a form filler

2012-09-17 Thread Wayne Werner
On Mon, 17 Sep 2012, DM wrote: Hi I've learned a little python via MIT's 6.01SC and would like to gain experience with personal projects. I'd like to make a web form filler for the desktop. I'd appreciate it if someone could suggest what resources I would need to build it. Thanks! Do you mean

Re: [Tutor] reducing a list evenly when deleting elements by index

2012-09-17 Thread Oscar Benjamin
On 2012-09-17, Steven D'Aprano wrote: > On 17/09/12 11:15, Pete O'Connell wrote: >> Hi, I have a bezier line with 20 points on it and I am trying to reduce >> this to a line with 4 points, keeping the first and last points and 2 >> evenly spaced points in between like so: > > In general in Python,

Re: [Tutor] Convert from meters to British length units.

2012-09-17 Thread Peter Otten
Johny Rei wrote: [Please hit replay-all when you answer posts on this mailing list; that way everyone on the list can see your post] > Yes Sir, thank you sir, You're welcome. Note that we're OK with a less formal tone over here ;) > I do understand how this works, these is the printf formatt

Re: [Tutor] is this use or abuse of __getitem__ ?

2012-09-17 Thread eryksun
On Mon, Sep 17, 2012 at 3:42 AM, Albert-Jan Roskam wrote: > > Another idea would be to also use __getitem__ as a dictionary. So when > the data contains an id (let's say ssn), r = Reader(key="ssn"); > r.data["87654321"] returns the corresponding (first available) record. > But although this is coo

[Tutor] Resources to create a form filler

2012-09-17 Thread DM
Hi I've learned a little python via MIT's 6.01SC and would like to gain experience with personal projects. I'd like to make a web form filler for the desktop. I'd appreciate it if someone could suggest what resources I would need to build it. Thanks! ___

Re: [Tutor] How to run this block of code dozens of times

2012-09-17 Thread eryksun
On Sun, Sep 16, 2012 at 11:17 PM, Steven D'Aprano wrote: > > Other uses are: > > * a single leading underscore usually means "private, don't touch" > > * double leading and trailing underscore names have special meaning > to Python, e.g.: There's also the _() function for I18N: http://docs.pyt

Re: [Tutor] is this use or abuse of __getitem__ ?

2012-09-17 Thread Albert-Jan Roskam
- Original Message - > From: Albert-Jan Roskam > To: eryksun > Cc: "tutor@python.org" > Sent: Monday, September 17, 2012 9:42 AM > Subject: Re: [Tutor] is this use or abuse of __getitem__ ? > >& lt;snip> > >> >>  http://code.google.com/p/psutil >> > > > I looked at the website and

Re: [Tutor] is this use or abuse of __getitem__ ?

2012-09-17 Thread Albert-Jan Roskam
> > http://code.google.com/p/psutil > I looked at the website and it looks like a cool module. Some of it appeared to be *nix only, but I'll have to dig into it more. But it's also just like you said: how far should one go with micromanaging things?  Maybe some things are the caller's respo

Re: [Tutor] Convert from meters to British length units.

2012-09-17 Thread Peter Otten
Johny Rei wrote: > Help out there folks,,.I'm completely lost on how to make a program where > you set a length given in meters and then compute and write out the > corresponding length measured in inches,in feet, in yards, and in > miles.Can anybody guide me here, By the example you may provide

[Tutor] Convert from meters to British length units.

2012-09-17 Thread Johny Rei
Help out there folks,,.I'm completely lost on  how to make a program where you set a length given in meters and then compute and write out the corresponding length measured in inches,in feet, in yards, and in miles.Can anybody guide me here, By the example you may provide will be appreciated..,_