Re: [Tutor] genfromtxt vs. reading csv to a list or dictionary

2016-02-11 Thread Ek Esawi
Thanks Danny! I realized that I should not be concerned with speed/efficiency since I am a beginner in python and giving the data I work with, speed is not that important now. I am learning how to read files via several ways and transform them to numpy arrays. I just thought genfromtxt provides m

[Tutor] Need help with audio manipulation

2016-02-11 Thread Swift, Robert
I was wondering how to write a code that would take a recorded audio and place these values into a numpy array? I have written various codes that can record and playback sound and work properly. I need the recorded audio to be accessed from a numpy array so I can process the sound and manipulate it

[Tutor] mock file reader object

2016-02-11 Thread Anshu Kumar
Hi, I need to mock file reader object , i tried using @patch('__builtin__.open') but it will patch my all file open readers. More precisely i have code something like below def restore_segments_and_lines_json(segments_file_path,lines_file_path,deleted_segment_ids): with open(segments_file_p

[Tutor] declare a variable inside a class

2016-02-11 Thread richard kappler
Trying to optimize the modular input we wrote for Splunk, the basic structure (dictated by Splunk) is the entire script is a class with numerous methods within. The modular input reads a tcp stream, starts a new thread for each source, reads the messages from that source into a buffer, checks for s

Re: [Tutor] declare a variable inside a class

2016-02-11 Thread Martin A. Brown
Hi there again Richard, [snipped a bit of stuff] >The method that actually formats the messages opens the xslt file, >then uses it to format the message. Clever boy that I am, I figured >it would be better to open the xslt file once, rather than once per >message, so I moved the line > >xslt

Re: [Tutor] declare a variable inside a class

2016-02-11 Thread richard kappler
Thanks for the reply Martin, and in this instance I cannot post the actual code (company rules). What I can do is say that with the xslt variable defined within the formatter method, everything works, but when I pull it out and put it in the upper level of the class, it gives me a traceback that sa

Re: [Tutor] declare a variable inside a class

2016-02-11 Thread Peter Otten
richard kappler wrote: > Thanks for the reply Martin, and in this instance I cannot post the actual > code (company rules). What I can do is say that with the xslt variable > defined within the formatter method, everything works, but when I pull it > out and put it in the upper level of the class,

[Tutor] Mock filesystem operations only for specific test doubles (was: mock file reader object)

2016-02-11 Thread Ben Finney
Anshu Kumar writes: > I need to mock file reader object , i tried using > @patch('__builtin__.open') but it will patch my all file open readers. For this reason I have written and published the Gajja library https://pypi.python.org/pypi/gajja/>. Its FileDouble objects will allow fine-grained co

Re: [Tutor] declare a variable inside a class

2016-02-11 Thread Alan Gauld
On 11/02/16 21:20, Peter Otten wrote: >> defined within the formatter method, everything works, but when I pull it >> out and put it in the upper level of the class, it gives me a traceback >> that says the global variable xslt is not defined. Does that help? > > You need to qualify the class att

Re: [Tutor] Need help with audio manipulation

2016-02-11 Thread Alan Gauld
On 11/02/16 18:03, Swift, Robert wrote: > I was wondering how to write a code that would take a recorded audio and > place these values into a numpy array? I have written various codes that > can record and playback sound and work properly. I need the recorded audio > to be accessed from a numpy ar

Re: [Tutor] declare a variable inside a class

2016-02-11 Thread Martin A. Brown
>Thanks for the reply Martin, and in this instance I cannot post the >actual code (company rules). That's often the case. I think most of us understand that you may not be able to post the original code. >What I can do is say that with the xslt variable defined within the >formatter method,

Re: [Tutor] declare a variable inside a class

2016-02-11 Thread Mark Lawrence
On 11/02/2016 20:28, richard kappler wrote: Trying to optimize the modular input we wrote for Splunk, the basic structure (dictated by Splunk) is the entire script is a class with numerous methods within. The modular input reads a tcp stream, starts a new thread for each source, reads the message

[Tutor] Python for Grade 12 Calculus

2016-02-11 Thread Nicholas Tomasic
Hi, I'm a 12th grade Calculus teacher at a school in Toronto, Ontario, and I'm thinking about incorporating Python into an Independent Study Project for two of my students. Both are passionate about coding with Python and I'm thinking of asking them to produce something that can either a) calculat

Re: [Tutor] Python for Grade 12 Calculus

2016-02-11 Thread Alan Gauld
On 11/02/16 22:56, Nicholas Tomasic wrote: > I'm a 12th grade Calculus teacher at a school in Toronto, I'm from Scotland and so have no idea what that means, but I take it that they are in high school rather than at a college/university? > two of my students. Both are passionate about coding wit

Re: [Tutor] Python for Grade 12 Calculus

2016-02-11 Thread Steven D'Aprano
On Thu, Feb 11, 2016 at 05:56:00PM -0500, Nicholas Tomasic wrote: > Hi, > > I'm a 12th grade Calculus teacher at a school in Toronto, Ontario, and I'm > thinking about incorporating Python into an Independent Study Project for > two of my students. Both are passionate about coding with Python and