RE: Advise of programming one of my first programs

2012-04-16 Thread Prasad, Ramit
Ramit, This seems to be more logic now I hope :) # import ast fname = 0 lname = 1 country = 2 city = 3 tel = 4 notes = 5 ## Read data from file def load_book():     load_book = open('c:/Python27/Toli/myfile.txt', 'r')     load_book =

Re: Advise of programming one of my first programs

2012-03-31 Thread Anatoli Hristov
Ramit, This seems to be more logic now I hope :) # import ast fname = 0 lname = 1 country = 2 city = 3 tel = 4 notes = 5 ## Read data from file def load_book(): load_book = open('c:/Python27/Toli/myfile.txt', 'r') load_book =

Re: Advise of programming one of my first programs

2012-03-30 Thread Anatoli Hristov
** Absolutely! Too bad your version would be considered the more “complicated” version ;) I`m sure about that, but I`am also sure that every beginner passed true that way. ** ** With the main navigation menu I will only have the option to select a nickname and when a nickname is

RE: RE: Advise of programming one of my first programs

2012-03-29 Thread Prasad, Ramit
From: Anatoli Hristov [mailto:toli...@gmail.com] Sent: Wednesday, March 28, 2012 5:36 PM To: Prasad, Ramit Cc: python-list@python.org Subject: Re: RE: Advise of programming one of my first programs Um, at least by my understanding, the use of Pickle is also dangerous if you

RE: Advise of programming one of my first programs

2012-03-29 Thread Prasad, Ramit
From the Zen of Python, Simple is better than complex. It is a good programming mentality. Complex is better than complicated. :p Absolutely! Too bad your version would be considered the more “complicated” version ;) With the main navigation menu I will only have the option to select a

RE: RE: Advise of programming one of my first programs

2012-03-28 Thread Prasad, Ramit
The use of eval is dangerous if you are not *completely* sure what is being passed in. Try using pickle instead: http://docs.python.org/release/2.5.2/lib/pickle-example.html Um, at least by my understanding, the use of Pickle is also dangerous if you are not completely sure what is

Re: Advise of programming one of my first programs

2012-03-28 Thread Anatoli Hristov
You are correct it is not. :) You code is overly complex making it harder to understand. Try and reduce the problem to the least number of tasks you need. From the Zen of Python, Simple is better than complex. It is a good programming mentality. Complex is better than complicated. :p 2.

Re: RE: Advise of programming one of my first programs

2012-03-28 Thread Anatoli Hristov
Um, at least by my understanding, the use of Pickle is also dangerous if you are not completely sure what is being passed in: Oh goodness yes. pickle is exactly as unsafe as eval is. Try running this code: from pickle import loads

Re: RE: Advise of programming one of my first programs

2012-03-28 Thread Chris Angelico
Thu, Mar 29, 2012 at 9:36 AM, Anatoli Hristov toli...@gmail.com wrote: Um, at least by my understanding, the use of Pickle is also dangerous if you are not completely sure what is being passed in: Oh goodness yes. pickle is exactly as unsafe as eval is. Try running this code: from

Re: Advise of programming one of my first programs

2012-03-27 Thread Anatoli Hristov
Thank you Ramit for your advice`s. I`m reading a book ( Learning Python, Second Edition ) by Mark Lutz and David Ascher and now I just finished the Basic Function lesson :) I will keep in mind what you have advised me, but will implement it later when I have more experience with the book, because

RE: Advise of programming one of my first programs

2012-03-27 Thread Prasad, Ramit
It is considered polite to post your reply either after the quoted text or interspersed as I have done below. By the way I dont know why your mail was in my junk I just saw it. Probably because I only reply back to the list and let the list forward to you. And here is my last code I did for

Re: Advise of programming one of my first programs

2012-03-27 Thread Tim Chase
On 03/27/12 10:32, Prasad, Ramit wrote: fileread = open('myfile.txt','r') tbook = eval(fileread.read()) fileread.close() The use of eval is dangerous if you are not *completely* sure what is being passed in. Try using pickle instead: http://docs.python.org/release/2.5.2/lib/pickle-example.html

Re: Advise of programming one of my first programs

2012-03-27 Thread Anatoli Hristov
This was difficult, now I feel more confused it works, but I`m sure its not the way you wanted :) The use of eval is dangerous if you are not *completely* sure what is being passed in. Try using pickle instead: http://docs.python.org/release/2.5.2/lib/pickle-example.html I`m sure about

Re: Advise of programming one of my first programs

2012-03-27 Thread Anatoli Hristov
Thanks, but I`m still far from for dose details I thing:) Regards Anatoli On Tue, Mar 27, 2012 at 5:53 PM, Tim Chase python.l...@tim.thechases.comwrote: On 03/27/12 10:32, Prasad, Ramit wrote: fileread = open('myfile.txt','r') tbook = eval(fileread.read()) fileread.close() The use of

Re: RE: Advise of programming one of my first programs

2012-03-27 Thread Evan Driscoll
On 01/-10/-28163 01:59 PM, Prasad, Ramit wrote: ### CODE # fileread = open('myfile.txt','r') tbook = eval(fileread.read()) fileread.close() The use of eval is dangerous if you are not *completely* sure what is being passed in. Try using pickle instead:

RE: Advise of programming one of my first programs

2012-03-27 Thread Prasad, Ramit
def load_book(): load_book = open('c:/Python27/Toli/myfile.txt', 'r') load_book = eval(load_book.read()) return load_book def write_book(tbook): write_book = open('c:/Python27/Toli/myfile.txt', 'w') write_book.write(str(tbook)) def details(choice): sb =

Re: Advise of programming one of my first programs

2012-03-27 Thread Tim Chase
On 03/27/12 16:53, Anatoli Hristov wrote: On Tue, Mar 27, 2012 at 5:53 PM, Tim Chase wrote: On 03/27/12 10:32, Prasad, Ramit wrote: fileread = open('myfile.txt','r') tbook = eval(fileread.read()) fileread.close() The use of eval is dangerous if you are not *completely* sure what is being

Re: RE: Advise of programming one of my first programs

2012-03-27 Thread Devin Jeanpierre
On Tue, Mar 27, 2012 at 5:59 PM, Evan Driscoll drisc...@cs.wisc.edu wrote: The use of eval is dangerous if you are not *completely* sure what is being passed in. Try using pickle instead: http://docs.python.org/release/2.5.2/lib/pickle-example.html Um, at least by my understanding, the use

RE: Advise of programming one of my first programs

2012-03-26 Thread Prasad, Ramit
Hi guys just wanted to share one of my first programs. Could you please tell me, do I use a right logic ? It works fine what I wanted to do, but is it writen in the right way? My next step is to make it write the changes of the dictionary on the file :) When you do get that far, you should