Re: Compile 32bit C-lib on 64 bit

2011-05-01 Thread Hegedüs , Ervin
Hello, thanks for all reply, On Mon, May 02, 2011 at 03:20:40AM +0100, Nobody wrote: > You need to build your module for a 32-bit version of Python. ok, I believed it, I was hoping there is another solution, > On a 64-bit system, each process is either 32-bit or 64-bit process. You > can't mix

Re: Py_INCREF() incomprehension

2011-05-01 Thread Hegedüs , Ervin
hello, Thomas, Gregory, thank you for your ansrwers, > I guess this is the point where yo should start printf programing. oh', already done :) > * What happens during module initialization? successfully initialized, > * What happens n the functions? > * Where does the stuff fail? > * What a

Re: Fibonacci series recursion error

2011-05-01 Thread Chris Angelico
On Mon, May 2, 2011 at 4:28 PM, Chris Angelico wrote: > reduce(`*,range(1,n+1)) > reduce(`*,xrange(1,n+1)) Whoops, forgot which language I was using. Back-tick functions not being available, these need to be: reduce(operator.mul,range(1,n+1)) reduce(operator.mul,xrange(1,n+1)) Chris Angelico --

Re: Fibonacci series recursion error

2011-05-01 Thread Chris Angelico
On Mon, May 2, 2011 at 3:36 PM, Hans Georg Schaathun wrote: > On Mon, 2 May 2011 06:49:41 +1000, Chris Angelico >   wrote: > :  Sure. Serialize this Python object in a way that can be given to, say, PHP: > :  foo={"asdf":"qwer","zxcv":"1234"}; foo["self"]=[1,2,3,foo] > > Wouldn't cyclic references

Re: Fibonacci series recursion error

2011-05-01 Thread Hans Georg Schaathun
On Mon, 2 May 2011 06:49:41 +1000, Chris Angelico wrote: : Sure. Serialize this Python object in a way that can be given to, say, PHP: : foo={"asdf":"qwer","zxcv":"1234"}; foo["self"]=[1,2,3,foo] : Recurse from self into the list, recurse from there into a : dictionary... Okay, that's a rath

Re: Compile 32bit C-lib on 64 bit

2011-05-01 Thread Chris Angelico
On Mon, May 2, 2011 at 2:34 PM, Dan Stromberg wrote: > Another option would be to link your library into a small, 32 bit C program, > and then establish some sort of protocol for it to communicate with your 64 > bit python interpreter - via a pipe or socket, as examples. This is what I would reco

Re: Compile 32bit C-lib on 64 bit

2011-05-01 Thread Dan Stromberg
On Sun, May 1, 2011 at 1:14 PM, Hegedüs Ervin wrote: > Hello, > > this is not a "clear" Python question - I've wrote a module in C, > which uses a 3rd-party lib - it's a closed source, I just get the > .so, .a and a header file. > > Looks like it works on 32bit (on my desktop), but it must be run

Re: Development tools and practices for Pythonistas

2011-05-01 Thread rusi
On May 2, 8:22 am, Ben Finney wrote: > rusi writes: > > You may want to look at rcs if you are in the space where you want: > > -- something better than tarballs > > -- no pretensions beyond single-user, single-machine, (almost)single- > > file usage (ie small scale) > > -- something that integra

Re: Development tools and practices for Pythonistas

2011-05-01 Thread Ben Finney
rusi writes: > You may want to look at rcs if you are in the space where you want: > -- something better than tarballs > -- no pretensions beyond single-user, single-machine, (almost)single- > file usage (ie small scale) > -- something that integrates nicely with emacs I might have agreed ten ye

Re: Development tools and practices for Pythonistas

2011-05-01 Thread rusi
On Apr 30, 8:21 am, CM wrote: > > A lone developer using such a VCS reaps the benefits of this by getting > > good merging support. > > While we're on the topic, when should a lone developer bother to start > using a VCS?  At what point in the complexity of a project (say a hobby > project, but >

Re: PIL Question

