Re: [Tutor] urllib2 and tests

2013-05-04 Thread RJ Ewing
Thank you, I figured out what the problem was. I was passing in url into the test_file_fetch function instead of self. URL was a global. I did get the asserts mixed up. They were the opposite of what I wanted. Sorry I didn't include the whole test.py file for reference. Thanks again On Sat, May

Re: [Tutor] urllib2 and tests

2013-05-04 Thread Steven D'Aprano
On 05/05/13 13:27, RJ Ewing wrote: When I run the following test.py, I get the following error: [...] If I run the fetch_file function outside of the test, it works fine. Any ideas? The code you are actually running, and the code you say you are running below, are different. Your error messa

[Tutor] urllib2 and tests

2013-05-04 Thread RJ Ewing
When I run the following test.py, I get the following error: RROR: test_fetch_file (__main__.TestFileFetcher) -- Traceback (most recent call last): File "test_filefetcher.py", line 12, in test_fetch_file fetched_file = filef

Re: [Tutor] changing char list to int list isn't working

2013-05-04 Thread Mitya Sirenef
On 05/04/2013 12:13 AM, Jim Mooney wrote: for num in listOfNumChars: > num = int(num) It seems like people learning Python run into this very often. I think the reason is that in most simple cases, it's easier and more intuitive to think that the name IS the object: x = 1 y = 2 print x +

Re: [Tutor] Python internals

2013-05-04 Thread Steven D'Aprano
On 04/05/13 23:04, kartik sundarajan wrote: Hi, I am trying to learn how Python stores variables in memory. For ex: my_var = 'test' def func(): pass when I type dir() I get ['__builtins__', '__doc__', '__name__', '__package__', 'func', 'help', 'my_var'] are these variables stored in a

[Tutor] Python internals

2013-05-04 Thread kartik sundarajan
Hi, I am trying to learn how Python stores variables in memory. For ex: my_var = 'test' def func(): pass when I type dir() I get ['__builtins__', '__doc__', '__name__', '__package__', 'func', 'help', 'my_var'] are these variables stored in a dict and on calling dir() all the keys are retu

Re: [Tutor] creating a corpus from a csv file

2013-05-04 Thread Peter Otten
Treder, Robert wrote: > I'm very new to python and am trying to figure out how to make a corpus > from a text file. I have a csv file (actually pipe '|' delimited) where > each row corresponds to a different text document. Each row contains a > communication note. Other columns correspond to categ

Re: [Tutor] changing char list to int list isn't working

2013-05-04 Thread Alan Gauld
On 04/05/13 05:13, Jim Mooney wrote: I'm turning an integer into a string so I can make a list of separate chars, then turn those chars back into individual ints, You don't actually need to convert to chars, you could use divmod to do it directly on the numbers: >>> digits = [] >>> root = 455