Re: ctypes and twain_32.dll

2011-05-03 Thread Patrick Vrijlandt
On 2 mei, 20:56, Michel Claveau - MVPenleverlesx_xx...@xmclavxeaux.com.invalid wrote: Hi! On my system, thera are not twain32.dll or twain_32.dll, but twain.dll @+ -- Michel Claveau Hi, I have both. They are correctly installed and working. ctypes gives a different response if it cannot

Re: Coolest Python recipe of all time

2011-05-03 Thread Terry Reedy
On 5/3/2011 1:04 AM, Stefan Behnel wrote: The bad thing about this recipe is that it requires quite a bit of background knowledge in order to infer that the code the developer is looking at is actually correct. The main math knowledge needed is the trivial fact that if a*x + b = 0, then x =

Re: Fibonacci series recursion error

2011-05-03 Thread Hans Georg Schaathun
On 03 May 2011 00:21:45 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : Python aims at acceptable performance (between 10 and 100 times slower : than C) and much easier development (between 10 and 100 times faster than : C *wink*). If that tradeoff doesn't suit you,

Re: Coolest Python recipe of all time

2011-05-03 Thread Stefan Behnel
Terry Reedy, 03.05.2011 08:00: On 5/3/2011 1:04 AM, Stefan Behnel wrote: The bad thing about this recipe is that it requires quite a bit of background knowledge in order to infer that the code the developer is looking at is actually correct. The main math knowledge needed is the trivial fact

Re: Coolest Python recipe of all time

2011-05-03 Thread Gregory Ewing
Terry Reedy wrote: The trick is that replacing x with j and evaluating therefore causes (in Python) all the coefficients of x (now j) to be added together separately from all the constant terms to reduce the linear equation to a*x+b (= 0 implied). Hmmm... so if we used quaternions, could we

Re: Py / VNC Automation

2011-05-03 Thread Rafael Durán Castañeda
You can check this https://github.com/kanaka/noVNC 2011/5/3 Dan Stromberg drsali...@gmail.com On Mon, May 2, 2011 at 5:23 PM, PyNewbie ryan.morr...@gmail.com wrote: Hi, I'm looking for a python class or open source code that is tightly integrated with VNC protocols - any ideas? --

Re: Fibonacci series recursion error

2011-05-03 Thread Hans Georg Schaathun
On Tue, 3 May 2011 07:56:26 +1000, Chris Angelico ros...@gmail.com wrote: : often recursively.  The compiler should generate code the way the CPU : thinks (most optimally), i.e. iteratively. : : The CPU can function iteratively or recursively. I should have said 'hardware' rather than CPU.

Re: Recursion or iteration (was Fibonacci series recursion error)

2011-05-03 Thread rusi
On May 3, 10:29 am, Chris Angelico ros...@gmail.com wrote: On Tue, May 3, 2011 at 3:27 PM, Dan Stromberg drsali...@gmail.com wrote: Doh. Usually when someone gives a recursive solution to this problem, it's O(logn), but not this time. Here's a logn one: :-) Ok so you beat me to it :D I

Re: raise (type, value, traceback) and raise type, value, traceback

2011-05-03 Thread Duncan Booth
Ian Kelly ian.g.ke...@gmail.com wrote: t = (type, value, traceback) raise t That it accepts the tuple and raises a value-less expression of type `type` surprises me. The docs don't say anything about this, and I would have expected a TypeError, but it appears to be extracting the first

Re: Recursion or iteration (was Fibonacci series recursion error)

2011-05-03 Thread Dave Angel
On 01/-10/-28163 02:59 PM, rusi wrote: On May 3, 10:29 am, Chris Angelicoros...@gmail.com wrote: On Tue, May 3, 2011 at 3:27 PM, Dan Strombergdrsali...@gmail.com wrote: Doh. Usually when someone gives a recursive solution to this problem, it's O(logn), but not this time. Here's a logn

Re: Installing programs that depend on, or are, python extensions.

2011-05-03 Thread James A. Donald
On Apr 30, 6:39 pm, David Cournapeau courn...@gmail.com wrote: On Sat, Apr 30, 2011 at 2:19 PM, James A. Donald jamesdnld...@gmail.com wrote: I have noticed that installingpythonprograms tends to be hell, particularly underwindows, and installingpythonprograms that rely on, or in large

