Re: [Tutor] Merge Sort Algorithm

2017-03-30 Thread Neil Cerutti
On 2017-03-30, Elo Okonkwo wrote: > Thanks so much everyone. > > I've figured it out. It was the recursive bit that got me > confused, its a bit difficult debugging recursive functions. It doesn't have to be! I recommend debugging recursive functions with small,

[Tutor] subprocess.Popen / proc.communicate issue

2017-03-30 Thread bruce
Trying to understand the "correct" way to run a sys command ("curl") and to get the potential stderr. Checking Stackoverflow (SO), implies that I should be able to use a raw/text cmd, with "shell=true". If I leave the stderr out, and just use s=proc.communicate() the test works... Any

[Tutor] reading files in Python 3

2017-03-30 Thread Rafael Knuth
I can read files like this (relative path): with open("Testfile_B.txt") as file_object: contents = file_object.read() print(contents) But how do I read files if I want to specify the location (absolute path): file_path = "C:\Users\Rafael\Testfile.txt" with open(file_path) as

Re: [Tutor] super constructor usage

2017-03-30 Thread Rafael Knuth
>> > I am trying to wrap my head around the super constructor. Is it possible to embed a super constructor into an if / elif statement within the child class? if message == "string A": return X elif: return Y How should I modify my code below? (I couldn't solve that by myself) class A: def

Re: [Tutor] reading files in Python 3

2017-03-30 Thread Zachary Ware
On Mar 30, 2017 15:07, "Rafael Knuth" wrote: I can read files like this (relative path): with open("Testfile_B.txt") as file_object: contents = file_object.read() print(contents) But how do I read files if I want to specify the location (absolute path):

[Tutor] python gtk serial loop thread readind data close

2017-03-30 Thread Alexandru Achim via Tutor
Dear users, I had a problem regarding Threads in python and Gtk3. I want to stop a while loop in Gtk , a loop starded with a thread. I want to control a delay timer laser board with give me ,when I send a command by serial connection, give back continuous status values ; but I want to stop this

Re: [Tutor] super constructor usage

2017-03-30 Thread Alan Gauld via Tutor
On 30/03/17 12:39, Rafael Knuth wrote: I am trying to wrap my head around the super constructor. > > Is it possible to embed a super constructor into an if / elif > statement within the child class? Of course, the __init__ methods are special in any way the normal coding mechanisms all

Re: [Tutor] Merge Sort Algorithm

2017-03-30 Thread Elo Okonkwo
Thanks so much everyone. I've figured it out. It was the recursive bit that got me confused, its a bit difficult debugging recursive functions. On Wed, Mar 29, 2017 at 1:36 AM, Steven D'Aprano wrote: > On Tue, Mar 28, 2017 at 03:56:16PM +0100, Elo Okonkwo wrote: > > Can

Re: [Tutor] super constructor usage

2017-03-30 Thread Mats Wichmann
On 03/29/2017 08:33 AM, Rafael Knuth wrote: > class A: > def __init__(self, message): > self.message = message > print(message) > > I then modified the child class B like this: > > class B(A): > def __init__(self, message): > print("This is the message from your

Re: [Tutor] super constructor usage

2017-03-30 Thread Mats Wichmann
On 03/29/2017 04:02 PM, Mats Wichmann wrote: > On 03/29/2017 08:33 AM, Rafael Knuth wrote: > >> class A: >> def __init__(self, message): >> self.message = message >> print(message) >> >> I then modified the child class B like this: >> >> class B(A): >> def __init__(self,

Re: [Tutor] how to redirect input from pipe

2017-03-30 Thread Yosef Levy
Thank you, it was very helpful. בתאריך 23 במרץ 2017 02:39,‏ "Peter Otten" <__pete...@web.de> כתב: > Yosef Levy wrote: > > > Hello All, > > > > I am running with Python 2.7 > > I have to run script that could have get arguments in two ways: > > 1. argument + file name. > > 2. argument + input

[Tutor] list of functions

2017-03-30 Thread kay Cee
Greetings all, I would like to use a list of functions for an automation project, and this is the prototype I came up with ### def func1(): print('func1') def func2(): print('func2') def func3(): print('func3') func_list = ('func1', 'func2', 'func3') for f in

Re: [Tutor] subprocess.Popen / proc.communicate issue

2017-03-30 Thread Cameron Simpson
I wrote a long description of how .communicate can deadlock. Then I read the doco more carefully and saw this: Warning: Use communicate() rather than .stdin.write, .stdout.read or .stderr.read to avoid deadlocks due to any of the other OS pipe buffers filling up and blocking the child

[Tutor] test

2017-03-30 Thread bruce
sent a question earlier.. and got a reply saying it was in the moderation process??? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] subprocess.Popen / proc.communicate issue

2017-03-30 Thread Cameron Simpson
On 30Mar2017 13:51, bruce wrote: Trying to understand the "correct" way to run a sys command ("curl") and to get the potential stderr. Checking Stackoverflow (SO), implies that I should be able to use a raw/text cmd, with "shell=true". I strongly recommend avoiding

Re: [Tutor] test

2017-03-30 Thread boB Stepp
On Thu, Mar 30, 2017 at 4:11 PM, bruce wrote: > sent a question earlier.. and got a reply saying it was in the > moderation process??? You've made it through the process. See the bottom of https://mail.python.org/pipermail/tutor/2017-March/thread.html to see your original