Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Tim Peters
[Tim Peters] >> You would in this case, and that would be wrong. In fp you'd get an >> approximation to the exact n * (1./5 + 1./5**2 + ...) == n/4. (use >> the rule for the sum of an infinite geometric series). For example, >> that way you'd compute that 4! == 24 has 4/4 == 1 trailing zero, >>

Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Christian Tschabuschnig
[Tim Peters] > You would in this case, and that would be wrong. In fp you'd get an > approximation to the exact n * (1./5 + 1./5**2 + ...) == n/4. (use > the rule for the sum of an infinite geometric series). For example, > that way you'd compute that 4! == 24 has 4/4 == 1 trailing zero, > inste

Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Tim Peters
[Tim Peters] >> For a fun :-) exercise, prove that the number of trailing zeroes in n! >> is the sum, from i = 1 to infinity, of n // 5**i (of course as soon as >> you reach a value of i such that n < 5**i, the quotient is 0 at that i >> and forever after). >> >> In this case, >> >> 100 // 5 + 100

Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Christian Tschabuschnig
Tim Peters wrote: > [Dick Moores, computes 100 factorial as > > 9332621544394415268169923885626670049071596826438162146859296389521753229915608941463976156518286253697920827223758251185210916864 > > but worries about all the trailing zeros] > >> Yes, I'm sure you a

Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Tim Peters
[Dick Moores, computes 100 factorial as 9332621544394415268169923885626670049071596826438162146859296389521753229915608941463976156518286253697920827223758251185210916864 but worries about all the trailing zeros] > Yes, I'm sure you are. I'd forgotten about all tho

Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Dick Moores
At 04:50 PM 8/18/2006, Christian Tschabuschnig wrote: > >> > 9332621544394415268169923885626670049071596826438162146859296389521753229915608941463976156518286253697920827223758251185210916864 > >>> Still not exactly correct! I'm bewildered. > >>> > >> The results look t

Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Christian Tschabuschnig
>> 9332621544394415268169923885626670049071596826438162146859296389521753229915608941463976156518286253697920827223758251185210916864 >>> Still not exactly correct! I'm bewildered. >>> >> The results look the same to me >> why do you think they're not correct? >> what is

Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Dick Moores
At 04:24 PM 8/18/2006, Luke Paireepinart wrote: >Dick Moores wrote: > > But here's the revised precisionFactorial.py: > > > > > > # 1precisionFactorial.py > > > > import decimal > > > > def d(x): > > return decimal.Decimal(str(x)) > > > > def fact(n): > > product

Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Luke Paireepinart
Dick Moores wrote: > At 02:41 PM 8/18/2006, Bob Gailer wrote: > >> Dick Moores wrote: >> >>> As an exercise that I thought would help me understand the decimal >>> module, I've been trying write a script (precisionFactorial.py) >>> that uses a modified fact(n) to compute precise factorial

Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Dick Moores
At 02:41 PM 8/18/2006, Bob Gailer wrote: >Dick Moores wrote: >>As an exercise that I thought would help me understand the decimal >>module, I've been trying write a script (precisionFactorial.py) >>that uses a modified fact(n) to compute precise factorials >What do you mean by "precise factorials

Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Bob Gailer
Dick Moores wrote: > As an exercise that I thought would help me understand the decimal > module, I've been trying write a script (precisionFactorial.py) that > uses a modified fact(n) to compute precise factorials What do you mean by "precise factorials"? Python's long integer should handle th

[Tutor] puzzled again by decimal module

2006-08-18 Thread Dick Moores
As an exercise that I thought would help me understand the decimal module, I've been trying write a script (precisionFactorial.py) that uses a modified fact(n) to compute precise factorials using the decimal module. I''m getting nowhere fast, and don't understand why. Here's what I have so far:

Re: [Tutor] first programming project

2006-08-18 Thread Alan Gauld
Its a pretty reasonable project, certainly not trivial but not impossible either. > design it and write some pseudocode first. I want to > create a fun GUI assignment manager. I read about the > Tkinter toolkit and would like to use it to write my > program. I made a list of features: > > - roo

Re: [Tutor] man pages parser

