[Tutor] close failed in file object destructor:
bgailer at gmail.com
Wed Oct 19 19:53:21 CEST 2011
On 10/19/2011 1:10 PM, Navneet wrote:
> dude you are rude yaar :)...just chill I am new to python.... and
> programming ...but one thing ...you must be a damn good trainer :)
Thanks for your reply. Please always reply-all so a copy goes to the list,
I hear you are new to Python, and want to be respected for that.
This email list is monitored by a few volunteers. We donate our time
trying to help others get more comfortable with Python.
When I saw your program (with lots of complexity) I assumed you were
more advanced, My fault.
I recommend you start with something very simple, get is working, then
add (one at a time) something new.
For example, write a function that tests a number for primality
Apply it to a small list of small numbers.
Get it working correctly.
Forget (for now) about classes and threads. They just complicate things.
> I'll try and will let you know the complete program ...just give me
some time ..
> On 10/19/2011 10:35 PM, bob gailer wrote:
>> On 10/19/2011 11:50 AM, Navneet wrote:
>>> Thank you Bob and Dave,
>>> Yes the file is as you expected,
>> I don't understand that comment.
>>> I thought it is easy to figure out that you have to change the file
>>> location in program
>> Don't make that assumption. Of course we can figure that out, but you
>> should use something like <pathname> that is obviously to be replaced
>> rather than an invalid filename.
>>> Problem:I am trying to find prime numbers from a file which contains
>>> a list of number and each thread(say 5) is suppose to work on
>>> different number, in short I am applying round-robin method via thread.
>> What does (say 5) mean? Your program will start
>>> I'll try one more time
>> > BTW I have attached the file :D
>> Please don't attach large files. All I wanted was a sample.
>> We will await your next attempt.
>> Fix the program, Run it. If you don't get the desired results think
>> about why, then either continue fixing or post a new program with a
>> new question.
>> Did you think about all the questions I asked. I did not see any
>> answers. I repeat them here. Please answer.
>> * Why did you use a class? You don't need it, and it complicates
>> * Why put some of the code in the mainline of the class and some in
>> __init__. I see no need for that separation.
>> * Since you use print statements to monitor progress how about
>> addind something so you know which print statement was called.
>> Perhaps print "I am here 1", print "I am here 2", etc.
>> * Why have the file at all? Why not just start with c = range(1,1000)?
>> * Why print the entire list? (print c)?
>> Bob Gailer
>> Chapel Hill NC
Chapel Hill NC
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor