Re: [Tutor] code review

2014-06-13 Thread Adam Gold
On 12/06/14 00:38, Alan Gauld wrote: > > HTH Thanks Alan and Lukáš for your very helpful comments. I will attempt to revise the script in light of them and will revert if I hit any brick walls :) ___ Tutor maillist - Tutor@python.org To unsubscribe

[Tutor] Problem reading large files in binary mode

2014-06-13 Thread Mirage Web Studio
Try reading the file in chunks instead: CHUNKSIZE = 2**20 hash = hashlib.md5() while True: chunk = f.read(CHUNKSIZE) if not chunk: break hash.update(chunk) hashvalue = hash.hexdigest() Thank you peter for the above valubale reply. but shouldn't read() by itself work becaus

Re: [Tutor] MIT - Free Python course started today

2014-06-13 Thread Deb Wyatt
oh cool. I actually started taking this here: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/ But to have access to a forum and other people taking it at the same time will be wonderful. thank you for po

[Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread diliup gabadamudalige
Hi All! Hope everyone is well. In my code there are many dictionaries and lists which are used in various functions. Is it better/pythonic/efficient to have these inside the function itself or declared at the beginning of the program in which case they will be global? They are all read only. I und

Re: [Tutor] A couple newbie questions about Python

2014-06-13 Thread Deb Wyatt
> -Original Message- > From: breamore...@yahoo.co.uk > Sent: Thu, 12 Jun 2014 09:18:16 +0100 > To: tutor@python.org > Subject: Re: [Tutor] A couple newbie questions about Python > > Please don't top post, it makes following a long thread extremely > difficult, thanks. > sorry. The other

Re: [Tutor] AttributeError: 'module' object has no attribute 'start'

2014-06-13 Thread jason sam
Thnx for all the suggestions...Now i have made amendments to my program and its working now...but there is a new problem nowI am now calling a python script generated by GNU Radio Companion(for those who know about GRC will understand my question better)...when i press the execute button i get

Re: [Tutor] AttributeError: 'module' object has no attribute 'start'

2014-06-13 Thread jason sam
The last question i hadn't asked yet..and if u are not interested in answering the question then also refrain from commenting please! On Thu, Jun 12, 2014 at 9:47 PM, Mark Lawrence wrote: > On 12/06/2014 05:51, jason sam wrote: > >> Hi All, >> I am new to wxPython.I have made a simple GUI that

Re: [Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread Alan Gauld
On 13/06/14 08:21, diliup gabadamudalige wrote: In my code there are many dictionaries and lists which are used in various functions. Is it better/pythonic/efficient to have these inside the function itself or declared at the beginning of the program in which case they will be global? If you a

[Tutor] How to test mobile apps using python

2014-06-13 Thread Reuben
Hi, I would like to know how we could test android mobile apps using python. Lets say I want to test my skype app. How can we go about? Regards, Reuben ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.p

Re: [Tutor] How to test mobile apps using python

2014-06-13 Thread Alan Gauld
On 13/06/14 09:27, Reuben wrote: I would like to know how we could test android mobile apps using python. Lets say I want to test my skype app. How can we go about? Presumably you are writing these mobile apps in Python? If so what are you using to build the mobile app? What library/framework

Re: [Tutor] How to test mobile apps using python

2014-06-13 Thread Reuben
These apps are native android apps downloaded from google play. Skype being an example. As far as I am aware all these apps are written in Java. But my problem statement requires that we test this app using python script. Regards, Reuben On Fri, Jun 13, 2014 at 1:32 AM, Alan Gauld wrote: > On

Re: [Tutor] How to test mobile apps using python

2014-06-13 Thread Alan Gauld
On 13/06/14 09:38, Reuben wrote: These apps are native android apps downloaded from google play. Skype being an example. As far as I am aware all these apps are written in Java. But my problem statement requires that we test this app using python script. What kind of "testing" do you have in m

Re: [Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread ALAN GAULD
CCing the tutor list. Please use ReplyAll when responding to the list.   Alan Gauld Author of the Learn To Program website http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos > > From: diliup gabadamudalige >To: Alan Gauld >Sent: Friday, 13 J

Re: [Tutor] Problem reading large files in binary mode

2014-06-13 Thread Peter Otten
Mirage Web Studio wrote: > Try reading the file in chunks instead: > > CHUNKSIZE = 2**20 > hash = hashlib.md5() > while True: > chunk = f.read(CHUNKSIZE) > if not chunk: > break > hash.update(chunk) > hashvalue = hash.hexdigest() > > > Thank you peter for the above valub

Re: [Tutor] How to test mobile apps using python

2014-06-13 Thread Steven D'Aprano
On Fri, Jun 13, 2014 at 01:27:07AM -0700, Reuben wrote: > Hi, > > I would like to know how we could test android mobile apps using python. > Lets say I want to test my skype app. How can we go about? This forum is for learning the Python language, and unfortunately there's no "test_android_app"

Re: [Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread Dave Angel
diliup gabadamudalige Wrote in message: > there are many dictionaries and lists which are used in various functions. Is it better/pythonic/efficient to have these inside the function itself or declared at the beginning of the program in which case they will be global? They are all read only. I

Re: [Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread Steven D'Aprano
On Fri, Jun 13, 2014 at 12:51:25PM +0530, diliup gabadamudalige wrote: > Hi All! > Hope everyone is well. > > In my code there are many dictionaries and lists which are used in various > functions. Is it better/pythonic/efficient to have these inside the > function itself or declared at the beginn

Re: [Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread Albert-Jan Roskam
- Original Message - > From: Steven D'Aprano > To: tutor@python.org > Cc: > Sent: Friday, June 13, 2014 1:45 PM > Subject: Re: [Tutor] global variables/constants versus volatile > variables/constants > > On Fri, Jun 13, 2014 at 12:51:25PM +0530, diliup gabadamudalige wrote: >>

Re: [Tutor] AttributeError: 'module' object has no attribute 'start'

2014-06-13 Thread Dave Angel
jason sam Wrote in message: > (Please use text mail, as html gets distorted and/or jumbled. Also, many people here cannot see attachments, so you should paste them into your text message. And be sure to put a marker before each file indicating it's original filename) self.update_grid() F

Re: [Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread Steven D'Aprano
On Fri, Jun 13, 2014 at 05:10:28AM -0700, Albert-Jan Roskam wrote: > The other day I used collections.namedtuple and I re-initialized > Record (see below) with every function*) call. Bad idea! It looks > nicer because I did not need a global (and globals are baaad, mkay?), > but it was *much* s

Re: [Tutor] AttributeError: 'module' object has no attribute 'start'

2014-06-13 Thread Mark Lawrence
On 12/06/2014 17:51, jason sam wrote: The last question i hadn't asked yet..and if u are not interested in answering the question then also refrain from commenting please! On Thu, Jun 12, 2014 at 9:47 PM, Mark Lawrence mailto:breamore...@yahoo.co.uk>> wrote: On 12/06/2014 05:51, jason sam w

Re: [Tutor] AttributeError: 'module' object has no attribute 'start'

2014-06-13 Thread Prasad, Ramit
> Please don't top post on this list. Please don't try telling me what to > do or not do. Thanks in anticipation. Oh the irony. Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and compl

Re: [Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread Albert-Jan Roskam
- Original Message - > From: Steven D'Aprano > To: tutor@python.org > Cc: > Sent: Friday, June 13, 2014 3:08 PM > Subject: Re: [Tutor] global variables/constants versusvolatile > variables/constants > > On Fri, Jun 13, 2014 at 05:10:28AM -0700, Albert-Jan Roskam wrote:

Re: [Tutor] Problem reading large files in binary mode

2014-06-13 Thread Mirage Web Studio
Thank you, i will keep all that in mind. My python version is 3.3.5 George On 13-06-2014 16:07, Peter Otten wrote: Mirage Web Studio wrote: Try reading the file in chunks instead: CHUNKSIZE = 2**20 hash = hashlib.md5() while True: chunk = f.read(CHUNKSIZE) if not chunk:

Re: [Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread diliup gabadamudalige
Thank you all for these elaborate explanations. so would it be wrong to assume that, 1. the list or dict if 'large' and not mutated is better declared once in a Class and used throughout the program? or 2. Lists that are read only are better off being tuples? or 3.the list or dict if 'large' and no

Re: [Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread diliup gabadamudalige
Thank you all for these elaborate explanations. so would it be wrong to assume that, 1. the list or dict if 'large' and not mutated is better declared once in a Class and used throughout the program? or 2. Lists that are read only are better off being tuples? or 3.the list or dict if 'large' and no

Re: [Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread Alan Gauld
On 13/06/14 19:20, diliup gabadamudalige wrote: I declare the following dict at the beginning of the program. KEY_SIGNATURES = {"C": [], "G": ["F"], "D": ["F", "C"], "A": ["F", "C", "G"], "E": ["F", "C", "G", "D"], "B": ["F", "C", "G", "D", "A"], "F#": now in the functions when ever I need to

Re: [Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread Steven D'Aprano
On Fri, Jun 13, 2014 at 09:42:34PM +0530, diliup gabadamudalige wrote: > Thank you all for these elaborate explanations. > so would it be wrong to assume that, > 1. the list or dict if 'large' and not mutated is better declared once in a > Class and used throughout the program? There is *no* advan

Re: [Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread Steven D'Aprano
Albert-Jan, I've been meaning to ask for a long time... I don't suppose you're hitting "Forward" rather than "Reply" in your posts are you? Because I've never seen replies from anyone else use the same style as your replies. Further comments below. On Fri, Jun 13, 2014 at 10:14:46AM -0700, Alb

Re: [Tutor] global variables/constants versus volatile variables/constants

2014-06-13 Thread Cameron Simpson
On 14Jun2014 11:21, Steven D'Aprano wrote: On Fri, Jun 13, 2014 at 09:42:34PM +0530, diliup gabadamudalige wrote: 2. Lists that are read only are better off being tuples? Possibly. It depends. As a general rule, tuples may be used for heterogeneous data, lists should be used for homogeneous