2006-08-18 Thread Alan Gauld
> Someone else has done this already. *grin* Check out ESR's > doclifter: > > http://www.catb.org/~esr/doclifter/ Looks like that gets you to XML format, in that case I'd recommend that you go fetch ElementTree and use that to parse the XML files. Alan G.

Re: [Tutor] man pages parser

2006-08-18 Thread Alan Gauld
> to be able to retrieve informations from man pages, specially > existing > options and their help strings. I'd actually try parsing the man page sources. They are already in a layout language so finding the options should be easy - there is a man macro for that I believe. But i've never tried i

Re: [Tutor] (no subject)

2006-08-18 Thread Amadeo Bellotti
Mr. Gauld I run it from termainal on GNOME and it says "** IDLE can't import Tkinter.  Your Python may not be configured for Tk. **" and Yea I am Administrator this is my Home computer after all im only 15.On 8/18/06, Alan Gauld <[EMAIL PROTECTED] > wrote:> thank you but IDLE doesnt seem to work

Re: [Tutor] 2D array question [was (no subject)]

2006-08-18 Thread Amadeo Bellotti
thank you so much Mr. Gauld that really helpedOn 8/18/06, Alan Gauld <[EMAIL PROTECTED]> wrote: > Mr. Kuhlman it says python is not configured for tk.Gaarrgh! Why do linux distros do this? Stooopid... You will need to fetch another version of Python withTk support built in. Its a compile time optio

Re: [Tutor] first programming project

2006-08-18 Thread jim stockford
i hope this helps: what a fun idea! do it! my way is to do a bad job fast then re-visit the plans and reimplement and test and re-visit and reimplement and test and consider writing a main program that does the primary work and outputs as text-only. maybe then create four clas

[Tutor] first programming project

2006-08-18 Thread Johnston Jiaa
I have read through many beginner texts on programming and believe myself to be fairly decent at python, but I have no idea how to do anything worthwhile. I understand that before coding a project it's best to design it and write some pseudocode first. I want to create a fun GUI assignment manage

Re: [Tutor] Actual code that illustrates problem

2006-08-18 Thread Kermit Rose
Alan Gauld wrote: > #print " " #print " In strongfac " #print " Found1: x = ",x >>> >>> You could do all of this with a single print: >>> >>> print "\n In strongfac \nFound1: x = ", x >>> >> uh.. Too compact for me. >> I nee

Re: [Tutor] man pages parser

2006-08-18 Thread Danny Yoo
> to be able to retrieve informations from man pages, specially existing > options and their help strings. Do you know a good way to handle this? I > could parse directly the troff sources (is there already a parser for that?) Hi Tiago, Someone else has done this already. *grin* Check out ESR's

[Tutor] man pages parser

2006-08-18 Thread Tiago Saboga
Hi! I'm working on a front-end to various unix command-line utilities, and I want to be able to retrieve informations from man pages, specially existing options and their help strings. Do you know a good way to handle this? I could parse directly the troff sources (is there already a parser for

Re: [Tutor] Low level socket and threading code in python in HUGEwebsites -

2006-08-18 Thread Kent Johnson
anil maran wrote: > thanks alan it is very enlightening > can one of you guys who have experience building sites > such as yahoo mail and stuff, explain what parts of a > webserver needs to be multithreaded Generally you need a thread or process for each HTTP request, otherwise you will process r

Re: [Tutor] editors

2006-08-18 Thread Alan Gauld
> what editors do you guys use? > > emacs > vi? > xemacs Yes. All of the above Also ed, ex, Axe, xedit, pine, Scite, IPFS, EDT, Notepad, Textpad, etc etc. But the bulk of my Python editing these days is done on either Pythonwin/Scite or vim. The more I use Pyhonwin the more I prefer it to IDLE,

Re: [Tutor] 2D array question [was (no subject)]

2006-08-18 Thread Kent Johnson
Alan Gauld wrote: >> but on another note does anyone know how to make a 2d array? >> > > A 2D array is just a table. There are several ways to do that > in Python If you need high-performance arrays you should look at numpy: http://numpy.scipy.org/ Kent __

Re: [Tutor] Actual code that illustrates problem

2006-08-18 Thread Kent Johnson
Alan Gauld wrote: #print " " #print " In strongfac " #print " Found1: x = ",x >>> You could do all of this with a single print: >>> >>> print "\n In strongfac \nFound1: x = ", x >>> >>> >> uh.. Too compa

