Re: [BangPypers] Low level Python

2009-09-14 Thread Anand Balachandran Pillai
On Sun, Sep 13, 2009 at 2:02 PM, Noufal Ibrahim nou...@gmail.com wrote: On Sat, Sep 12, 2009 at 8:10 AM, venka...@gmail.com wrote: I was looking at some bytecode optimizations last year. Tlee had some work already done on that front ; he had a branch. (But, I was not able to reach him and

Re: [BangPypers] Low level Python

2009-09-14 Thread Venkatraman S
On Mon, Sep 14, 2009 at 6:20 PM, Anand Balachandran Pillai abpil...@gmail.com wrote: On Sun, Sep 13, 2009 at 2:02 PM, Noufal Ibrahim nou...@gmail.com wrote: On Sat, Sep 12, 2009 at 8:10 AM, venka...@gmail.com wrote: I was looking at some bytecode optimizations last year. Tlee had some

Re: [BangPypers] Friendfeed's web server framework open sourced

2009-09-14 Thread Dhananjay Nene
http://www.apparatusproject.org/blog/2009/09/twisted-web-vs-tornado-performance-test/ On Mon, Sep 14, 2009 at 6:27 PM, Anand Balachandran Pillai abpil...@gmail.com wrote: On Fri, Sep 11, 2009 at 10:32 PM, Anand Chitipothu anandol...@gmail.comwrote: 2009/9/11 Dhananjay Nene

Re: [BangPypers] Friendfeed's web server framework open sourced

2009-09-14 Thread Dhananjay Nene
One more study with slightly different results hyperlinked below inline On Mon, Sep 14, 2009 at 6:43 PM, Dhananjay Nene dhananjay.n...@gmail.comwrote: http://www.apparatusproject.org/blog/2009/09/twisted-web-vs-tornado-performance-test/ On Mon, Sep 14, 2009 at 6:27 PM, Anand Balachandran

Re: [BangPypers] Implementing a fast factorial function in python

2009-09-14 Thread Anand Chitipothu
 16 fac = int(str(fac * i).strip('0')) % 10 This is ugly hack. Can you think of something more mathematical? Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] Implementing a fast factorial function in python

2009-09-14 Thread Navin Kabra
print f(1) This is a HUGE number. I don't think you are expected to get the answer by direct calculation. I would guess that you are expected to use mathematical reasoning to figure out the answer (and not computation) ___ BangPypers

Re: [BangPypers] Low level Python

2009-09-14 Thread Noufal Ibrahim
On Mon, Sep 14, 2009 at 6:26 PM, Venkatraman S venka...@gmail.com wrote: [..] Thanks for the interest. I will try sometime in Nov/Dec. Probably will try to cover Effect Typing (this is something that i stumbled on recently and was interesting) [..] Excellent! I eagerly look forward to this.

Re: [BangPypers] Implementing a fast factorial function in python

2009-09-14 Thread Amit Saha
Shashwat Anand wrote: How do we calculate last 5-digits of 10**12 ignoring trailing zeros. The code i wrote works good until 10**8 and after that take ages. The source of problem is Project Euler : http://projecteuler.net/index.php?section=problemsid=160 You might consider using the Stirling's

Re: [BangPypers] Implementing a fast factorial function in python

2009-09-14 Thread Anand Chitipothu
The key point i think is we do not need factorial but modulus 10**5 without trailing zeros. Didn't helped though :( may be a better implementation could help I think the right solution will NOT involve 10**12 computations. Think about it. ___

Re: [BangPypers] Implementing a fast factorial function in python

2009-09-14 Thread Sidharth Kuruvila
This should work, find f(6)**(10 raised to 7) On Mon, 14 Sep 2009 18:36:57 +0530, Shashwat Anand anand.shash...@gmail.com wrote: How do we calculate last 5-digits of 10**12 ignoring trailing zeros. The code i wrote works good until 10**8 and after that take ages. The source of problem is

Re: [BangPypers] Implementing a fast factorial function in python

2009-09-14 Thread Shashwat Anand
@abhishek : Can you show me the code ? 10**12 is way too much. My code gives output within a minute for 10**8 and fails. Ofcourse I need to apply some algo here. What do you exactly mean by taking out rightmost 7 digits ? On Mon, Sep 14, 2009 at 8:14 PM, Abhishek Mishra ideam...@gmail.com wrote:

[BangPypers] SWIG

2009-09-14 Thread bhaskar jain
Hello, I have an external library which uses SWIG to generate bindings for many languages like python, perl etc. So they have the interface (.i files) present and also a 'binding' directory and separate dirs for diff languages. So for 'Python', they have the wrapper functions (.c files) in

Re: [BangPypers] teach me SWIG

2009-09-14 Thread Carl Karsten
On Mon, Sep 14, 2009 at 1:55 PM, Gora Mohanty g...@srijan.in wrote: On Tue, 15 Sep 2009 00:04:01 +0530 bhaskar jain bhaskar.jain2...@gmail.com wrote: [...] Problem is that there was a bug and they have changed a few lines in one of the C files. So my question is - will just applying the

Re: [BangPypers] SWIG

2009-09-14 Thread bhaskar jain
Thanks for the response. What i faced was intentionally passing unexpected/nonsense data cause segmentation fault in one case. Was wondering if this is because of SWIG or because of the underlying library (which in turn uses glib). But the underlying library looks ok. Have you faced such issues