Re: [Tutor] Real world use of recursion

2014-09-09 Thread Alan Gauld
On 10/09/14 03:56, Deb Wyatt wrote: "I have never seen or heard of real uses of recursion except for proving cleverness," so I thought I would ask you all if that is true. Is it really not used in real world applications? Its often used in prototyping and then converted to non-recursive s

Re: [Tutor] Real world use of recursion

2014-09-09 Thread Danny Yoo
Hi Deb, For good training on recursion, I can't think of better material than: http://www.ccs.neu.edu/home/matthias/HtDP2e/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/t

[Tutor] Fwd: Re: Real world use of recursion

2014-09-09 Thread Danny Yoo
Sorry, forgot to reply to all. -- Forwarded message -- From: "Danny Yoo" Date: Sep 9, 2014 10:10 PM Subject: Re: [Tutor] Real world use of recursion To: "Deb Wyatt" Cc: > > On Sep 9, 2014 8:07 PM, "Deb Wyatt" wrote: > > > > Sorry to bother you all with what you might consider t

Re: [Tutor] usage difference between tabs and spaces

2014-09-09 Thread Mirage Web Studio
Thank you and everybody else for the reply. I am using pycharm and i have found the way to produce four spaces for single tab key press. George On 10-Sep-14 2:32 AM, Danny Yoo wrote: I am not an advanced programmer, but am very good with keyboard and find using tabs for syntax and formatt

Re: [Tutor] usage difference between tabs and spaces

2014-09-09 Thread boB Stepp
On Tue, Sep 9, 2014 at 7:27 AM, Mirage Web Studio wrote: > > Hello, > > I am not an advanced programmer, but am very good with keyboard and find > using tabs for syntax and formatting very helpful. But in this list and > other python documentation i have repeatedly seen people recommending > use o

[Tutor] Real world use of recursion

2014-09-09 Thread Deb Wyatt
Sorry to bother you all with what you might consider trivia, but someone in my course forum posted this statement: "I have never seen or heard of real uses of recursion except for proving cleverness," so I thought I would ask you all if that is true. Is it really not used in real world appli

Re: [Tutor] usage difference between tabs and spaces

2014-09-09 Thread Alan Gauld
On 09/09/14 13:27, Mirage Web Studio wrote: would like to understand why hitting the poor keyboard 4/8/12 times is preferred than just hitting it 1/2/3 times. Its not, as others have already said, you set the tab key to insert spaces. Of course you usually have to delete those spaces manually

Re: [Tutor] usage difference between tabs and spaces

2014-09-09 Thread Danny Yoo
> I am not an advanced programmer, but am very good with keyboard and find > using tabs for syntax and formatting very helpful. But in this list and > other python documentation i have repeatedly seen people recommending > use of spaces. Usually, you want to match the style used by the majority o

Re: [Tutor] usage difference between tabs and spaces

2014-09-09 Thread William Ray Wing
On Sep 9, 2014, at 8:27 AM, Mirage Web Studio wrote: > > Hello, > > I am not an advanced programmer, but am very good with keyboard and find > using tabs for syntax and formatting very helpful. But in this list and > other python documentation i have repeatedly seen people recommending > use of

Re: [Tutor] usage difference between tabs and spaces

2014-09-09 Thread Joel Goldstick
On Tue, Sep 9, 2014 at 8:27 AM, Mirage Web Studio wrote: > > Hello, > > I am not an advanced programmer, but am very good with keyboard and find > using tabs for syntax and formatting very helpful. But in this list and > other python documentation i have repeatedly seen people recommending > use o

Re: [Tutor] Fwd: Fwd: Re: Output 'Strings' to directory

2014-09-09 Thread Felisha Lawrence
Thanks! Thats exactly what my problem was. I fixed it On Tue, Sep 9, 2014 at 12:57 PM, Alan Gauld wrote: > From: Felisha Lawrence >> Date: Tue, Sep 9, 2014 at 8:53 AM >> Subject: Re: [Tutor] Fwd: Re: Output 'Strings' to directory >> To: Danny Yoo >> >> >> Also, >> I had this code working >> >>

[Tutor] usage difference between tabs and spaces

