Re: [Tutor] Help for Python Beginner with extracting and manipulating data from thousands of ASCII files

2012-10-03 Thread Cecilia Chavana-Bryant
Got it, many thanks for your help. On Tue, Oct 2, 2012 at 7:59 PM, Oscar Benjamin wrote: > Hi Cecilia, I'm sending this again as the first message was sent only > to you (I hadn't realised that your own message was sent only to me as > well). If you want to reply please reply-all to this message.

Re: [Tutor] a question about maxint

2012-10-03 Thread eryksun
On Wed, Oct 3, 2012 at 1:28 AM, Katya Stolpovskaya wrote: > > Thank you for you reply, but with "long" I got the same error: > from sys import * long > > Traceback (most recent call last): > File "", line 1, in > long > NameError: name 'long' is not defined I assumed some familiarity w

Re: [Tutor] a question about maxint

2012-10-03 Thread Alan Gauld
On 03/10/12 12:33, eryksun wrote: On Wed, Oct 3, 2012 at 1:28 AM, Katya Stolpovskaya Thank you for you reply, but with "long" I got the same error: from sys import * long Traceback (most recent call last): File "", line 1, in long NameError: name 'long' is not defined I assumed some fam

Re: [Tutor] a question about maxint

2012-10-03 Thread eryksun
On Wed, Oct 3, 2012 at 2:53 PM, Alan Gauld wrote: > > The only times you really need to worry about maxsize is when interfacing to > external non-python code. It's not generally a problem, but if you're on a 32-bit platform, for which sys.maxsize is 2**31 - 1, that sets the maximum length of a se

[Tutor] forcing the None values of a dictionary

2012-10-03 Thread Brannon, Terrence
I'm wondering if there is something I overlooked for this function I wrote... and also whether it could've been done destrictively instead of returning a new dictionary: def dictNoneValueTo(d, new_value=''): """force None values in a dictionary to a default value""" for k in d: i

Re: [Tutor] forcing the None values of a dictionary

2012-10-03 Thread Dave Angel
On 10/03/2012 03:59 PM, Brannon, Terrence wrote: > I'm wondering if there is something I overlooked for this function I wrote... > and also whether it could've been done destrictively instead of returning a > new dictionary: > > def dictNoneValueTo(d, new_value=''): > """force None values in

Re: [Tutor] forcing the None values of a dictionary

2012-10-03 Thread bob gailer
On 10/3/2012 3:59 PM, Brannon, Terrence wrote: I'm wondering if there is something I overlooked for this function I wrote... and also whether it could've been done destrictively instead of returning a new dictionary: I don't understand your question. Could you clarify? What does "destrict

[Tutor] modifying lists of lists

2012-10-03 Thread Ed Owens
I'm just learning Python, so I apologize for a newby question. I'm trying to work with lists of lists, the lowest level of which hold one or more tuples. I've tried to condense what I've tried. The code is: #! Python 2.7 import copy list = [] for i in range(8): list.append((i, i+1)) H = [[l

[Tutor] reloading a module

2012-10-03 Thread Leo Degon
So Ive got code that i import a module to get certain saved variables, where i edit the text file that comprises the module to edit those saved variable. My problem is I cant reload the module to access those modified variables. I was wondering how can i reload or otherwise refresh the module. pyth

Re: [Tutor] reloading a module

2012-10-03 Thread Steven D'Aprano
On 04/10/12 11:56, Leo Degon wrote: So Ive got code that i import a module to get certain saved variables, where i edit the text file that comprises the module to edit those saved variable. My problem is I cant reload the module to access those modified variables. I was wondering how can i reload

Re: [Tutor] reloading a module

2012-10-03 Thread bob gailer
On 10/3/2012 9:56 PM, Leo Degon wrote: So Ive got code that i import a module to get certain saved variables, where i edit the text file that comprises the module to edit those saved variable. My problem is I cant reload the module to access those modified variables. Why not? What did you try?

Re: [Tutor] reloading a module

2012-10-03 Thread Dave Angel
On 10/03/2012 09:56 PM, Leo Degon wrote: > So Ive got code that i import a module to get certain saved variables, > where i edit the text file that comprises the module to edit those saved > variable. My problem is I cant reload the module to access those modified > variables. > I was wondering how

Re: [Tutor] modifying lists of lists

2012-10-03 Thread Steven D'Aprano
On 04/10/12 11:46, Ed Owens wrote: I'm just learning Python, so I apologize for a newby question. I'm trying to work with lists of lists, the lowest level of which hold one or more tuples. I've tried to condense what I've tried. Hi Ed, and welcome! The code is: I'm afraid I can't make he

Re: [Tutor] Why difference between printing string & typing its object reference at the prompt?

2012-10-03 Thread boB Stepp
Thanks to all who responded. There was much more going on here than I ever would have suspected. I am glad I asked the questions I did. This has been very informative. On Tue, Oct 2, 2012 at 11:53 PM, Dave Angel wrote: > > There are two operations supported by (most) objects that produce a > str

Re: [Tutor] Why difference between printing string & typing its object reference at the prompt?

2012-10-03 Thread boB Stepp
On Wed, Oct 3, 2012 at 1:38 AM, Steven D'Aprano wrote: > The long answer is a bit more subtle, and rather long. I had initial suspicions this would be the case Thanks for yours and Dave's detailed exposition! [...] > Python is no different: words, text if you will, that are part of the > code

Re: [Tutor] modifying lists of lists

2012-10-03 Thread Ed Owens
You are fundamentally correct about my confusion, though I'm trying to work with tuples as the lowest level, which may not be relevant here. -Original Message- . py> H = [[1, 2]] py> J = [H[0]] py> print H [[1, 2]] py> print J [[1, 2]] py> H[0][0] = 99 py> print H # expected, and got, [

Re: [Tutor] modifying lists of lists

2012-10-03 Thread eryksun
On Wed, Oct 3, 2012 at 11:52 PM, Ed Owens wrote: > > py> H = [[1, 2]] > py> J = [H[0]] > py> H[0][1] = copy.deepcopy(H[0][0]) > > How do I decouple these references? You can use the slice H[0][:] to get a shallow copy of the H[0] list. By "shallow copy" I mean you get a new list that contains the