[Tutor] memoize, lookup, or KIS?

2012-11-19 Thread Albert-Jan Roskam
Hi, I have a function that converts a date value, expressed as the number of seconds sinds start of the gregorian calendar, into a human-readable format (typically an iso-date). So if a record contains x date values, and a data set contains y records, the number of function calls are x * y.

Re: [Tutor] memoize, lookup, or KIS?

2012-11-19 Thread Steven D'Aprano
On 19/11/12 22:02, Albert-Jan Roskam wrote: Hi, I have a function that converts a date value, expressed as the number of seconds sinds start of the gregorian calendar, into a human-readable format (typically an iso-date). So if a record contains x date values, and a data set contains y records,

Re: [Tutor] memoize, lookup, or KIS?

2012-11-19 Thread Oscar Benjamin
On 19 November 2012 11:02, Albert-Jan Roskam fo...@yahoo.com wrote: Hi, I have a function that converts a date value, expressed as the number of seconds sinds start of the gregorian calendar, into a human-readable format (typically an iso-date). So if a record contains x date values, and a

Re: [Tutor] memoize, lookup, or KIS?

2012-11-19 Thread Albert-Jan Roskam
Presumably the place where you read about them would have listed some example decorators that you can use for memoisation. Here's a quick example that works for hashable inputs: Some of these I don't really understand so I am hesitant to use them. def memo(func):     table = {}     def

Re: [Tutor] memoize, lookup, or KIS?

2012-11-19 Thread Albert-Jan Roskam
Emphasis on might. Unless you have timed the code with or without a lookup table, you're just guessing whether it is an optimization or a pessimization. See my earlier reply to Oscar's mail. I used cProfile and memoizing was almost twice as fast in the fastsest implementation. On the

Re: [Tutor] sending email via smtplib

2012-11-19 Thread Prasad, Ramit
Saad Javed wrote: I don't think using SSL works with hotmail. I tried using: smtplib.SMTP_SSL(smtp.live.com, 587) You need to use port 25 not 587. http://windows.microsoft.com/en-US/hotmail/send-receive-email-from-mail-client smtplib.login(user, passwd) ... That gave this error:

Re: [Tutor] memoize, lookup, or KIS?

2012-11-19 Thread Prasad, Ramit
Albert-Jan Roskam wrote: [snip] Also, you should have some way to stop the lookup table from growing forever. If you are running Python 3.3, you can use functools.lru_cache, which implements a Least Recently Used cache. Once the cache reaches a certain size, the element which was

[Tutor] help

2012-11-19 Thread Isaac Parkes
hi, I'm quite new to python and have just made a program that makes a GUI but when i open it it says there are some errors. I can't find any :( if you find any problems could you tell me ASAP # Match finder from TKinter import * import random girls = ['Ellie', 'Maddy', 'Ursula', 'Annie',

Re: [Tutor] New to Python - simple question

2012-11-19 Thread Unaiza Ahsan
* Where is the histogram() function from? Is it in imtools.py as well? * It is a NumPY function. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] New to Python - simple question

2012-11-19 Thread Unaiza Ahsan
*Hi all, The function histogram is supposed to come from the numpy module; at* * least that's the case on my computer (I have numpy 1.6.2 for Python 2.7): from numpy import ** * histogram function histogram at 0x10b0c0ed8 Maybe something is wrong with Unaiza's version of numpy.* * Kal *Yes

[Tutor] pyXML i Python2.6

2012-11-19 Thread Sreenivasulu
Hi, Am unable to install pyXML in Ubuntu usig python2.6 Could you please help me Regards, Sreenu ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] help

2012-11-19 Thread Matthew Ngaha
It's asking a lot if you want people to read your whole code to try and spot the errors. Try to run it from the console and paste what the errors are here. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] pyXML i Python2.6

2012-11-19 Thread Mark Lawrence
On 19/11/2012 16:33, Sreenivasulu wrote: Hi, Am unable to install pyXML in Ubuntu usig python2.6 Could you please help me Regards, Sreenu What have you tried? What went wrong? If you don't give such basic data how can we help? -- Cheers. Mark Lawrence.

Re: [Tutor] help

2012-11-19 Thread Mark Lawrence
On 19/11/2012 18:07, Isaac Parkes wrote: First of all giving a meaningful subject helps everybody, how about tkinter problems? hi, I'm quite new to python and have just made a program that makes a GUI but when i open it it says there are some errors. I can't find any :( if you find any

Re: [Tutor] help

2012-11-19 Thread Mark Lawrence
On 19/11/2012 23:28, Matthew Ngaha wrote: It's asking a lot if you want people to read your whole code to try and spot the errors. Try to run it from the console and paste what the errors are here. I believe that to be complete nonsense, there was very little code to parse. What was

Re: [Tutor] help

2012-11-19 Thread Steven D'Aprano
On 20/11/12 11:33, Mark Lawrence wrote: On 19/11/2012 23:28, Matthew Ngaha wrote: It's asking a lot if you want people to read your whole code to try and spot the errors. Try to run it from the console and paste what the errors are here. I believe that to be complete nonsense, there was very

Re: [Tutor] New to Python - simple question

2012-11-19 Thread Oscar Benjamin
On 18 November 2012 14:07, Unaiza Ahsan unaiza.ah...@gmail.com wrote: Hi all, The function histogram is supposed to come from the numpy module; at least that's the case on my computer (I have numpy 1.6.2 for Python 2.7): from numpy import * histogram function histogram at 0x10b0c0ed8

[Tutor] How to load python code only after program startup?

2012-11-19 Thread Pete O'Connell
Hi I use a compositing program called Nuke which loads my custom modules on start up. So if I have an error in my python code somewhere, Nuke won't open and it throws a typical error which is easy enough to fix. The problem I am running into is that when others on my network are using an older

Re: [Tutor] sending email via smtplib

2012-11-19 Thread Saad Javed
Using port 25 with SMTP_SSL gives: Traceback (most recent call last): File sendemail.py, line 22, in module smtp = smtplib.SMTP_SSL(smtp_srv, 25) File /usr/lib/python2.7/smtplib.py, line 776, in __init__ SMTP.__init__(self, host, port, local_hostname, timeout) File