[Tutor] wikibooks

2006-09-18 Thread Hugh Stewart
Hi All,   The following site maybe of interest:   http://en.wikibooks.org/wiki/Wikibooks:Computing_department     Hugh ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to convert a decimal integer into binary

2006-09-18 Thread Luke Paireepinart
Asrarahmed Kadri wrote: > Can anyone help me with teh problem of "converting a decimal number > into its binary equivalent"?? > Ah, sorry, I didn't read the subject line, just the e-mail. You said a decimal integer into binary. I thought you meant any random decimal value. My bad :) You should

Re: [Tutor] How to convert a decimal integer into binary

2006-09-18 Thread Luke Paireepinart
Asrarahmed Kadri wrote: > Can anyone help me with teh problem of "converting a decimal number > into its binary equivalent"?? > How is your decimal number stored? > Thanks in anticipation. > > Regards, > Asrar Kadri > >

[Tutor] How to convert a decimal integer into binary

2006-09-18 Thread Asrarahmed Kadri
Can anyone help me with teh problem of "converting a decimal number into its binary equivalent"??   Thanks in anticipation.   Regards, Asrar Kadri   --   Winners are willing to do things that losers wont do. ___

Re: [Tutor] Help with parsing

2006-09-18 Thread Andrew Robert
Bryan Leber wrote: > > Hello, I am trying to create a script that reads from the command line > and puts the sysargv into a list. I have this part done. I have added > code for testing and one of those testing procedures is to print the > list out in a text file. Not all field are required and may

Re: [Tutor] Some questions about my yen-USD.py

2006-09-18 Thread Amadeo Bellotti
thats fine its just my dad would need that and it would be easier for him if he had the exchange rate bulit inOn 9/17/06, Dick Moores < [EMAIL PROTECTED]> wrote:At 07:10 PM 9/17/2006, Amadeo Bellotti wrote:>ok i jsut wanted to say great program but i would like to see an >acutal exchange rate like

Re: [Tutor] Some questions about my yen-USD.py

2006-09-18 Thread Alan Gauld
>>> And what's the downside of the way I've done it? >> >> Its slow... > > Actually it is not particularly slow. The actual function code is > created once, when the module is compiled; creating a function > object and binding it to a name is pretty fast. There is a good > discussion here: > htt

Re: [Tutor] Some questions about my yen-USD.py

2006-09-18 Thread Dick Moores
At 06:56 AM 9/18/2006, Luke Paireepinart wrote: >Dick Moores wrote: >>At 05:20 AM 9/18/2006, Kent Johnson wrote: >> >> >>>You have greatly underused Decimal - it is capable of multiplication and >>>division of fractional quantities directly: >>> >>>In [1]: from decimal import Decimal as D >>> >>>In

Re: [Tutor] Some questions about my yen-USD.py

2006-09-18 Thread Luke Paireepinart
Dick Moores wrote: > At 05:20 AM 9/18/2006, Kent Johnson wrote: > > >> You have greatly underused Decimal - it is capable of multiplication and >> division of fractional quantities directly: >> >> In [1]: from decimal import Decimal as D >> >> In [2]: x=D('1.23') >> >> In [3]: y=D('4.5') >> >> I

Re: [Tutor] Some questions about my yen-USD.py

2006-09-18 Thread Luke Paireepinart
Dick Moores wrote: > At 01:00 AM 9/18/2006, Alan Gauld wrote: > 1. in your roundNumber function, you define a function incrementDigit. I'm pretty sure that this function is destroyed and recreated every time you call the function roundNumber. >>> I don't

Re: [Tutor] Some questions about my yen-USD.py

2006-09-18 Thread Dick Moores
At 05:20 AM 9/18/2006, Kent Johnson wrote: >You have greatly underused Decimal - it is capable of multiplication and >division of fractional quantities directly: > >In [1]: from decimal import Decimal as D > >In [2]: x=D('1.23') > >In [3]: y=D('4.5') > >In [4]: x*y >Out[4]: Decimal("5.535") > >In

Re: [Tutor] Some questions about my yen-USD.py

2006-09-18 Thread Dick Moores
At 01:00 AM 9/18/2006, Alan Gauld wrote: > >> 1. in your roundNumber function, you define a function > >> incrementDigit. > >> I'm pretty sure that this function is destroyed and recreated > >> every time > >> you call the function roundNumber. > > I don't understand. What's another way? > >def

Re: [Tutor] Some questions about my yen-USD.py

2006-09-18 Thread Kent Johnson
Alan Gauld wrote: >>> 1. in your roundNumber function, you define a function >>> incrementDigit. >>> I'm pretty sure that this function is destroyed and recreated >>> every time >>> you call the function roundNumber. >> I don't understand. What's another way? > > def f(): > def g(): retur

Re: [Tutor] Some questions about my yen-USD.py

2006-09-18 Thread Kent Johnson
Dick Moores wrote: > I'm bck! > > I kept getting ideas for what I (and some of you) thought was a > finished yen-USD.py. And some of the good advice I got was to move on > to other things. I did for a while, but I kept thinking up new > revisions. The script has more than doubled in length.

Re: [Tutor] From byte[] to Image

2006-09-18 Thread Ziad Rahhal
I do the following: file = StringIO.StringIO(buffer) img = Image.open(file) img.save(file, 'JPEG') I get this error: img = Image.open(file)   File "/home/rahhal/python/lib/python2.4/site-packages/PIL/Image.py", line 1745, in open     raise IOError("cannot identify image file") IOError:

Re: [Tutor] From byte[] to Image

2006-09-18 Thread Ziad Rahhal
I do the following: file = StringIO.StringIO(buffer) img = Image.open(file) img.save(file, 'JPEG') I get this error: img = Image.open(file)   File "/home/rahhal/python/lib/python2.4/site-packages/PIL/Image.py", line 1745, in open     raise IOError("cannot identify image file") IOError: cannot id

Re: [Tutor] folder and module

2006-09-18 Thread linda.s
> Hi Linda, > > what do you get when you try: > > >>> import os > >>> os.getcwd() > > The current working directory is represented in sys.path as the first > element: > > >>> import sys > >>> sys.path[0] > '' > > > Not the most intuitive, perhaps. > > I suspect you are launching your Python env

Re: [Tutor] Some questions about my yen-USD.py

2006-09-18 Thread Alan Gauld
>> 1. in your roundNumber function, you define a function >> incrementDigit. >> I'm pretty sure that this function is destroyed and recreated >> every time >> you call the function roundNumber. > I don't understand. What's another way? def f(): def g(): return 42 return g() def g():

Re: [Tutor] Python Course at Foothill College

2006-09-18 Thread Alan Gauld
> *sigh* Perhaps when I start grad school I'll be in a position to use > my > favored language...until then I guess .NET wins. Have you tried IronPython? Python for .NET... Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman

[Tutor] Fw: i just cant do it

2006-09-18 Thread Alan Gauld
- Original Message - From: "federico ramirez" <[EMAIL PROTECTED]> To: "Alan Gauld" <[EMAIL PROTECTED]> Sent: Monday, September 18, 2006 12:43 AM Subject: Re: [Tutor] i just cant do it > Nope...sorry i tried what they said in that article but it didnt > work :( >>_< > > 2006/9/17, Alan

Re: [Tutor] Some questions about my yen-USD.py

2006-09-18 Thread Dick Moores
At 08:13 PM 9/17/2006, Luke Paireepinart wrote: Dick Moores wrote: > I'm bck! > > I kept getting ideas for what I (and some of you) thought was a > finished yen-USD.py. And some of the good advice I got was to move on > to other things. I did for a while, but I kept thinking up new > revis