2011-05-01 Thread Terry Reedy
On 5/1/2011 9:00 PM, Chris Rebert wrote: I would think to a file named "screen_capture.jpg" in the current working directory. What that is for IDLE, I don't know. At least on windows with 3.2, if one just starts up the shell, it is in the Pythonxy directory. If one runs a file from an edit wi

Re: Development tools and practices for Pythonistas

2011-05-01 Thread Paul Rubin
>> > Look at the big two sites for open-source repositories -- github and >> > bitbucket. > Note that there are three: Launchpad (backed by Bazaar) is the other > “big site” for free-software project hosting. There is also patch-tag.com (using darcs) though it is smaller. -- http://mail.python.or

Re: Fibonacci series recursion error

2011-05-01 Thread Terry Reedy
On 5/1/2011 7:16 PM, BartC wrote: Yes, it generates lots of calls. About 22000 for fib(20), and 330 million for fib(40). Using the standard double recursion implementation of fib, ncf(n) (number of calls to fib() for fib(n)) requires ncf(n-2) + ncf(n+1) + 1 calls. The +1 is for the call to

Re: Compile 32bit C-lib on 64 bit

2011-05-01 Thread Nobody
On Sun, 01 May 2011 22:14:14 +0200, Hegedüs Ervin wrote: > When I'm compiling it on 64bit, gcc says: > > /usr/bin/ld: skipping incompatible /lib32/lib3rdpartyCrypt.so when > searching for -l3rdpartyCrypt > > There _is_ the .so in /lib32 directory: > > ELF 32-bit LSB shared object, Intel 80386,

Re: Compile 32bit C-lib on 64 bit

2011-05-01 Thread Benjamin Kaplan
On Sun, May 1, 2011 at 4:14 PM, Hegedüs Ervin wrote: > Hello, > > this is not a "clear" Python question - I've wrote a module in C, > which uses a 3rd-party lib - it's a closed source, I just get the > .so, .a and a header file. > > Looks like it works on 32bit (on my desktop), but it must be run

Re: What other languages use the same data model as Python?

2011-05-01 Thread Terry Reedy
On 5/1/2011 6:33 PM, Gregory Ewing wrote: Steven D'Aprano wrote: Python uses a data model of "name binding" and "call by object" (also known as "call by sharing"). It can be summed up in a less jargony way by saying that all data is stored in heap-allocated objects, This is incomprehensible

Re: Fibonacci series recursion error

2011-05-01 Thread Steven D'Aprano
On Sun, 01 May 2011 14:15:35 +0100, Hans Georg Schaathun wrote: > On 01 May 2011 11:56:57 GMT, Steven D'Aprano >wrote: > : Just google on "stack overflow crash". > > And I get loads of examples of stack overflows, but I could not see > anybody linking this to logically correct recursion. Wi

Re: Py_INCREF() incomprehension

2011-05-01 Thread Thomas Rachel
Am 01.05.2011 22:00, schrieb Hegedüs Ervin: My module contains just 4 functions (in C), which translate 3rd party lib to Python. The name would be _mycrypt.so example. I wrapped it a pure Python module, its name is mycrypt.py. Then, I've import pure Python module in a main program, like this:

Re: PIL Question

2011-05-01 Thread Chris Rebert
On Sun, May 1, 2011 at 1:50 PM, PyNewbie wrote: > Hi, > > I'm new with Python and PIL. I have a very simple question regarding an image > capture function I'm attempting. > > Here is the code: > > from PIL import ImageGrab ImageGrab.grab().save("screen_capture.jpg", "JPEG") > > Question

Re: Development tools and practices for Pythonistas

2011-05-01 Thread David Boddie
On Sunday 01 May 2011 18:11, Dietmar Schwertberger wrote: > Am 01.05.2011 02:47, schrieb Shawn Milochik: >> Look at the big two sites for open-source repositories -- github and >> bitbucket. One's git, the other Mercurial. I don't think you can go >> wrong picking either one. > > Can any of those

Re: Fibonacci series recursion error

2011-05-01 Thread BartC
"Steven D'Aprano" wrote in message news:4dbbb7b6$0$29991$c3e8da3$54964...@news.astraweb.com... On Sat, 30 Apr 2011 08:32:55 +0200, Peter Otten wrote: harrismh777 wrote: Ian Kelly wrote: since the fact is that if the function were properly coded, the call stack for fib(20) would never be mor

