Re: [Tutor] OT self-implementation?

2005-07-02 Thread Kent Johnson
It is called bootstrapping. Some hints on this page: http://en.wikipedia.org/wiki/Bootstrap Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] OT self-implementation?

2005-07-02 Thread Alan G
> the original 19th c. German ;-) Naively, one thinks that to write > anything in C, you'd have to *have* C to write in, etc. You are correct. Or at least you need the subset of C needed for a minimal compiler. So you figure out your minimal comiler in C. Then you write a basic assembler program

Re: [Tutor] slicing nested lists/dicts/tuples

2005-07-02 Thread Luis N
Hi, Yes, sorry I haven't posted to the list in a while. I should have been more specific. I'm writing a simple contact database, using metakit as the backend. Thank you for pointing out that what I was trying to do was easier than I believed. Here's some code. db = metakit.storage('c:/addy.mk'

Re: [Tutor] slicing nested lists/dicts/tuples

2005-07-02 Thread Luis N
On 7/2/05, Luis N <[EMAIL PROTECTED]> wrote: Umm, sorry, I meant: d[desc[x]] = exec("""'vw[%s].desc[%s]'""" % (r,x )) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] OT self-implementation?

2005-07-02 Thread Bill Burns
Brian, If you've never read this before, you may find it interesting: http://cm.bell-labs.com/who/ken/trust.html Bill ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] How do I make Python calculate square roots?

2005-07-02 Thread Nathan Pinno
Hi all,Does anyone know how to make Python calculate square roots?   Thanks, Nathan Pinnohttp://www.npinnowebsite.ca/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How do I make Python calculate square roots?

2005-07-02 Thread Reed L. O'Brien
Nathan Pinno wrote: > Hi all, > > Does anyone know how to make Python calculate square roots? > > Thanks, > Nathan Pinno > http://www.npinnowebsite.ca/ > > > >_

[Tutor] Iterating over nested lists part2

2005-07-02 Thread Luis N
Okay, This works great now: def listItems():     l= []     d = {}     for r in range(len(vw)):     for x in range(lt):     ed = desc[x]     exec("d['%s']=vw[%d].%s" % (ed,r,ed))     l.append(d)     print l But, it multiplies all of the records from vw by 5. How can I ha

Re: [Tutor] OT self-implementation?

2005-07-02 Thread Brian van den Broek
Alan G said unto the world upon 02/07/2005 03:53: >>the original 19th c. German ;-) Naively, one thinks that to write >>anything in C, you'd have to *have* C to write in, etc. > > > You are correct. Or at least you need the subset of C needed for a > minimal compiler. > > So you figure out your

[Tutor] code for expressing rationals in arbitrarty bases

2005-07-02 Thread Brian van den Broek
Hi all, In a private exchange about floating point representation error spun off of c.l.p., I'd sent someone some code to express rationals (subject to some constraints) in arbitrary bases, 1 < base < 37. The aim was to illustrate my claim that whether a rational had a repeating expansion[*] o

Re: [Tutor] slicing nested lists/dicts/tuples

2005-07-02 Thread Brian van den Broek
Luis N said unto the world upon 02/07/2005 07:51: > On 7/2/05, Luis N <[EMAIL PROTECTED]> wrote: > > Umm, sorry, I meant: > > d[desc[x]] = exec("""'vw[%s].desc[%s]'""" % (r,x )) > > > > > > __

Re: [Tutor] OT self-implementation?

2005-07-02 Thread Alan G
> > (*)One of the hardest malicious bugs I've seen was by a > > disgruntled employee who deliberately inserted a bug into the C > > source of the companies compiler. ... He then left the > > company... > good lord, but if that fellow could only have harnessed that > ingeniousness for the forces o

[Tutor] search through a list

2005-07-02 Thread nephish
hey there i have a file that i want to read. each line in the file is the name of a file. the next line is how many lines are in that file. example of loglist.txt log1.txt 232 log2.txt 332 log3.txt 223 so log1 is a text file that has 232 lines in it. ok, so what i want to do is read this file,

Re: [Tutor] Iterating over nested lists part2

2005-07-02 Thread Kent Johnson
Luis N wrote: > def listItems(): > l= [] > d = {} > for r in range(len(vw)): > for x in range(lt): > ed = desc[x] > exec("d['%s']=vw[%d].%s" % (ed,r,ed)) > l.append(d) > print l If I understand correctly, you want to take all the rows of the

[Tutor] String to List and back?

2005-07-02 Thread Chinook
I'm missing something simple again. The simplified issue is: Python 2.4.1 (#2, Mar 31 2005, 00:05:10) >>> mystr = 'abc' # I can create a list of the string characters # with list comprehension >>> [c for c in mystr] ['a', 'b', 'c'] # Or just a simple builtin conversion function >>> l

Re: [Tutor] String to List and back?

2005-07-02 Thread Light
Hi, Lee. You could using: >>> bts = ''.join(strlist) Then you would get: >>> bts'abc'   Light   FOX.GIF Description: GIF image ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] String to List and back?

2005-07-02 Thread Chuck Allison
Hello Chinook, How about join(), as in ''.join(strlist) ? Saturday, July 2, 2005, 9:45:28 PM, you wrote: C> I'm missing something simple again. The simplified issue is: C> Python 2.4.1 (#2, Mar 31 2005, 00:05:10) C> >>> mystr = 'abc' C> # I can create a list of the string characters C>

Re: [Tutor] String to List and back?

2005-07-02 Thread Chinook
Just the thing Light and Chuck - I thought there might be something simple (and I've used the join method before duh). Thanks, Lee C ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] How to get 4 numbers from the user in one line for easy comparision?

2005-07-02 Thread Nathan Pinno
I saw that great idea from Steven, and I appreciate it. I think it will work. Just need to figure out how to get 4 numbers from the player on one line for easy comparison, e.g. telling whether the number is correct position and number, incorrect position and correct number, or both are incorr