[Tutor] The Game of Life

2005-01-03 Thread Danny Yoo
On Mon, 3 Jan 2005, Brian van den Broek wrote: (Aside: one nonobvious example where copying can be avoided is in Conway's Game of Life: when we calculate what cells live and die in the next generation, we can actually use the 'Command' design pattern to avoid making a temporary copy of

Re: [Tutor] A not-so-basic question...

2005-01-03 Thread Alan Gauld
Patric, How do you go about setting up a new application? Thats a great question, and I hope we get a few responses. For example, suppose I need a script that will collect order information for a set of items ona page. Its output will go to a mail program so the artist can be notified. I

Re: [Tutor] dumping .pck files

2005-01-03 Thread Alan Gauld
It seems that to do a good job of dumping the data, I need to tell it what this class looks like. Are there alternatives? Does the pickle format really not provide a way to inspect the data without the class definitions? I suspect that loading the file into a good text editror like vim or

Re: [Tutor] Am I storeing up problems ?

2005-01-03 Thread Dave S
Danny Yoo wrote: On Sun, 2 Jan 2005, Dave S wrote: My matrix 'self.data' consists of a list of 110 items, each item is a dictionary of 250 keys, each key holds two lists, one of four items, one of 12 items. Hi Dave, Hmmm... what kind of data is being copied here? Python's data structures

Re: [Tutor] Sorting/filtering data, dictionary question Re:OT

2005-01-03 Thread Kent Johnson
See comments inline... Bill Burns wrote: One problem I ran into was sorting my lists. The dictionary I initially came up with contained a pipe size designation in this format: 1/2, 3/4, 1, etc. This format is the standard way to write pipe sizes (at least in the US anyway). When I sorted the data

Re: [Tutor] The Game of Life

2005-01-03 Thread Kent Johnson
Danny Yoo wrote: (Aside: one nonobvious example where copying can be avoided is in Conway's Game of Life: when we calculate what cells live and die in the next generation, we can actually use the 'Command' design pattern to avoid making a temporary copy of the world. We can talk about this in

Re: [Tutor] Extracting a PNG Image File from a Binary File..

2005-01-03 Thread Kent Johnson
Looking at your data, the header is at offset 0x60, not 0x50. If I use infile.seek(0x60) it works fine. Kent Aaron Elbaz wrote: Hi, My question is sort of on the difficult side, but I promise I'm a newb ;) So maybe it isn't.. Frederick Lundh himself gave me this chunk of code..and I can't get it

Re: [Tutor] A not-so-basic question...

2005-01-03 Thread Kent Johnson
Patric, I am a strong proponent of - incremental development - unit testing and test-first (or at least test-concurrent) programming - Don't Repeat Yourself and merciless refactoring I look for a small piece of a problem, or a simplification of the problem, and write some code. I write unit tests

Re: [Tutor] simple list query

2005-01-03 Thread Gonçalo Rodrigues
Patrick Hall wrote: Hi Dave, I have a list consisting of about 250 items, I need to know if a particular item is in the list. I know this is better suited to a dictionary but thats not the way it ended up ;-) I could do a for loop to scan the list compare each one, but I have a suspission that

[Tutor] CGI help

2005-01-03 Thread David Holland
I have written my first cgi script :- The .html code is :- HTMLHEADTITLE Friends CGI Demo (Static Screen) /TITLE/HEAD BODYH3Friends list for:INew User/I/H3 FORM ACTION=/home/david/Documents/pyprogramming/friends1.py BEnter your name/B INPUT TYPE=text NAME=person SIZE=15 PBHow many friends do you

Re: [Tutor] CGI help

2005-01-03 Thread Kent Johnson
It sounds like maybe you are opening the HTML directly from the filesystem? You have to install the HTML and CGI into a web server and access them through the server. The details for this will depend on the web server. Kent David Holland wrote: I have written my first cgi script :- The .html

Re: [Tutor] Basic question - How to use a class from a file?

2005-01-03 Thread Alan Gauld
I'm already confused! Seriously, I never done oop before, so even the Python tutorial examples are extremely confusing to me atm. Which tutor are you using? If its the standard Python tutor then its not really for beginners to OOP, you might be better looking at some of the more basic tutors

[Tutor] Breaking down integers?

2005-01-03 Thread kilovh
I would like to be able to take an integer, break it down into individual items in a list, and then put them back together. I know how to do this last part thanks to Orri Ganel and Guillermo Fernandex, but what about taking the integer apart? Sorry if the questions have incredibly obvious

Re: [Tutor] Breaking down integers?

2005-01-03 Thread Brian van den Broek
kilovh said unto the world upon 2005-01-03 17:17: I would like to be able to take an integer, break it down into individual items in a list, and then put them back together. I know how to do this last part thanks to Orri Ganel and Guillermo Fernandex, but what about taking the integer apart? Sorry

[Tutor] Re: here documents

2005-01-03 Thread Jorge Luiz Godoy Filho
Alan Gauld, Segunda 03 Janeiro 2005 21:56, wrote: Oops, those should have been () not {} I always do the same mistake ;-) Using {} seems more intuitive to me. -- Godoy. [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Re: here documents

2005-01-03 Thread Michael Powe
On Mon, Jan 03, 2005 at 10:04:18PM -0200, Jorge Luiz Godoy Filho wrote: Alan Gauld, Segunda 03 Janeiro 2005 21:56, wrote: Oops, those should have been () not {} I always do the same mistake ;-) Using {} seems more intuitive to me. perhaps because of ${var} shell syntax? ;-) mp