Re: Recursion or iteration (was Fibonacci series recursion error)

2011-05-03 Thread rusi
On May 3, 3:32 pm, Dave Angel da...@ieee.org wrote: What I'm surprised at is that nobody has pointed out that the logn version is also generally more accurate, given traditional floats. Usually getting the answer accurate (given the constraints of finite precision intermediates) is more

Re: Recursion or iteration (was Fibonacci series recursion error)

2011-05-03 Thread Chris Angelico
On Tue, May 3, 2011 at 8:32 PM, Dave Angel da...@ieee.org wrote: What I'm surprised at is that nobody has pointed out that the logn version is also generally more accurate, given traditional floats. Usually getting the answer accurate (given the constraints of finite precision intermediates)

Re: Recursion or iteration (was Fibonacci series recursion error)

2011-05-03 Thread Steven D'Aprano
On Tue, 03 May 2011 21:04:07 +1000, Chris Angelico wrote: And that, Your Honour, is why I prefer bignums (especially for integers) to floating point. Precision rather than performance. I'm intrigued by your comment especially for integers, which implies that you might use bignums for

Re: Recursion or iteration (was Fibonacci series recursion error)

2011-05-03 Thread Chris Angelico
On Tue, May 3, 2011 at 10:49 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 03 May 2011 21:04:07 +1000, Chris Angelico wrote: And that, Your Honour, is why I prefer bignums (especially for integers) to floating point. Precision rather than performance. I'm intrigued

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

2011-05-03 Thread Hans Georg Schaathun
On 01 May 2011 08:45:51 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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: Without having the time to get my hand

Re: Installing programs that depend on, or are, python extensions.

2011-05-03 Thread Miki Tebeka
py2exe would work, but a correct installer would install Python if not present, then install the program. py2exe packs everything you need, including Python. A program created with py2exe does not depend on installed Python. -- http://mail.python.org/mailman/listinfo/python-list

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

2011-05-03 Thread Hrvoje Niksic
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: Python's data model is different from other languages which is perfectly correct, if you think of C as other languages. But it's equally correct to say that Python's data model is the same as other languages. As I understand it,

spf-records

2011-05-03 Thread Wim Feijen
Dag mannen, Afgelopen week liepen we tegen het feit op dat Google e-mails afkomstig van onze server als spam markeerde en deze zonder bericht verwijderde. Ik vroeg me af of een van jullie hier wel eens tegenop is gelopen en wil bij deze even waarschuwen dat dat dus zomaar kan gebeuren. Wat voor

Compiling Python 3.2 on Cygwin fails