2014-09-09 Thread Mirage Web Studio
Hello, I am not an advanced programmer, but am very good with keyboard and find using tabs for syntax and formatting very helpful. But in this list and other python documentation i have repeatedly seen people recommending use of spaces. I know that i can use any of them and use tabs as my prefe

Re: [Tutor] Fwd: Fwd: Re: Output 'Strings' to directory

2014-09-09 Thread Alan Gauld
From: Felisha Lawrence Date: Tue, Sep 9, 2014 at 8:53 AM Subject: Re: [Tutor] Fwd: Re: Output 'Strings' to directory To: Danny Yoo Also, I had this code working import os path = '/Users/felishalawrence/testswps/vol1' for file in os.listdir(path): newFile = file[:file.index("v")]+"v2

Re: [Tutor] Good approach regarding classes attributes

2014-09-09 Thread Alan Gauld
On 09/09/14 14:44, Peter Otten wrote: Is it not helpful to always put (object) as the parent, if the class is not itself a sub-class? The answer differs between Python 2 and 3. In Python 3 class C: # preferred in Python 3 pass Apologies, I should have mentioned that. I've been using P

[Tutor] Fwd: Fwd: Re: Output 'Strings' to directory

2014-09-09 Thread Danny Yoo
Felisha, please use reply to all. I'm at work at the moment; can't look at your question. Thanks! Forwarding to tutor. -- Forwarded message -- From: Felisha Lawrence Date: Tue, Sep 9, 2014 at 8:53 AM Subject: Re: [Tutor] Fwd: Re: Output 'Strings' to directory To: Danny Yoo A

[Tutor] Fwd: Re: Output 'Strings' to directory

2014-09-09 Thread Danny Yoo
Forwarding to tutor. -- Forwarded message -- From: "Felisha Lawrence" Date: Sep 9, 2014 6:56 AM Subject: Re: [Tutor] Output 'Strings' to directory To: "Danny Yoo" Cc: > So, I ran the following code > > > import os > > path = '/Users/felishalawrence/testswps/vol1' > for file in os

Re: [Tutor] Good approach regarding classes attributes

2014-09-09 Thread Sydney Shall
On 09/09/2014 16:05, Joel Goldstick wrote: On Tue, Sep 9, 2014 at 10:02 AM, Sydney Shall wrote: On 09/09/2014 15:44, Peter Otten wrote: Sydney Shall wrote: On 08/09/2014 18:39, Alan Gauld wrote: On 08/09/14 15:17, Juan Christian wrote: One tiny tweak... class User(): You don't need the pa

Re: [Tutor] Understand subprocess poll

2014-09-09 Thread jarod...@libero.it
>> so they do nothing. Python convention for an empty parent list is just >> to leave the parens off: >> >> class User: >> >A simple question from a newbie, in response to this surprise. >Is it not helpful to always put (object) as the parent, if the class is >not it

Re: [Tutor] Understand subprocess poll