Re: [Tutor] editors

2006-08-18 Thread Matthew Webber
I use Eclipse (www.eclipse.org) with the pydev plugin (pydev.sourceforge.net). Eclipse is written in Java (you need the JVM to run it, and a decent amount of memory) and was originally intended for Java development (that's what most of the docs reflect). It now has plugins available for other langu

[Tutor] editors

2006-08-18 Thread anil maran
what editors do you guys use? emacs vi? xemacs are there any plugins to configure autocomplete, i want something to do good autocomplete such as showing what type of arguments are available etc thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail h

[Tutor] 2D array question [was (no subject)]

2006-08-18 Thread Alan Gauld
> Mr. Kuhlman it says python is not configured for tk. Gaarrgh! Why do linux distros do this? Stooopid... You will need to fetch another version of Python with Tk support built in. Its a compile time option so you can either fetch the source an build it yourself or find a Suse package with Tk

[Tutor] Twisted Medusa Athena frameworks

2006-08-18 Thread anil maran
hi guys i m trying to create a simple site, and on certain event triggers the server or python program needs to send out messages to the site. i m tyring to accomplish it using twisted or medusa or Does any one have experience using it or the asyncore module in python please help thanks a ton

Re: [Tutor] web application and database caching technique

2006-08-18 Thread anil maran
Postgresql 8 and python 2.4 let me find out how to do the caching on db, thanks if you have other pointers on how to cache db in python pls let me know --- Alan Gauld <[EMAIL PROTECTED]> wrote: > >i m trying to build a webapplication, i need to > cache db records > > as it has become very slow t

Re: [Tutor] Low level socket and threading code in python in HUGEwebsites -

2006-08-18 Thread anil maran
thanks alan it is very enlightening can one of you guys who have experience building sites such as yahoo mail and stuff, explain what parts of a webserver needs to be multithreaded thanks --- Alan Gauld <[EMAIL PROTECTED]> wrote: > Anil, > > I don't know if this is the kind of thuing they did >

Re: [Tutor] (no subject)

2006-08-18 Thread anil maran
it is amazing the amount of knowledge that is being disseminated on this group, guido should love it that u guys are doing such a good job, keep it up guys anil --- Kent Johnson <[EMAIL PROTECTED]> wrote: > Amadeo Bellotti wrote: > > hello is there a way if a condition is not met to > restart the

Re: [Tutor] All of Kermit's E-Mails

2006-08-18 Thread Alan Gauld
> "The Bat" mail client does a great job of it, but it's not free. > http://www.ritlabs.com/ > > You might try Pegasus Mail, although I don't remember how well it > does > it. http://www.pmail.com/ Since you seem to be on a PC plain old Outlook Express will do a better job that Incredimail and it

Re: [Tutor] (no subject)

2006-08-18 Thread Alan Gauld
> thank you but IDLE doesnt seem to work on Suse 9.2 do you know a way > to fix > it? I've only used IDLE on Linux a few times but it certainly works on RedHat, Mandriva and Slackware. And it used to work on Suse 5 - the only time I ever used Suse... What hapens when you try to run IDLE? It may

Re: [Tutor] Actual code that illustrates problem

2006-08-18 Thread Alan Gauld
>>> #print " " >>> #print " In strongfac " >>> #print " Found1: x = ",x >> >> You could do all of this with a single print: >> >> print "\n In strongfac \nFound1: x = ", x >> > uh.. Too compact for me. > I need to see the logic more spread

Re: [Tutor] banners

2006-08-18 Thread Alan Gauld
> It's simpler than that: the homework states that the message is > hardcoded to show either josip's name or nickname. Ah, OK, I hadn't noticed that. In that case yes it can be as simple as hello world. Alan G. ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Communicating with Win2000 runas.exe

2006-08-18 Thread Tim Golden
[Tim Golden] | > [Barnaby Scott] | > | > | So I'm thinking along these lines: | > | | > | import subprocess | > | sp = subprocess.Popen(r'C:\WINNT\SYSTEM32\runas.exe | > | /user:administrator | > | C:\Program Files\Microsoft Games\Age of Mythology\aom.exe') | > | #some sort of code to send the p