Re: Py_INCREF() incomprehension

2011-05-01 Thread Gregory Ewing
Hegedüs Ervin wrote: I've put it a Py_INCREF() after every PyModule_AddObject(), eg.: PyModule_AddObject(o, "error", cibcrypt_error_nokey); Py_INCREF(cibcrypt_error_nokey); That looks correct, because PyModule_AddObject is documented as stealing a reference to the object. By the way,

Re: What other languages use the same data model as Python?

2011-05-01 Thread Gregory Ewing
Terry Reedy wrote: While Guido does not, that I know of, credit CLU as Python's direct inspiration, I think it (and Barbara Liskov) as the originator of Python's data model. I believe she thought of the call-by-object semantics as something of an innovation. I don't think she can claim credi

Re: What other languages use the same data model as Python?

2011-05-01 Thread Gregory Ewing
Steven D'Aprano wrote: Python uses a data model of "name binding" and "call by object" (also known as "call by sharing"). It can be summed up in a less jargony way by saying that all data is stored in heap-allocated objects, and variables refer to objects rather than containing them directly.

Re: Python competitions and learnings

2011-05-01 Thread Terry Reedy
On 5/1/2011 12:49 PM, Alexander Lyabah wrote: And what do you think about Score Games and competitions? The rules of the first score game were not clear to me. I could not figure out how to play it interactively myself so I could see how it actually played. -- Terry Jan Reedy -- http://mai

Re: Fibonacci series recursion error

2011-05-01 Thread Terry Reedy
On 5/1/2011 5:27 AM, Hans Georg Schaathun wrote: Of course you do, but you are still only saying that there might be an application where this might happen because of excessive although logically correct recursion. You have not given a single example where it actually happened. I will. Stack

Re: Development tools and practices for Pythonistas

2011-05-01 Thread Ben Finney
Dietmar Schwertberger writes: > Am 01.05.2011 02:47, schrieb Shawn Milochik: > > Look at the big two sites for open-source repositories -- github and > > bitbucket. Note that there are three: Launchpad (backed by Bazaar) is the other “big site” for free-software project hosting. > Can any of th

Re: skipping one unittest assertion?

2011-05-01 Thread Ben Finney
Roy Smith writes: > Ben Finney wrote: > > > Each test case should be testing one thing: if it fails, it should be > > for exactly one reason. > > Well, yeah, that's certainly the XP/unit-test doctrine. In practice > however, tests often get written as "do a bunch of stuff to get some > result,

Re: Development tools and practices for Pythonistas

2011-05-01 Thread Jason Earl
On Sun, May 01 2011, Dietmar Schwertberger wrote: > Am 01.05.2011 02:47, schrieb Shawn Milochik: >> Look at the big two sites for open-source repositories -- github and >> bitbucket. One's git, the other Mercurial. I don't think you can go >> wrong picking either one. > > Can any of those be used

PIL Question

2011-05-01 Thread PyNewbie
Hi, I'm new with Python and PIL. I have a very simple question regarding an image capture function I'm attempting. Here is the code: >>> from PIL import ImageGrab >>> ImageGrab.grab().save("screen_capture.jpg", "JPEG") Question: I can't seem to find the captured image, where does it go? The

Re: skipping one unittest assertion?

2011-05-01 Thread Chris Angelico
On Mon, May 2, 2011 at 4:16 AM, Roy Smith wrote: >>       Can't you just comment out that line? > > Sure, but the point of @skip and @expectFailure is that they leave a > visible trail in the test output that you need to go back and fix > something. Comment it out and add a line of output manuall

Re: Fibonacci series recursion error

2011-05-01 Thread Chris Angelico
On Sun, May 1, 2011 at 11:15 PM, Hans Georg Schaathun wrote: > :  The Python virtual machine knows how big each entry on the stack needs to > :  be. (I don't, but it's got to be at least the size of a pointer.) So > :  "number of items" is just a multiplication away from "size of the items". > >

