Re: [Tutor] church numerals

2006-11-11 Thread Luke Paireepinart
Danny Yoo wrote: > > The code above is a demonstration of a representation of numbers using > functions, more commonly known as "Church Numerals". Functions are very > powerful. *grin* > > > So the fundamental notation of number isn't necessarily tied down to > anything except the operations

[Tutor] church numerals

2006-11-11 Thread Danny Yoo
The function just mathematically converted a base-10 number into a base-2 number. > For what its worth - we say "base 10" to mean "decimal". But 10 = > decimal only when we have already agreed we are talking decimal! > Consider a planet where residents have 8 fingers. They count 0

Re: [Tutor] Tutor Digest, Vol 33, Issue 48

2006-11-11 Thread Danny Yoo
>> What was the bug? > > If the stringifier saw two instances of the same object, it'd think that > recursion was going on. Unfortunately, since the numbers between 1-100 > are typically interned (as well as strings), it'd also think that if I > visited "0" twice,that I was in a recursive loop

Re: [Tutor] Tutor Digest, Vol 33, Issue 48

2006-11-11 Thread Danny Yoo
>>> I should, though, rephrase the signature as: >>> >>>register: object str_function -> string or None >>> >>> to be more readable. Separately, I can then define that a 'str_function' is >>> a callable that takes anything and turns it into a string. >> >> Ok, I made those changes. I've also

Re: [Tutor] Syntax when using classes question.

2006-11-11 Thread Chris Hengge
Thanks for the great feedback! I was missing the whole "methods that share the same data" aspect of a class.. Thats makes them MUCH more clear to understand. Thanks for both of you having the patience to help me figure this out =D Time for me to ditch the classes from my pyForge.py!On 11/11/06, Al

Re: [Tutor] Syntax when using classes question.

2006-11-11 Thread Alan Gauld
Chris, >I guess I'm just lost as to the point of classes... Outside of using >them to > abstract a collection of methods that have similair roles Most people get hung up on the data aspect of classes and forget that the behaviour(the methods) are actually the most important bit. However you have

Re: [Tutor] First realscript + Game of Life

2006-11-11 Thread Luke Paireepinart
Bob Gailer wrote: > Luke Paireepinart wrote: The function just mathematically converted a base-10 number into a base-2 number. > For what its worth - we say "base 10" to mean "decimal". But 10 = > decimal only when we have already agreed we are talking decimal! > Consider a

Re: [Tutor] Syntax when using classes question.

2006-11-11 Thread Luke Paireepinart
Chris Hengge wrote: > I guess I'm just lost as to the point of classes... Outside of using > them to abstract a collection of methods that have similair roles I > dont see the point.. But when I group similar methods together > (promptForge is a bad example, but I've got class fileForge which ha

Re: [Tutor] First realscript + Game of Life

2006-11-11 Thread Bob Gailer
Luke Paireepinart wrote: >>> The function just mathematically converted a base-10 number into a >>> base-2 number. >>> For what its worth - we say "base 10" to mean "decimal". But 10 = decimal only when we have already agreed we are talking decimal! Consider a planet where residents have

[Tutor] using CVS through Python

2006-11-11 Thread Tony Cappellini
I need to do some automated checkouts of CVS projects from Python scripts, and want ot be able to handle success and failure conditions.While sending the command lines to cvs isn't a problem, I could use some suggestions for how to check the cvs responses. Parsing the text returned from CVS isn't 

Re: [Tutor] Syntax when using classes question.

2006-11-11 Thread Chris Hengge
I guess I'm just lost as to the point of classes... Outside of using them to abstract a collection of methods that have similair roles I dont see the point.. But when I group similar methods together (promptForge is a bad example, but I've got class fileForge which has a few file writing or reading

[Tutor] numpy memory muncher

2006-11-11 Thread Joel Levine
I'm using, perhaps misusing numpy which is eating up the memory and, eventually crashing my program. Isolating it, the following piece of code continually eats memory. Is it my program or what ...? Thanks Joel Levine Using Mac OSX 10.4.7 Not clear on versions: Appears to be 0.9.8 with py2.4

Re: [Tutor] First realscript + Game of Life

2006-11-11 Thread Luke Paireepinart
Okay, so let's see where we are. Integers, as well as strings, and everything else, are stored in memory as binary. This is a given, because the architecture of the computer is binary. You say 'the string representation of the integer is in base-10.' Okay, well, python's representation of any obje

Re: [Tutor] First realscript + Game of Life

2006-11-11 Thread Kent Johnson
Luke Paireepinart wrote: > Kent Johnson wrote: >> Luke Paireepinart wrote: >>> I was trying to make it clear that Python wasn't directly accessing >>> the binary from memory with this function Carlos had. >>> The function just mathematically converted a base-10 number into a >>> base-2 number. >>

Re: [Tutor] First realscript + Game of Life