2014-09-09 Thread Peter Otten
Wolfgang Maier wrote: > On 09/09/2014 11:45 AM, Peter Otten wrote: >> jarod...@libero.it wrote: >> >>> I want to use subprocess for run some programs But I need to be sure the >>> program end before continue with the other: >>> >>> subprocess.call("ls") >>> cmd1 = i >>> p1 = subprocess.Popen(cmd1,

Re: [Tutor] Good approach regarding classes attributes

2014-09-09 Thread Joel Goldstick
On Tue, Sep 9, 2014 at 10:02 AM, Sydney Shall wrote: > On 09/09/2014 15:44, Peter Otten wrote: > > Sydney Shall wrote: > > On 08/09/2014 18:39, Alan Gauld wrote: > > On 08/09/14 15:17, Juan Christian wrote: > > One tiny tweak... > > class User(): > > You don't need the parens after User. You don;t

Re: [Tutor] Good approach regarding classes attributes

2014-09-09 Thread Sydney Shall
On 09/09/2014 15:44, Peter Otten wrote: Sydney Shall wrote: On 08/09/2014 18:39, Alan Gauld wrote: On 08/09/14 15:17, Juan Christian wrote: One tiny tweak... class User(): You don't need the parens after User. You don;t have any superclasses so they do nothing. Python convention for an emp

Re: [Tutor] Good approach regarding classes attributes

2014-09-09 Thread Juan Christian
On Mon, Sep 8, 2014 at 5:58 AM, Peter Otten <__pete...@web.de > wrote: > > PS: This is not about being pythonic, but it might be more convenient for > client code if you use datetime objects instead of timestamps: > > >>> import datetime > >>> last_logoff = datetime.datetime.utcfromtimestamp(14100

Re: [Tutor] Good approach regarding classes attributes

2014-09-09 Thread Peter Otten
Sydney Shall wrote: > On 08/09/2014 18:39, Alan Gauld wrote: >> On 08/09/14 15:17, Juan Christian wrote: >> >> One tiny tweak... >> >>> class User(): >> >> You don't need the parens after User. You don;t have any superclasses >> so they do nothing. Python convention for an empty parent list is jus

Re: [Tutor] Understand subprocess poll

2014-09-09 Thread Wolfgang Maier
On 09/09/2014 11:45 AM, Peter Otten wrote: jarod...@libero.it wrote: I want to use subprocess for run some programs But I need to be sure the program end before continue with the other: subprocess.call("ls") cmd1 = i p1 = subprocess.Popen(cmd1,shell=True,stdout=subprocess.PIPE) while True: if

Re: [Tutor] Good approach regarding classes attributes

2014-09-09 Thread leam hall
On Tue, Sep 9, 2014 at 9:09 AM, Sydney Shall wrote: > And while I am writing, what does OP stand for in this list? "Original Poster". So I understand. Won't answer the Python question since I'm a newbie here myself. -- Mind on a Mission ___ Tutor mai

Re: [Tutor] Good approach regarding classes attributes

2014-09-09 Thread Sydney Shall
On 08/09/2014 18:39, Alan Gauld wrote: On 08/09/14 15:17, Juan Christian wrote: One tiny tweak... class User(): You don't need the parens after User. You don;t have any superclasses so they do nothing. Python convention for an empty parent list is just to leave the parens off: class User

Re: [Tutor] Understand subprocess poll

2014-09-09 Thread Peter Otten
jarod...@libero.it wrote: > I want to use subprocess for run some programs But I need to be sure the > program end before continue with the other: > > subprocess.call("ls") > cmd1 = i > p1 = subprocess.Popen(cmd1,shell=True,stdout=subprocess.PIPE) > > while True: > if p1.poll() is None: > time.s

[Tutor] Understand subprocess poll

2014-09-09 Thread jarod...@libero.it
Dear all!! I want to use subprocess for run some programs But I need to be sure the program end before continue with the other: subprocess.call("ls") cmd1 = i p1 = subprocess.Popen(cmd1,shell=True,stdout=subprocess.PIPE) while True: if p1.poll() is None: time.sleep(3) pass if p1.poll()==0: print

Re: [Tutor] Else and If

2014-09-09 Thread Peter Otten
Mimi Ou Yang wrote: > print ("Quiz TIME!!!") > ready = input("Are you ready?") > if (ready in ("yes","YES","Yes")): > print ("Alrighty") > if (ready in ("no","NO","No")): > print ("Too bad so sad. You're obligated to do it.") > else: > print ("OK (sarcasm)") > When I write yes or YE

[Tutor] Else and If

2014-09-09 Thread Mimi Ou Yang
print ("Quiz TIME!!!") ready = input("Are you ready?") if (ready in ("yes","YES","Yes")): print ("Alrighty") if (ready in ("no","NO","No")): print ("Too bad so sad. You're obligated to do it.") else: print ("OK (sarcasm)") q1 = input("1. When was Quebec City founded? a. 1608 b

[Tutor] how to be sure the process are ended

2014-09-09 Thread jarod...@libero.it
>Messaggio originale >Da: jarod...@libero.it >Data: 08/09/2014 18.15 >A: >Ogg: how to be sure the process are ended > >Dear all!! >I want to use subprocess for run some programs But I need to be sure the >program end before continue with the other: > >subprocess.call("ls") >