Compile 32bit C-lib on 64 bit

2011-05-01 Thread Hegedüs Ervin
Hello, this is not a "clear" Python question - I've wrote a module in C, which uses a 3rd-party lib - it's a closed source, I just get the .so, .a and a header file. Looks like it works on 32bit (on my desktop), but it must be run on 64bit servers. When I'm compiling it on 64bit, gcc says: /us

Re: Py_INCREF() incomprehension

2011-05-01 Thread Hegedüs Ervin
hello, On Wed, Apr 27, 2011 at 11:58:18AM +0200, Thomas Rachel wrote: > Am 26.04.2011 20:44, schrieb Hegedüs Ervin: > > >and (maybe) final question: :) > > > >I defined many exceptions: > > > >static PyObject *cibcrypt_error_nokey; > >static PyObject *cibcrypt_error_nofile; > >static PyObject *ci

Re: [OT] VCS for non-text (was Development tools and practices for Pythonistas)

2011-05-01 Thread Martin Schöön
On 2011-04-30, Tim Chase wrote: > On 04/30/2011 04:15 AM, Martin Schöön wrote: >> You guys are very code focused, which is natural given where we are. >> >> Having absorbed what I have seen here, looked a little at Mercurial, >> read a little on the webs of Fossil and Bazaar I start to think there

Re: What other languages use the same data model as Python?

2011-05-01 Thread Terry Reedy
On 5/1/2011 4:45 AM, Steven D'Aprano wrote: Python uses a data model of "name binding" and "call by object" (also known as "call by sharing"). I trust I don't need to define my terms, but just in case: http://effbot.org/zone/call-by-object.htm http://effbot.org/zone/python-objects.htm Now, thi

wxGrid, PyGridTableBase, strange SWIG error message!

2011-05-01 Thread Laszlo Nagy
I'm trying to create a special widget that is a wx.Grid and also a PyGridTableBase. In my special case of application, I really need to have a grid that uses itself for getting cell data and cell attributes. Here is a test program, demonstrating my problem: import wx from wx.grid import Grid,P

Re: skipping one unittest assertion?

2011-05-01 Thread Roy Smith
In article , "OKB (not okblacke)" wrote: > Roy Smith wrote: > > > Is there any way to skip a single assertion in a unittest test > > method? I know I can @skip or @expectedFailure the method, but I'm > > looking for something finer-grain than that. > > > > There's one particular assertion in

Re: skipping one unittest assertion?

2011-05-01 Thread OKB (not okblacke)
Roy Smith wrote: > Is there any way to skip a single assertion in a unittest test > method? I know I can @skip or @expectedFailure the method, but I'm > looking for something finer-grain than that. > > There's one particular assertion in a test method which depends on > production code that has

Re: Python competitions and learnings

2011-05-01 Thread Alexander Lyabah
And what do you think about Score Games and competitions? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python competitions and learnings

2011-05-01 Thread Alexander Lyabah
On May 1, 3:26 am, harrismh777 wrote: > Alexander Lyabah wrote: > > What do you think about it? > > > I'm also have a not a very good English, so I need help with it too, > > Alexander, your site is very interesting. I spent some time this > afternoon appreciating your work. Nice job. > > Be encou

Re: Development tools and practices for Pythonistas

2011-05-01 Thread Dietmar Schwertberger
Am 01.05.2011 02:47, schrieb Shawn Milochik: Look at the big two sites for open-source repositories -- github and bitbucket. One's git, the other Mercurial. I don't think you can go wrong picking either one. Can any of those be used from Python as a library, i.e. something like import Hg r = Hg

Re: Python competitions and learnings

2011-05-01 Thread Alexander Lyabah
On May 1, 12:29 am, Terry Reedy wrote: > On 4/30/2011 3:22 PM, Alexander Lyabah wrote: > > > I spend a lot of time in writing a new service checkio.org > > > It's all about python, learn python, find the best solution in > > python. > > > And Im looking for feedback from peoples who best in python

Re: Deditor