2006-11-11 Thread Luke Paireepinart
Kent Johnson wrote: > Luke Paireepinart wrote: >> I was trying to make it clear that Python wasn't directly accessing >> the binary from memory with this function Carlos had. >> The function just mathematically converted a base-10 number into a >> base-2 number. > > No. It converts a binary repre

Re: [Tutor] First realscript + Game of Life

2006-11-11 Thread Kent Johnson
Luke Paireepinart wrote: > I was trying to make it clear that Python wasn't directly accessing the > binary from memory with this function Carlos had. > The function just mathematically converted a base-10 number into a > base-2 number. No. It converts a binary representation of a number into a

Re: [Tutor] First realscript + Game of Life

2006-11-11 Thread Luke Paireepinart
Kent Johnson wrote: > Luke Paireepinart wrote: > >> > working> > > I think you are a bit confused here. > Quite possible! > It's important to make a distinction between the way a number is > actually stored in the computer and the string that is created when a > number is printed. > > Most

Re: [Tutor] A strange problem...

2006-11-11 Thread Seweryn Kokot
"Asrarahmed Kadri" <[EMAIL PROTECTED]> writes: > fd.write(e) fd.close() > > i hope it helps regards, SK ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] A strange problem...

2006-11-11 Thread Seweryn Kokot
"Asrarahmed Kadri" <[EMAIL PROTECTED]> writes: > > fd.write(e) > > add: fd.close() to your code I hope it helps regards, SK ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] A strange problem...

2006-11-11 Thread Asrarahmed Kadri
    Hi Folks,   I am trying to create a XML document and then writing it to a file, But the porblem is that I have to run the program twice before the contents are written to the file. Can you explain the reason for such a strange behaviour ?? The code is as below:   from elementtree import Eleme

Re: [Tutor] SAX, DOM, XSLT api

2006-11-11 Thread Jakub Jankiewicz
picio_slug wrote: Hello, what are the equivalent Pyhton tools you suggest to handle: SAX DOM and which api for XSLT ? I know that this is a really newbie question...But I'm a true python newbie ;) ! Daniele P.s: I know I can also google-it a little bit to find those answers but your advices

Re: [Tutor] __init__.py for running a file from commandline?

2006-11-11 Thread Kent Johnson
Marcus Goldfish wrote: > Hoping someone can help with this... > > I have a logical python namespace using a directory tree and __init__.py > files. For example, PYTHONPATH points to ~pyroot, and I have the following: > > ~pyroot/ > ~pyroot/utils/ > ~pyroot/utils/commands/mygrep.py > > Which ma

Re: [Tutor] datetimetype vs datetime.datetime

2006-11-11 Thread Kent Johnson
johnf wrote: > Hi > I'm working on a python interface to freetds. And freetds can access MS SQL > database engines. But I'm having trouble with datatime datatypes. > > The python module I'm using is MSSQL.py written back in 2003. After getting Why are you using such an old version? > it c

Re: [Tutor] First realscript + Game of Life

2006-11-11 Thread Kent Johnson
Luke Paireepinart wrote: > >> But probably (surely) my interpretation is wrong. Hehe >> > Ah, well, it's just the terminology you were using was a bit misleading. > You say > ' Hey Rooy, so its possible to copy binary numbers from memory?' > All his function does is converts an integer (that's

Re: [Tutor] Some sample code: review?

2006-11-11 Thread Kent Johnson
Danny Yoo wrote: >> I should, though, rephrase the signature as: >> >>register: object str_function -> string or None >> >> to be more readable. Separately, I can then define that a 'str_function' is >> a callable that takes anything and turns it into a string. > > Ok, I made those changes.

Re: [Tutor] Help with Elementtree ...how to access the attributes..

2006-11-11 Thread Kent Johnson
doug shawhan wrote: > I'm having some difficulties with elementtree as well. > > I'm attempting to parse a fairly sizeable xml file (it's the ebay > "category tree" report. I've cached a copy at > http://www.crackrabbit.com/misc/CatTree.xml). 900K or so! :-) > I've made a smaller version that I

Re: [Tutor] Syntax when using classes question.

2006-11-11 Thread Alan Gauld
Chris, >pyForge.promptForge.prompt() > TypeError: unbound method prompt() must be called with promptForge > instance > as first argument (got nothing instead) > > ^ Thats why... I have to use : > import pyForge > pyForge.promptForge().prompt() I think the real issue that Luke was raising was

Re: [Tutor] Syntax when using classes question.

2006-11-11 Thread Chris Hengge
Oops... should have said this...    pyForge.promptForge.prompt()TypeError: unbound method prompt() must be called with promptForge instance as first argument (got nothing instead) ^ Thats why... I have to use :import pyForgepyForge.promptForge().prompt()On 11/11/06, Chris Hengge < [EMAIL PROTECTED]

Re: [Tutor] Syntax when using classes question.

2006-11-11 Thread Chris Hengge
>So why did you use two sets of parenthesis here?>Are you completely sure you understand everything that's happening here?    pyForge.promptForge.prompt()TypeError: unbound method prompt() must be called with promptForge instance as first argument (got nothing instead) ^ Thats why... I have to use