2011-05-03 Thread Daniel Rentz
Hello, I've downloaded the 3.2 source tarball from python.org and tried to compile Python from scratch in a Cygwin 1.7.7 environment. Configure works as expected. Make fails with the following message: make: *** No rule to make target `libpython3.2m.dll.a', needed by `python.exe'. Stop.

Re: spf-records

2011-05-03 Thread Jayme Proni Filho
English man English. 2011/5/3 Wim Feijen w...@go2people.nl Dag mannen, Afgelopen week liepen we tegen het feit op dat Google e-mails afkomstig van onze server als spam markeerde en deze zonder bericht verwijderde. Ik vroeg me af of een van jullie hier wel eens tegenop is gelopen en wil bij

Re: Hello Friends

2011-05-03 Thread Jayme Proni Filho
This is a place about python man! Python. 2011/5/3 Ashraf Ali eagleba...@gmail.com What are you lookink for. Just visit to see what you want www.bollywoodhotactresswallpapers.blogspot.com www.bollywoodhotwallpaperz.blogspot.com www.bollywoodhotactresspicz.blogspot.com

Re: Installing programs that depend on, or are, python extensions.

2011-05-03 Thread Parikshit ..
Pyinstaller can also be used to create executables. It does not need python installed. We have been able to make executables for windows and mac as well with this. - Parikshit On Tue, May 3, 2011 at 3:54 PM, Miki Tebeka miki.teb...@gmail.com wrote: py2exe would work, but a correct installer

Re: spf-records

2011-05-03 Thread Wim Feijen
Excuse me, this message was sent to the wrong mailing list. Sorry, Wim 2011/5/3 Wim Feijen w...@go2people.nl Dag mannen, Afgelopen week liepen we tegen het feit op dat Google e-mails afkomstig van onze server als spam markeerde en deze zonder bericht verwijderde. Ik vroeg me af of een van

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

2011-05-03 Thread Grant Edwards
On 2011-05-03, Hans Georg Schaathun h...@schaathun.net wrote: On 01 May 2011 08:45:51 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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

Re: spf-records

2011-05-03 Thread Jean-Michel Pichavant
Wim Feijen wrote: Excuse me, this message was sent to the wrong mailing list. Sorry, Wim 2011/5/3 Wim Feijen w...@go2people.nl mailto:w...@go2people.nl Dag mannen, You're lucky that the native language of our Benevolent Dictator For Life is tolerated in this list. JM --

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

2011-05-03 Thread Steven D'Aprano
On Tue, 03 May 2011 13:39:24 +0100, Hans Georg Schaathun wrote: On 01 May 2011 08:45:51 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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

Re: Coolest Python recipe of all time

2011-05-03 Thread Terry Reedy
On 5/3/2011 2:29 AM, Gregory Ewing wrote: Terry Reedy wrote: The trick is that replacing x with j and evaluating therefore causes (in Python) all the coefficients of x (now j) to be added together separately from all the constant terms to reduce the linear equation to a*x+b (= 0 implied).

Re: Recursion or iteration (was Fibonacci series recursion error)

2011-05-03 Thread Dan Stromberg
On Tue, May 3, 2011 at 5:49 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 03 May 2011 21:04:07 +1000, Chris Angelico wrote: And that, Your Honour, is why I prefer bignums (especially for integers) to floating point. Precision rather than performance. I'm

Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Dun Peal
Hi! Here's the demonstrating code: # module foo.py var = 0 def set(): global var var = 1 Script using this module: import foo from foo import * print var, foo.var set() print var, foo.var Script output: 0 0 0 1 Apparently, the `var`

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

2011-05-03 Thread Mel
Hans Georg Schaathun wrote: On 01 May 2011 08:45:51 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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: Without

Re: Coolest Python recipe of all time

2011-05-03 Thread Raymond Hettinger
On May 2, 11:29 pm, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Terry Reedy wrote: The trick is that replacing x with j and evaluating therefore causes (in Python) all the coefficients of x (now j) to be added together separately from all the constant terms to reduce the linear

Re: Coolest Python recipe of all time

2011-05-03 Thread Raymond Hettinger
On May 2, 10:04 pm, Stefan Behnel stefan...@behnel.de wrote: The bad thing about this recipe is that it requires quite a bit of background knowledge in order to infer that the code the developer is looking at is actually correct. At first sight, it looks like an evil hack, and the lack of

Pickling extension types

2011-05-03 Thread Stefan Kuzminski
Hi all, I have an extension type written in C, but I cannot get it to pickle, any insights would be greatly appreciated. I see in the docs that I should define a __reduce__ method and that does get called, but I don't know specifically the type of the 'callable object' that should be the first

Re: Coolest Python recipe of all time

2011-05-03 Thread geremy condra
On Tue, May 3, 2011 at 8:49 AM, Terry Reedy tjre...@udel.edu wrote: On 5/3/2011 2:29 AM, Gregory Ewing wrote: Terry Reedy wrote: The trick is that replacing x with j and evaluating therefore causes (in Python) all the coefficients of x (now j) to be added together separately from all the

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

2011-05-03 Thread Grant Edwards
On 2011-05-03, Mel mwil...@the-wire.com wrote: To illustrate the neither-fish-nor-fowl nature of Python calls: mwilson@tecumseth:~$ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type help, copyright, credits or license for more information. def

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Daniel Kluev
On Wed, May 4, 2011 at 3:31 AM, Dun Peal dunpea...@gmail.com wrote: Apparently, the `var` we imported from `foo` never got set, but `foo.var` on the imported `foo` - did. Why? Because all names are references to some values, not other names (in CPython, it means all names are PyObject*, and

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Chris Rebert
On Tue, May 3, 2011 at 9:31 AM, Dun Peal dunpea...@gmail.com wrote: Hi! Here's the demonstrating code:    # module foo.py    var = 0    def set():        global var        var = 1 Script using this module:    import foo    from foo import *    print var, foo.var    set()    

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Mel
Dun Peal wrote: Hi! Here's the demonstrating code: # module foo.py var = 0 def set(): global var var = 1 Script using this module: import foo from foo import * print var, foo.var set() print var, foo.var Script output:

Re: Pickling extension types

2011-05-03 Thread Robert Kern
On 5/3/11 11:48 AM, Stefan Kuzminski wrote: Hi all, I have an extension type written in C, but I cannot get it to pickle, any insights would be greatly appreciated. I see in the docs that I should define a __reduce__ method and that does get called, but I don't know specifically the type of

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Terry Reedy
Your problem is reveal in the subject line. As discussed in many other threads, including a current one, Python does not have 'variables' in the way that many understand the term. Python binds names to objects. Binding statements (assignment, augmented assignment, import, def, class, and others

Re: Fibonacci series recursion error

2011-05-03 Thread harrismh777
Chris Angelico wrote: The recursion is in the last block. Note that it calls a function, then keeps going. It doesn't fork. There are two CALL_FUNCTION opcodes, called*sequentially*. In terms of the call stack, there is only ever one of those two calls active at any given time. RuntimeError:

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread harrismh777
Dun Peal wrote: # module foo.py var = 0 def set(): global var var = 1 My two cents to add in addition to the correct accounts of [ Daniel, Chris, Mel] is that you might have a misunderstanding of var, generally. Python has no variables--- in the way you

Python to accept terms and conditions of a website

2011-05-03 Thread Nicola Branzoli
Hey, I am writing a code in python to access public data online (using BeautifulSoup). The task is relatively easy but the code does not get to the page because I need to accept the terms and condition of the website first (by a standard click 'Accept' button). I need to tell python how to

Re: Pickling extension types

2011-05-03 Thread Peter Otten
Stefan Kuzminski wrote: I have an extension type written in C, but I cannot get it to pickle, any insights would be greatly appreciated. I see in the docs that I should define a __reduce__ method and that does get called, but I don't know specifically the type of the 'callable object' that

Re: Development tools and practices for Pythonistas

2011-05-03 Thread Anssi Saari
rusi rustompm...@gmail.com writes: I am a bit surprised that no one has mentioned rcs so far Not an option if you are not on a *ix system and not something I am specifically recommending. I actually use rcs in Windows. Needs a little setup, but works great, from Emacs VC-mode too. --

Re: Development tools and practices for Pythonistas

2011-05-03 Thread jacek2v
On May 2, 12:38 pm, Algis Kabaila akaba...@pcug.org.au wrote: On Monday 02 May 2011 19:09:38 jacek2v wrote: On May 2, 9:48 am, Algis Kabaila akaba...@pcug.org.au wrote: On Monday 02 May 2011 17:19:57 rusi wrote: On May 2, 12:08 pm, Algis Kabaila akaba...@pcug.org.au wrote:

Re: Development tools and practices for Pythonistas

2011-05-03 Thread rusi
On May 3, 11:19 pm, Anssi Saari a...@sci.fi wrote: rusi rustompm...@gmail.com writes: I am a bit surprised that no one has mentioned rcs so far Not an option if you are not on a *ix system and not something I am specifically recommending. I actually use rcs in Windows. Needs a little

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Dun Peal
OK, I understand now. `from foo import var` means create a module-global name `var` inside the current module, and have it point at the object `foo.var` is pointing at (following its evaluation). Naturally, regardless of whether `foo.var` ever changes, the global `var` of the current module

Re: Pushing for Pythoncard 1.0

2011-05-03 Thread rnd
On May 2, 10:48 pm, John Henry john106he...@hotmail.com wrote: Attempt to push Pythoncard to a 1.0 status is now underway.  A temporary website has been created at: http://code.google.com/p/pythoncard-1-0/ The official website continues to behttp://pythoncard.sourceforge.net/ Pythoncard is

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Dun Peal
P.S. now I have to ask: is there a symbolic reference in Python, i.e. a name foo that points to whatever bar.baz is pointing at? Thanks, D. -- http://mail.python.org/mailman/listinfo/python-list

Appending to dictionary of lists

2011-05-03 Thread Alex van der Spek
I open a csv file and create a DictReader object. Subsequently, reading lines from this file I try to update a dictionary of lists: csvf=open(os.path.join(root,fcsv),'rb') csvr=csv.DictReader(csvf) refd=dict.fromkeys(csvr.fieldnames,[]) for row in csvr: for (k,v) in row.items():

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Daniel Kluev
On Wed, May 4, 2011 at 6:23 AM, Dun Peal dunpea...@gmail.com wrote: P.S. now I have to ask: is there a symbolic reference in Python, i.e. a name foo that points to whatever bar.baz is pointing at? Well, you could easily simulate that with proxy object, class SymbolicReference(object): def

Re: Appending to dictionary of lists

2011-05-03 Thread Paul Rubin
Alex van der Spek zd...@xs4all.nl writes: refd=dict.fromkeys(csvr.fieldnames,[]) ... I do not understand why this appends v to every key k each time. You have initialized every element of refd to the same list. Try refd = dict((k,[]) for k in csvr.fieldnames) instead. --

Re: Appending to dictionary of lists

2011-05-03 Thread Dan Stromberg
On Tue, May 3, 2011 at 12:56 PM, Paul Rubin no.email@nospam.invalid wrote: Alex van der Spek zd...@xs4all.nl writes: refd=dict.fromkeys(csvr.fieldnames,[]) ... I do not understand why this appends v to every key k each time. You have initialized every element of refd to the same list.

Re: Appending to dictionary of lists

2011-05-03 Thread Alex van der Spek
Thank you! Would never have found that by myself. Paul Rubin no.email@nospam.invalid wrote in message news:7x7ha75zib@ruckus.brouhaha.com... Alex van der Spek zd...@xs4all.nl writes: refd=dict.fromkeys(csvr.fieldnames,[]) ... I do not understand why this appends v to every key k each

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

2011-05-03 Thread Hans Georg Schaathun
On Tue, 03 May 2011 12:33:15 -0400, Mel mwil...@the-wire.com wrote: : mwilson@tecumseth:~$ python : Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) : [GCC 4.4.3] on linux2 : Type help, copyright, credits or license for more information. : def identify_call (a_list): : ... a_list[0] =

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

2011-05-03 Thread Hans Georg Schaathun
On 03 May 2011 15:20:42 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : You get credit for not falling into the trap of thinking there are only : two, call by reference and call by value, but there are *many* more than : just three. Wikipedia lists at least 13: Ah.

Re: Pickling extension types

2011-05-03 Thread Stefan Kuzminski
Thanks for the clues, I made a modification so that reduce returns this.. return Py_BuildValue(O(O), Py_TYPE(self), PyTuple_New(0), Py_None, Py_None, Py_None ); and now I get this different error when trying to pickle the type..

Re: Fibonacci series recursion error

2011-05-03 Thread Chris Angelico
On Wed, May 4, 2011 at 3:10 AM, harrismh777 harrismh...@charter.net wrote: If your point is that the infinite process is the problem, I agree. But my point is that the cpu crunch and the rate at which the call stack is filled has to do with the double call (which never finds tail processing).

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Chris Angelico
On Wed, May 4, 2011 at 2:57 AM, Chris Rebert c...@rebertia.com wrote: from foo import * can be thought of as essentially doing: import foo set = foo.set var = foo.var del foo Here's a side point. What types will hold a reference to the enclosing module (or at least its dictionary)? Would

Re: Coolest Python recipe of all time

2011-05-03 Thread Chris Angelico
On Wed, May 4, 2011 at 2:43 AM, Raymond Hettinger pyt...@rcn.com wrote: We should have a separate thread for the most practical, best documented, least surprising, and most boring recipe ;-) a += b # Adds b to a in-place. Polymorphic - works on a wide variety of types. You didn't say it had

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

2011-05-03 Thread Chris Angelico
On Wed, May 4, 2011 at 6:47 AM, Hans Georg Schaathun h...@schaathun.net wrote: This looks like plain old transmission by reference to me. I.e. the functions get a reference to an object and make any change to the object. Reference being exactly what's passed around. There are now two

Re: Pickling extension types

2011-05-03 Thread Robert Kern
On 5/3/11 4:34 PM, Stefan Kuzminski wrote: Thanks for the clues, I made a modification so that reduce returns this.. return Py_BuildValue(O(O), Py_TYPE(self), PyTuple_New(0), Py_None, Py_None, Py_None ); and now I get this different error when trying to pickle the type..

vertical ordering of functions

2011-05-03 Thread Jabba Laci
Hi, I'm just reading Robert M. Martin's book entitled Clean Code. In Ch. 5 he says that a function that is called should be below a function that does the calling. This creates a nice flow down from top to bottom. However, when I write a Python script I do just the opposite. I start with the

Re: Coolest Python recipe of all time

2011-05-03 Thread Ian Kelly
On Tue, May 3, 2011 at 3:54 PM, Chris Angelico ros...@gmail.com wrote: On Wed, May 4, 2011 at 2:43 AM, Raymond Hettinger pyt...@rcn.com wrote: We should have a separate thread for the most practical, best documented, least surprising, and most boring recipe ;-) a += b   # Adds b to a

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Chris Rebert
On Tue, May 3, 2011 at 2:47 PM, Chris Angelico ros...@gmail.com wrote: On Wed, May 4, 2011 at 2:57 AM, Chris Rebert c...@rebertia.com wrote: from foo import * can be thought of as essentially doing: import foo set = foo.set var = foo.var del foo Here's a side point. What types will hold

Re: Coolest Python recipe of all time

2011-05-03 Thread Raymond Hettinger
On May 2, 11:23 pm, Stefan Behnel stefan...@behnel.de wrote: Terry Reedy, 03.05.2011 08:00: On 5/3/2011 1:04 AM, Stefan Behnel wrote: The bad thing about this recipe is that it requires quite a bit of background knowledge in order to infer that the code the developer is looking at is

Re: vertical ordering of functions

2011-05-03 Thread Chris Angelico
On Wed, May 4, 2011 at 8:08 AM, Jabba Laci jabba.l...@gmail.com wrote: Hi, I'm just reading Robert M. Martin's book entitled Clean Code. In Ch. 5 he says that a function that is called should be below a function that does the calling. This creates a nice flow down from top to bottom. I

Re: Fibonacci series recursion error

2011-05-03 Thread Ian Kelly
On Tue, May 3, 2011 at 3:41 PM, Chris Angelico ros...@gmail.com wrote: On Wed, May 4, 2011 at 3:10 AM, harrismh777 harrismh...@charter.net wrote: If your point is that the infinite process is the problem, I agree. But my point is that the cpu crunch and the rate at which the call stack is

Re: vertical ordering of functions

2011-05-03 Thread MRAB
On 03/05/2011 23:31, Chris Angelico wrote: On Wed, May 4, 2011 at 8:08 AM, Jabba Lacijabba.l...@gmail.com wrote: Hi, I'm just reading Robert M. Martin's book entitled Clean Code. In Ch. 5 he says that a function that is called should be below a function that does the calling. This creates a

Re: Fibonacci series recursion error

2011-05-03 Thread Chris Angelico
On Wed, May 4, 2011 at 8:31 AM, Ian Kelly ian.g.ke...@gmail.com wrote: A back-of-the-envelope calculation shows that with modern technology it would take more than 10 ** 257 years to complete. Then I propose that Python be extended to allow for underlying hardware upgrades without terminating

Re: Coolest Python recipe of all time

2011-05-03 Thread Algis Kabaila
On Tuesday 03 May 2011 16:00:05 Terry Reedy wrote: On 5/3/2011 1:04 AM, Stefan Behnel wrote: The bad thing about this recipe is that it requires quite a bit of background knowledge in order to infer that the code the developer is looking at is actually correct. The main math knowledge

Re: vertical ordering of functions

2011-05-03 Thread Ben Finney
Jabba Laci jabba.l...@gmail.com writes: Is there a convention for this? Should main() be at the top and called function below? No, it's Python convention for both of those to be at the end of the module. I follow the convention described by Guido van Rossum in

Re: vertical ordering of functions

2011-05-03 Thread Robert Kern
On 5/3/11 5:46 PM, MRAB wrote: On 03/05/2011 23:31, Chris Angelico wrote: On Wed, May 4, 2011 at 8:08 AM, Jabba Lacijabba.l...@gmail.com wrote: Hi, I'm just reading Robert M. Martin's book entitled Clean Code. In Ch. 5 he says that a function that is called should be below a function that

Re: vertical ordering of functions

2011-05-03 Thread Roy Smith
In article mailman.1127.1304460530.9059.python-l...@python.org, Jabba Laci jabba.l...@gmail.com wrote: I'm just reading Robert M. Martin's book entitled Clean Code. In Ch. 5 he says that a function that is called should be below a function that does the calling. This creates a nice flow down

Re: vertical ordering of functions

2011-05-03 Thread John Bokma
Ben Finney ben+pyt...@benfinney.id.au writes: Jabba Laci jabba.l...@gmail.com writes: Is there a convention for this? Should main() be at the top and called function below? No, it's Python convention for both of those to be at the end of the module. I follow the convention described by

Running and killing a process in python

2011-05-03 Thread Astan Chee
Hi, I'm trying to make a python script (in windows 7 x64 using python 2.5) to start a process, and kill it after x minutes/seconds and kill all the descendants of it. Whats the best way of doing this in python? which module is best suited to do this? subprocess? thanks for any help --

importing class objects from a pickled file

2011-05-03 Thread Catherine Moroney
Hello, I have an object of class X that I am writing to a pickled file. The pickling part goes fine, but I am having some problems reading the object back out, as I get complaints about unable to import module X. The only way I have found around it is to run the read-file code out of the

Re: vertical ordering of functions

2011-05-03 Thread Grant Edwards
On 2011-05-03, Jabba Laci jabba.l...@gmail.com wrote: I'm just reading Robert M. Martin's book entitled Clean Code. In Ch. 5 he says that a function that is called should be below a function that does the calling. This creates a nice flow down from top to bottom. I generally expect the

Re: Pickling extension types

2011-05-03 Thread Stefan Kuzminski
closer I think 1) I changed tp_name to be 'observation.MV' ( module is named observation.c ) and now I get a new error.. PicklingError: Can't pickle type 'observation.MV': import of module observation failed 2) here is the init function, sorry I did not include it in the original listing void

Re: importing class objects from a pickled file

2011-05-03 Thread James Mills
On Wed, May 4, 2011 at 10:18 AM, Catherine Moroney catherine.m.moro...@jpl.nasa.gov wrote: Am I explaining myself properly?  Why doesn't the code that loads the object from the pickled file work unless I am sitting in the same directory?   The code that writes the pickled file has the statement

Re: Running and killing a process in python

2011-05-03 Thread James Mills
On Wed, May 4, 2011 at 10:45 AM, Astan Chee astan.c...@gmail.com wrote: Hi, I'm trying to make a python script (in windows 7 x64 using python 2.5) to start a process, and kill it after x minutes/seconds and kill all the descendants of it. Whats the best way of doing this in python? which

Re: importing class objects from a pickled file

2011-05-03 Thread Owen Jacobson
On 2011-05-03 20:18:33 -0400, Catherine Moroney said: Hello, I have an object of class X that I am writing to a pickled file. The pickling part goes fine, but I am having some problems reading the object back out, as I get complaints about unable to import module X. The only way I have

[issue11984] Wrong See also in symbol and token module docs

2011-05-03 Thread Davi Post
New submission from Davi Post p...@pobox.com: The See also reference in the documentation for the token and symbol modules is no longer accurate. The second example mentioned was apparently removed in Python 2.7. This leaves no explanation for how to use the symbol module. I don't think this

[issue9516] sysconfig: $MACOSX_DEPLOYMENT_TARGET mismatch: now 10.3 but 10.5 during configure

2011-05-03 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: This issue is very annoying when you use python's with different deployment targets and should IMHO be fixed in the next release. -- nosy: +benjamin.peterson, georg.brandl priority: normal - release blocker

[issue11866] race condition in threading._newname()

2011-05-03 Thread Peter Saveliev
Peter Saveliev svinota.savel...@gmail.com added the comment: Ok, patch attached. Patch made for Python: 2.6 Tested Python versions: 2.6, 2.7 -- keywords: +patch versions: +Python 2.6 Added file: http://bugs.python.org/file21866/newname_race_fix.patch

[issue10169] socket.sendto raises incorrect exception when passed incorrect types

2011-05-03 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: The original code was trying to call PyArg_ParseTuple assuming 2 args and in case of failure (*any* failure) was starting over assuming 3 args. The attached patch makes PyArg_ParseTuple accept 2 or 3 args and re-arranges the last two if

[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2011-05-03 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Actually, it came to me that if a child process exists, the queues are not guaranteed to be a consistent state anymore (the child could have terminated in the middle of a partial read or write). So it may be better to simply declare the

[issue10169] socket.sendto raises incorrect exception when passed incorrect types

2011-05-03 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: Added tests and fixed all the problems they found. -- keywords: +needs review stage: patch review - commit review Added file: http://bugs.python.org/file21868/issue10169-2.diff ___ Python tracker

[issue11849] glibc allocator doesn't release all free()ed memory

2011-05-03 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Patch looks fine to me, thank you. -- stage: - patch review versions: -Python 2.7, Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11849

[issue10044] small int optimization

2011-05-03 Thread Steffen Daode Nurpmeso
Steffen Daode Nurpmeso sdao...@googlemail.com added the comment: Now me. (http://gcc.gnu.org/onlinedocs/gcc/Arrays-and-pointers-implementation.html#Arrays-and-pointers-implementation) When casting from pointer to integer and back again, the resulting pointer must reference the same object as

[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2011-05-03 Thread Brian Quinlan
Brian Quinlan br...@sweetapp.com added the comment: Under what circumstances do we expect a ProcessPoolExecutor child process to be killed outside of the control of the ProcessPoolExecutor? If the user kills a child then maybe all we want to do is raise an exception rather than deadlock as a

[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2011-05-03 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Under what circumstances do we expect a ProcessPoolExecutor child process to be killed outside of the control of the ProcessPoolExecutor? Killed by the user, or by an automatic device (such as the Linux OOM killer), or crashed. If the user

[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2011-05-03 Thread Brian Quinlan
Brian Quinlan br...@sweetapp.com added the comment: Killed by the user, or by an automatic device (such as the Linux OOM killer), or crashed. Crashed would be bad - it would indicate a bug in the ProcessPoolExecutor code. If the user kills a child then maybe all we want to do is raise an

[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2011-05-03 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Killed by the user, or by an automatic device (such as the Linux OOM killer), or crashed. Crashed would be bad - it would indicate a bug in the ProcessPoolExecutor code. I meant a crash in Python itself, or any third-party extension

[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-03 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset d003ce770ba1 by Victor Stinner in branch 'default': Issue #8407: Fix pthread_sigmask() tests on Mac OS X http://hg.python.org/cpython/rev/d003ce770ba1 -- ___ Python tracker

[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-03 Thread Steffen Daode Nurpmeso
Steffen Daode Nurpmeso sdao...@googlemail.com added the comment: Should we fix Python 2.7? - backport issue #8651 - use PY_SSIZE_T_CLEAN in zlibmodule.c I really thought about this over night. I'm a C programmer and thus: - Produce no bugs - If you've produced a bug, fix it at once - If

[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-03 Thread Steffen Daode Nurpmeso
Changes by Steffen Daode Nurpmeso sdao...@googlemail.com: Removed file: http://bugs.python.org/file21855/11277-27.1.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11277 ___

[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-03 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 618c3e971e80 by Victor Stinner in branch '2.7': (Merge 3.1) Issue #11277: mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X http://hg.python.org/cpython/rev/618c3e971e80 -- ___ Python

  1   2   >