2011-05-01 Thread Kruptein
On 1 mei, 17:50, Alec Taylor wrote: > Traceback (most recent call last): >  File "O:\deditor\deditor\deditor.py", line 7, in e> >    import wx, os, datetime, sys, ConfigParser, wx.aui, wx.lib.scrolledpanel >  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", line > 4 > 5, i

Re: skipping one unittest assertion?

2011-05-01 Thread Roy Smith
In article <87wriah4qg@benfinney.id.au>, Ben Finney wrote: > Roy Smith writes: > > > There's one particular assertion in a test method which depends on > > production code that hasn't been written yet. I could factor that out > > into its own test methods and @skip that, but it would be

Re: Deditor

2011-05-01 Thread Alec Taylor
Traceback (most recent call last): File "O:\deditor\deditor\deditor.py", line 7, in import wx, os, datetime, sys, ConfigParser, wx.aui, wx.lib.scrolledpanel File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", line 4 5, in from wx._core import * File "C:\Python27\lib\s

Re: Python IDE/text-editor

2011-05-01 Thread Alec Taylor
!!! =] http://code.google.com/p/fooide Contact me if you'd like to join the project :D On Mon, May 2, 2011 at 1:39 AM, Yico Gaga wrote: >   foolDE :)!!! > > 2011/4/29 Alec Taylor >> >> Your probably right. >> >> I suppose I'll just wait till I finish my fooIDE project >> >> > On Fri, Apr 29,

Re: Python IDE/text-editor

2011-05-01 Thread Yico Gaga
foolDE :)!!! 2011/4/29 Alec Taylor > Your probably right. > > I suppose I'll just wait till I finish my fooIDE project > > > On Fri, Apr 29, 2011 at 2:21 AM, Albert van der Horst > > wrote: > >> In article , > >> Alec Taylor wrote: > >>>Geany I've tried in the past, it's really buggy on my

Re: skipping one unittest assertion?

2011-05-01 Thread Michael Kent
I agree that each test should test only one 'thing', but it's also true that testing one 'thing' sometimes/often involves multiple assertions. But in the OP's case, it does sound like the assertion he wants to skip should be broken out into its own test. -- http://mail.python.org/mailman/listi

Re: Deditor

2011-05-01 Thread Kruptein
On 1 mei, 10:59, Alec Taylor wrote: > Maybe I'm missing something, but I downloaded the zip file and ran > each .py and .pyc file in turn, but none brought up the nice deditor > GUI I've seen screenshots of... > > On the other subject, did you have a preference to what installer I > should code fo

Re: skipping one unittest assertion?

2011-05-01 Thread Ben Finney
Roy Smith writes: > There's one particular assertion in a test method which depends on > production code that hasn't been written yet. I could factor that out > into its own test methods and @skip that, but it would be cleaner to be > able to mark the particular assertion. I think that's bac

skipping one unittest assertion?

2011-05-01 Thread Roy Smith
Is there any way to skip a single assertion in a unittest test method? I know I can @skip or @expectedFailure the method, but I'm looking for something finer-grain than that. There's one particular assertion in a test method which depends on production code that hasn't been written yet. I cou

Re: Fibonacci series recursion error

2011-05-01 Thread Hans Georg Schaathun
On 01 May 2011 11:56:57 GMT, Steven D'Aprano wrote: : Just google on "stack overflow crash". And I get loads of examples of stack overflows, but I could not see anybody linking this to logically correct recursion. Wikipedia, for instance, mentions two common causes, neither of which has anyth

Re: minimal python27.dll?

2011-05-01 Thread Martin v. Loewis
> On the CJK issue, why python ship its own codec, not using OS builtin? The OS doesn't provide all the codecs that Python provides. For the one it does provide, it behaves semantically different in border cases from the ones that come with Python. > If I don't need the full Unicode5.1 can I just

Re: minimal python27.dll?

2011-05-01 Thread Martin v. Loewis
> I have vague recollections that pythonXY.dll could not be statically > linked on Windows, or that doing so causes some serious loss of > functionality. Was this ever true, and is it still? You'll have to rebuild Python to make use of static linkage, of course, but then: it is certainly possible

Re: Fibonacci series recursion error

