Re: [Tutor] Rounding a float to n significant digits

2006-11-30 Thread Tim Peters
[Dick Moores] > ... > But isn't there a PRECISE answer to my question? Of course ;-) > Or is it OT? Well, it's really more a question about your machine's floating-point hardware than about Python. Good explanations of exact limits for IEEE-754 floating-point hardware can be found many places o

Re: [Tutor] Rounding a float to n significant digits

2006-11-30 Thread Dick Moores
At 02:57 PM 11/30/2006, wesley chun wrote: >i think on a 32-bit platform, C doubles (IEEE754) are limited to 10 ** >308.25 which is pretty close to 2 ** 1024 > >-wesley Yes, that's close. Did some pinching down: == >>> 2**1023.94 1.797693134862174

Re: [Tutor] OT What's next

2006-11-30 Thread Amadeo Bellotti
I will I'm learning Java at school (icky i no) so i thought C+Java+Python would be redcilously strong(especially with Jython). On 11/30/06, Alan Gauld <[EMAIL PROTECTED]> wrote: "Amadeo Bellotti" <[EMAIL PROTECTED]> wrote > i have Sams teach yourself C in 21 days fr starters > is that any goo

Re: [Tutor] Rounding a float to n significant digits

2006-11-30 Thread wesley chun
i think on a 32-bit platform, C doubles (IEEE754) are limited to 10 ** 308.25 which is pretty close to 2 ** 1024 -wesley ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] OT What's next

2006-11-30 Thread Alan Gauld
"Amadeo Bellotti" <[EMAIL PROTECTED]> wrote > i have Sams teach yourself C in 21 days fr starters > is that any good? I haven't seen it but given you already know at least the basics of programming through Python I'm pretty sure it will be good enough to get you up and started in C. C is a v

Re: [Tutor] OT What's next

2006-11-30 Thread Amadeo Bellotti
thank you soo much Alan i have Sams teach yourself C in 21 days fr starters is that any good? On 11/30/06, Alan Gauld <[EMAIL PROTECTED]> wrote: "Amadeo Bellotti" <[EMAIL PROTECTED]> wrote > step two sites to learn anyone know where i can look > up c programming for linux? Ah! Now, if you'd

[Tutor] how to save wxpython output

2006-11-30 Thread Ketan Maheshwari
Hi *: How do I save the output of a wxpython program as a jpg or png image from within the program? Thanks, k. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Best Known Method for Filtering redundant list items.

2006-11-30 Thread John Fouhy
On 01/12/06, Chris Hengge <[EMAIL PROTECTED]> wrote: > Nice! Thank you. > > Curious as to why this happens though... > > >>> list1 = ['1','1','2','3','4'] > >>> list2 = list(set(list1)) > >>> list2 > ['1', '3', '2', '4'] <-- here the order has changed. For the same reason that dictionaries don't p

Re: [Tutor] Best Known Method for Filtering redundant list items.

2006-11-30 Thread Python
Right after hitting send I realized I fail to preserver order. If preserving order is important, we're back to using more complex code. On Thu, 2006-11-30 at 16:01 -0500, Python wrote: > On Thu, 2006-11-30 at 12:51 -0800, Chris Hengge wrote: > > Anyone point me to something more efficient then >

Re: [Tutor] Best Known Method for Filtering redundant list items.

2006-11-30 Thread Chris Hengge
No problem at all, as I said, this doesn't matter for my needs since I'm just posting values into a DB. Just curious why it jumbles it all up :) On 11/30/06, Lloyd Kvam <[EMAIL PROTECTED]> wrote: There is a fly in the ointment that hit me after I sent the email. Using set does not preserve the

Re: [Tutor] Use Python to learn kids (9 yr) to program

2006-11-30 Thread TomW
Anders Persson wrote: > Hi! > > I have looked around for som language to use to learn my 9 year son > programming. > > There is a KPL - Kids Programming Language but my son diden't grasp the > OO, GUI and everyting around this, maby becurse English is not his spoken > language, and for a beginner

Re: [Tutor] Best Known Method for Filtering redundant list items.

2006-11-30 Thread Chris Hengge
Nice! Thank you. Curious as to why this happens though... list1 = ['1','1','2','3','4'] list2 = list(set(list1)) list2 ['1', '3', '2', '4'] <-- here the order has changed. This doesn't matter for my program, its just for a script that takes excel columns and posts them into a given SQL db col

Re: [Tutor] Best Known Method for Filtering redundant list items.

2006-11-30 Thread Jordan Greenberg
Chris Hengge wrote: > Anyone point me to something more efficient then > > for item in list1: > if item not in list2: > list2.append() > > This just seems to take a bit a time when there are thousands or dozens of > thousands of records just to filter out the dozen or so copies.. >

Re: [Tutor] finding AcroRd32.exe - a better way ?

2006-11-30 Thread Dave S
On Thursday 30 November 2006 20:50, Terry Carroll wrote: > On Thu, 30 Nov 2006, Dave S wrote: > > My app generates an on the fly PDF manual by using reportlab, once > > generated I would like it to be automatically opened and displayed by XP > > adobe reader. > > > > Here's where I get stuck. ... >

Re: [Tutor] Best Known Method for Filtering redundant list items.

2006-11-30 Thread Python
On Thu, 2006-11-30 at 12:51 -0800, Chris Hengge wrote: > Anyone point me to something more efficient then > list2 = list(set(list1)) Older Pythons will force you to import sets and use sets.Set > for item in list1: > if item not in list2: >list2.append() > > This just seems to

Re: [Tutor] Use Python to learn kids (9 yr) to program

