Re: [Tutor] making onthefly attributes persistent

2010-12-14 Thread Knacktus
Am 13.12.2010 23:50, schrieb Jojo Mwebaze: On Mon, Dec 13, 2010 at 8:44 PM, Alan Gauld mailto:alan.ga...@btinternet.com>> wrote: "Jojo Mwebaze" mailto:jojo.mweb...@gmail.com>> wrote Assuming i have a class bank as below . class bank(object): def __init__(self,

[Tutor] Generating a python file

2010-12-14 Thread C.T. Matsumoto
Hello, Is it possible to create files containing python code in the same sort of way that you can generate text files. A simple example perhaps could be a persistent dictionary. Keys and values are written to the dictionary in a file, that can be imported later. Thanks, T -- C.T. Matsumoto

Re: [Tutor] Generating a python file

2010-12-14 Thread शंतनू
On Tue, Dec 14, 2010 at 14:18, C.T. Matsumoto wrote: > Hello, > > Is it possible to create files containing python code in the same sort of > way that you can generate text files. > > A simple example perhaps could be a persistent dictionary. Keys and values > are written to the dictionary in a fi

Re: [Tutor] Generating a python file

2010-12-14 Thread Albert-Jan Roskam
Hello, If it's specifically about a dictionary, try also the following: import shelve help(shelve) A shelve is a persistent dictionary.  Cheers!! Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education,

Re: [Tutor] Generating a python file

2010-12-14 Thread Alan Gauld
"C.T. Matsumoto" wrote Is it possible to create files containing python code in the same sort of way that you can generate text files. Yes, a python file is just a text file. There is nothing special about it other than the fact that the contents happen to be Python code. A simple example p

Re: [Tutor] Writing to the terminal?

2010-12-14 Thread Steven D'Aprano
Bill Allen wrote: Anyone know how to get WConio.putch() to properly put out a box drawing character to the screen in the while at a cmd prompt? The code page is 437, but it when I tell it to put out 188, for example, it get a 1/4 character instead of the box drawing character. My guess is tha

Re: [Tutor] Generating a python file

2010-12-14 Thread Peter Otten
C.T. Matsumoto wrote: > Is it possible to create files containing python code in the same sort > of way that you can generate text files. > > A simple example perhaps could be a persistent dictionary. Keys and > values are written to the dictionary in a file, that can be imported > later. For si

Re: [Tutor] Generating a python file

2010-12-14 Thread Evans Anyokwu
On Tue, Dec 14, 2010 at 12:06 PM, Peter Otten <__pete...@web.de> wrote: > C.T. Matsumoto wrote: > > > Is it possible to create files containing python code in the same sort > > of way that you can generate text files. > > > > A simple example perhaps could be a persistent dictionary. Keys and > >

Re: [Tutor] Writing to the terminal?

2010-12-14 Thread Bill Allen
Still looking on this one, but I will be sure to post back to the list if I find anything. Thanks, Bill Allen On Tue, Dec 14, 2010 at 5:23 AM, Steven D'Aprano wrote: > Bill Allen wrote: > >> Anyone know how to get WConio.putch() to properly put out a box drawing >> character to the screen in th

Re: [Tutor] Generating a python file

2010-12-14 Thread Peter Otten
Evans Anyokwu wrote: > The page you linked to above was not found. > Could you check the link again - Sorry, I accidentally stripped off the trailing 'l' during cut-and-paste. The correct link is http://docs.python.org/library/json.html Peter ___ Tu

Re: [Tutor] permutations?

2010-12-14 Thread Francesco Loffredo
On 03/12/2010 1.32, Steven D'Aprano wrote: Back in Ancient Days when dinosaurs walked the earth, and I programmed in Pascal, computers didn't have much memory, and were slow. Consequently it wasn't practical to make a copy of a list if you wanted to delete a few items. The only practical way to

Re: [Tutor] permutations?

2010-12-14 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Francesco Loffredo wrote: On 03/12/2010 1.32, Steven D'Aprano wrote: mylist = [x for x in mylist if x != "something"] Up to this point, I share experiences and solution. But the next point did thrill me: If you really need to modify the list in place, and not just