2011-05-01 Thread Steven D'Aprano
On Sun, 01 May 2011 10:27:14 +0100, Hans Georg Schaathun wrote: > On 01 May 2011 09:04:27 GMT, Steven D'Aprano >wrote: > : Why? You might have 4000 MB of main memory, and only 2 MB (say?) of > call : stack allocated. The call stack can't grow indefinitely. If it > does, you : get a stack ov

JSONBOT 0.7 RELEASED

2011-05-01 Thread Bart Thate
0.7 RELEASE NOTES = Hello world, greetings to all and everybody on this little planet ;] Today I am releasing version 0.7 of JSONBOT, hope you like it. I want to dedicate this release to Annemiek, Kirsten, Danny and Doscha, i would not have a live without you. changes in this re

Re: Fibonacci series recursion error

2011-05-01 Thread Hans Georg Schaathun
On 01 May 2011 09:04:27 GMT, Steven D'Aprano wrote: : Why? You might have 4000 MB of main memory, and only 2 MB (say?) of call : stack allocated. The call stack can't grow indefinitely. If it does, you : get a stack overflow: Of course you do, but you are still only saying that there might

Re: Fibonacci series recursion error

2011-05-01 Thread Steven D'Aprano
On Sun, 01 May 2011 09:18:36 +0100, Hans Georg Schaathun wrote: > On Sat, 30 Apr 2011 15:40:24 +0100, Paul Rudin >wrote: > : Anytime you have enough data... there are plenty of things that are > natural to : represent as recursive data structures, and often you > don't know in : advance how

Re: What other languages use the same data model as Python?

2011-05-01 Thread Chris Rebert
On Sun, May 1, 2011 at 1:45 AM, Steven D'Aprano wrote: > Python uses a data model of "name binding" and "call by object" (also > known as "call by sharing"). > As I understand it, Python and Ruby have the same data model. > So does Java, so long as you only consider objects and ignore unboxed > n

Re: What other languages use the same data model as Python?

2011-05-01 Thread Alec Taylor
I think ruby does On Sun, May 1, 2011 at 6:45 PM, Steven D'Aprano wrote: > Python uses a data model of "name binding" and "call by object" (also > known as "call by sharing"). I trust I don't need to define my terms, but > just in case: > > http://effbot.org/zone/call-by-object.htm > http://effbo

Re: Python competitions and learnings

2011-05-01 Thread Thomas 'PointedEars' Lahn
harrismh777 wrote: > Terry Reedy wrote: >>> And Im looking for feedback from peoples who best in python. Here I >>> make some video tutorial about this service http://checkio.blip.tv/ >>> >>> What do you think about it? >> >> Pretty impressive. My main disappointment is that you are using 2.7 >>

Re: Deditor

2011-05-01 Thread Alec Taylor
Maybe I'm missing something, but I downloaded the zip file and ran each .py and .pyc file in turn, but none brought up the nice deditor GUI I've seen screenshots of... On the other subject, did you have a preference to what installer I should code for it? - InnoSetup (exe), NSIS (exe) or MSI (.msi

What other languages use the same data model as Python?

2011-05-01 Thread Steven D'Aprano
Python uses a data model of "name binding" and "call by object" (also known as "call by sharing"). I trust I don't need to define my terms, but just in case: http://effbot.org/zone/call-by-object.htm http://effbot.org/zone/python-objects.htm Now, this is different from languages like C and Pas

Re: Fibonacci series recursion error

2011-05-01 Thread Hans Georg Schaathun
On Sat, 30 Apr 2011 15:40:24 +0100, Paul Rudin wrote: : Anytime you have enough data... there are plenty of things that are natural to : represent as recursive data structures, and often you don't know in : advance how much data your code is going to have to deal with. Sure, but one would t

Getting number of hits from Google

2011-05-01 Thread neocortex
Hello! For quite some time, I am looking for a solution to the problem of getting number of hits for a list of, let say, 200-300 words, from a search engine. I would prefer Google, but this seems not possible. I tried with the PyGoogle (from http://code.google.com/p/pygoogle/), but it stops deliver