2006-11-30 Thread Alan Gauld
"R. Alan Monroe" <[EMAIL PROTECTED]> wrote > http://davidbau.com/archives/2005/07/29/haaarg_world.html > Loved it Alan! Thanks for posting, I'd never have stumbled across that one. :-) Alan G. ___ Tutor maillist - Tutor@python.org http://mail.

Re: [Tutor] Rounding a float to n significant digits

2006-11-30 Thread Dick Moores
At 11:19 PM 11/27/2006, Dick Moores wrote: >I just dug this Tim Smith creation out of the Tutor archive. > >def round_to_n(x, n): > """ > Rounds float x to n significant digits, in scientific notation. > Written by Tim Peters. See his Tutor list post of 7/3/04 at > h

[Tutor] Best Known Method for Filtering redundant list items.

2006-11-30 Thread Chris Hengge
Anyone point me to something more efficient then for item in list1: if item not in list2: list2.append() This just seems to take a bit a time when there are thousands or dozens of thousands of records just to filter out the dozen or so copies.. Thanks.

Re: [Tutor] finding AcroRd32.exe - a better way ?

2006-11-30 Thread Terry Carroll
On Thu, 30 Nov 2006, Dave S wrote: > My app generates an on the fly PDF manual by using reportlab, once generated > I > would like it to be automatically opened and displayed by XP adobe reader. > > Here's where I get stuck. ... > > os.execv('E:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.

Re: [Tutor] How to get Python to find tk/tcl?

2006-11-30 Thread Dick Moores
At 11:44 AM 11/30/2006, you wrote: >Dick Moores wrote: > > I'd like to use TableListWrapper > > (). I ran it as > > TableList.py, and got this error: > > > > E:\Python25\dev\Tkinter>python TableList.py > > Traceback (most recent call last): > >

[Tutor] finding AcroRd32.exe - a better way ?

2006-11-30 Thread Dave S
My app generates an on the fly PDF manual by using reportlab, once generated I would like it to be automatically opened and displayed by XP adobe reader. Here's where I get stuck. ... os.execv('E:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe', ('/n', '/s', 'user.pdf')) Does what I need

Re: [Tutor] Use Python to learn kids (9 yr) to program

2006-11-30 Thread Alan Gauld
"Anders Persson" <[EMAIL PROTECTED]> wrote > So my plan is to use Python, has anyone try to learn kids this way, > and > could giv som ide how-to. I meant to mention that SmallTalk also has a good reputation as a teaching language with kids in the 10-15 age group. I've never tried it, but perso

Re: [Tutor] Use Python to learn kids (9 yr) to program

2006-11-30 Thread Alan Gauld
"Anders Persson" <[EMAIL PROTECTED]> wrote > So my plan is to use Python, has anyone try to learn kids this way, > and > could giv som ide how-to. I have had an 11 year old complete my tutorial with no help from adults (apart from a few emails to me) and a 10 year old complete it with the aid o

Re: [Tutor] OT What's next

2006-11-30 Thread Alan Gauld
"Amadeo Bellotti" <[EMAIL PROTECTED]> wrote > step two sites to learn anyone know where i can look > up c programming for linux? Ah! Now, if you'd said you were talking about a Linux PC then there would be no question. C is the only way to go. The Linux documentation project has loads of stuff

Re: [Tutor] How to get Python to find tk/tcl?

2006-11-30 Thread Kent Johnson
Dick Moores wrote: > I'd like to use TableListWrapper > (). I ran it as > TableList.py, and got this error: > > E:\Python25\dev\Tkinter>python TableList.py > Traceback (most recent call last): >File "TableList.py", line 1142, in > ta

[Tutor] How to get Python to find tk/tcl?

2006-11-30 Thread Dick Moores
I'd like to use TableListWrapper (). I ran it as TableList.py, and got this error: E:\Python25\dev\Tkinter>python TableList.py Traceback (most recent call last): File "TableList.py", line 1142, in tabletest() File "TableList.py", l

Re: [Tutor] Why SelectAll() cannot work well ?

2006-11-30 Thread johnf
On Thursday 30 November 2006 00:13, Jia Lu wrote: > import wx > > ComboList = ['Akari', 'Aika', 'Alice'] > > class MyApp(wx.App): >     def OnInit(self): >         frame = wx.Frame(None, -1, "ARIA", size=(250, 100)) >         frame.Show() > >         self.CBox = wx.ComboBox(frame, -1, "Alicia", pos

Re: [Tutor] Why SelectAll() cannot work well ?

2006-11-30 Thread johnf
On Thursday 30 November 2006 00:13, Jia Lu wrote: > Hi all > > I am using wx Py with FC6. I ran the program below but I found the method > SelectAll() cannot work well.(The last letter didnot be selected.!!) > -- > import wx > > ComboList = ['Akari', 'Aika', 'Alice'] > > class MyApp

Re: [Tutor] Why SelectAll() cannot work well ?

2006-11-30 Thread Jason Massey
I'm running WinXP and the entire text is selected when you enter a new choice. In fact, on XP at least, you don't have to use SelectAll, SetFocus selected the entire text. On 11/30/06, Jia Lu <[EMAIL PROTECTED]> wrote: Hi all I am using wx Py with FC6. I ran the program below but I found th

[Tutor] Why SelectAll() cannot work well ?

2006-11-30 Thread Jia Lu
Hi all I am using wx Py with FC6. I ran the program below but I found the method SelectAll() cannot work well.(The last letter didnot be selected.!!) -- import wx ComboList = ['Akari', 'Aika', 'Alice'] class MyApp(wx.App): def OnInit(self): frame = wx.Frame(None, -1, "