Python vs. C++11

2012-02-12 Thread sturlamolden
There are bigsimilarities between Python and the new C++ standard. Now we can actually use our experience as Python programmers to write fantastic C++ :-) Here is a small list of similarities to consider: Iterate over any container, like Python's for loop: for (type item: container) Pointer

Re: Python vs. C++11

2012-02-12 Thread sturlamolden
On Feb 13, 4:21 am, sturlamolden sturlamol...@yahoo.no wrote: There are bigsimilarities between Python and the new C++ standard. Now we can actually use our experience as Python programmers to write fantastic C++ :-) And of course the keyword 'auto', which means automatic type interence

Re: Data Plotting Library Dislin 10.2

2011-11-18 Thread sturlamolden
On 18 Nov, 22:16, Tony the Tiger t...@tiger.invalid wrote: Ya, but apparently no source unless you dig deep into your pockets. Really, why would we need this when we already have gnuplot? Just wondering... Dislin is a very nice plotting library for scientific data, particularly for scientists

Re: Complex sort on big files

2011-08-06 Thread sturlamolden
On Aug 1, 5:33 pm, aliman aliman...@googlemail.com wrote: I've read the recipe at [1] and understand that the way to sort a large file is to break it into chunks, sort each chunk and write sorted chunks to disk, then use heapq.merge to combine the chunks as you read them. Or just memory map

Re: Complex sort on big files

2011-08-05 Thread sturlamolden
On Aug 1, 5:33 pm, aliman aliman...@googlemail.com wrote: I understand that sorts are stable, so I could just repeat the whole sort process once for each key in turn, but that would involve going to and from disk once for each step in the sort, and I'm wondering if there is a better way. I

Re: I am fed up with Python GUI toolkits...

2011-07-22 Thread sturlamolden
On 22 Jul, 02:34, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: I think that's a bit of an exaggeration -- there's only one major dependency on each platform, and it's a very widely used one (currently PyObjC/PyGTK/PyWin32). And I'm thinking about ways to reduce the dependencies further,

Re: I am fed up with Python GUI toolkits...

2011-07-22 Thread sturlamolden
On 21 Jul, 16:52, Kevin Walzer k...@codebykevin.com wrote: I bet that other scripting languages would piggyback on top of it (Lua or Ruby bindings for Python's GUI toolkit, anyone?) because doing that is less work than writing your own toolkit from scratch. No doubt about that. Lua has a

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread sturlamolden
On 20 Jul, 11:59, Thomas Jollans t...@jollybox.de wrote: I wonder - what do you think of GTK+? PyGTK with GLADE is the easier to use, but a bit awkward looking on Windows and Mac. (Not to mention the number of dependencies that must be installed, inclusing a GTK runtime.) Really, while Swing

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread sturlamolden
On 20 Jul, 11:59, Thomas Jollans t...@jollybox.de wrote: Okay, I haven't used SWT yet: manual memory management? Java is GC! It is perfectly reasonable to be required to manually call some sort of destroy() method to tell the toolkit what you no longer want the user to see: firstly, you have

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread sturlamolden
On 20 Jul, 16:17, Mel mwil...@the-wire.com wrote: OTOH, if you intend to re-use the Dialog object, it's not a memory leak. It cannot be reused if you don't have any references pointing to it. Sure it is nice to have dialogs that can be hidden and re-displayed, but only those that can be

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread sturlamolden
On 20 Jul, 13:04, Adam Tauno Williams awill...@whitemice.org wrote: 3. Instances of extension types can clean themselves up on deallocation. No parent-child ownership model to mess things up. No manual clean-up. Python does all the reference counting we need. NEVER GOING TO HAPPEN.  UI's

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread sturlamolden
On 20 Jul, 13:08, Tim Chase python.l...@tim.thechases.com wrote: http://xkcd.com/927/ :-) Indeed. -- http://mail.python.org/mailman/listinfo/python-list

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread sturlamolden
On 20 Jul, 17:21, Thomas Jollans t...@jollybox.de wrote: Don't know about Mac, I was under the impression that GTK was fine on Windows these days. GTK looks awful on Windows, requires a dozen of installers (non of which comes from a single source), is not properly stabile (nobody cares?), and

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread sturlamolden
On 20 Jul, 06:28, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: Have you tried Tkinter version 8.0 or better, which offers a native look and feel? Python 2.7.2 |EPD 7.1-1 (64-bit)| (default, Jul 3 2011, 15:34:33) [MSC v.1500 64 bit (AMD64)] on win32 Type packages, demo or

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread sturlamolden
On 20 Jul, 22:58, Phlip phlip2...@gmail.com wrote: Tkinter sucks because it looks like an enfeebled Motif 1980s dawn-of- GUIs scratchy window with grooves and lines everywhere. The widget set is limited compared to GTK or Qt, though it has the most common GUI controls, and it does not look

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread sturlamolden
On 20 Jul, 22:58, Phlip phlip2...@gmail.com wrote: Tkinter sucks because it looks like an enfeebled Motif 1980s dawn-of- GUIs scratchy window with grooves and lines everywhere. And using it with OpenGL has been impossible since Python 2.2 (or whatever). --

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread sturlamolden
On 21 Jul, 00:52, Phlip phlip2...@gmail.com wrote: Oh, and you can TDD it, too... No, I can't TDD with Tkinter. All my tests fail when there is no OpenGL support (Togl is gone). For TDD to work, the tests must have a chance of passing. -- http://mail.python.org/mailman/listinfo/python-list

I am fed up with Python GUI toolkits...

2011-07-19 Thread sturlamolden
What is wrong with them: 1. Designed for other languages, particularly C++, tcl and Java. 2. Bloatware. Qt and wxWidgets are C++ application frameworks. (Python has a standard library!) 3. Unpythonic memory management: Python references to deleted C++ objects (PyQt). Manual dialog destruction

Re: subprocess isql

2011-07-15 Thread sturlamolden
On 15 Jul, 04:47, peterff66 peterf...@yahoo.com wrote: I am working on a project that retrieves data from remote Sybase. I have to use isql and subprocess to do this. Is the following correct? I once had to hammer a nail, but I had to use a screw driver. Didn't work. Did anybody do

Re: What is the difference between PyPy and Python? are there lot of differences?

2011-07-13 Thread sturlamolden
On 13 Jul, 16:06, ArrC justmailnav...@gmail.com wrote: And they also talked about the lack of type check in python. So, how does it help (strongly typed) in debugging? Python is strongly typed. There are no static type checks in Python. Type checks are done at runtime. Dynamic typing does

Re: Python bug? Indexing to matrices

2011-07-12 Thread sturlamolden
On 12 Jul, 07:39, David davidb...@gmail.com wrote: Should the following line work for defining a matrix with zeros? c= [[0]*col]*row No. The rows will be aliased. This will work: c = [[0]*col for i in range(row)] Note that Python lists are not ment to be used as matrices. We have NumPy or

Re: Python bug? Indexing to matrices

2011-07-12 Thread sturlamolden
On 12 Jul, 14:59, sturlamolden sturlamol...@yahoo.no wrote:    ma = np.matrix(a)    mb = np.matrix(b)    a*b ma*mb Sorry for the typo. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to write a file generator

2011-07-12 Thread sturlamolden
On 12 Jul, 16:46, Billy Mays no...@nohow.com wrote: I know the problem lies with the StopIteration, but I'm not sure how to tell the caller that there are no more lines for now. Try 'yield None' instead of 'raise StopIteration'. Sturla -- http://mail.python.org/mailman/listinfo/python-list

Re: Wgy isn't there a good RAD Gui tool fo python

2011-07-11 Thread sturlamolden
On 11 Jul, 02:43, Adam Tauno Williams awill...@whitemice.org wrote: Because RAD tools are for GUI toolkits, not for languages. If you're using GTK, Glade works fine. Same with QT and QTDesigner. If you're using WPF with IronPython, t These [Glade, etc...] are *NOT* RAD tools.  They are GUI

Re: Wgy isn't there a good RAD Gui tool fo python

2011-07-11 Thread sturlamolden
On 11 Jul, 00:50, Ivan Kljaic iklj...@gmail.com wrote: Ok Guys. I know that most of us have been expiriencing the need for a nice Gui builder tool for RAD and most of us have been googling for it a lot of times. But seriously. Why is the not even one single RAD tool for Python. I mean what

Re: Wgy isn't there a good RAD Gui tool fo python

2011-07-11 Thread sturlamolden
On 11 Jul, 14:39, Ben Finney ben+pyt...@benfinney.id.au wrote: The Unix model is: a collection of general-purpose, customisable tools, with clear standard interfaces that work together well, and are easily replaceable without losing the benefit of all the others. This is opposed to the

Re: Wgy isn't there a good RAD Gui tool fo python

2011-07-11 Thread sturlamolden
On 11 Jul, 16:10, Thorsten Kampe thors...@thorstenkampe.de wrote: And as soon as developers start developing for Unix customers (say Komodo, for instance), they start following the Windows model - as you call it. You are probably aware that Unix and Unix customers have been around since the

Re: Wgy isn't there a good RAD Gui tool fo python

2011-07-11 Thread sturlamolden
On 11 Jul, 20:28, Ivan Kljaic iklj...@gmail.com wrote: To summarize it. It would be very helpfull for python to spread if there qould be one single good rad gui builder similar to vs or netbeAns but for python. So right now if i need to make a gui app i need to work with an applicatio that is

Re: Wgy isn't there a good RAD Gui tool fo python

2011-07-11 Thread sturlamolden
On 11 Jul, 21:58, sturlamolden sturlamol...@yahoo.no wrote: That's eight. Sorry, nine ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Wgy isn't there a good RAD Gui tool fo python

2011-07-11 Thread sturlamolden
On 11 Jul, 20:28, Ivan Kljaic iklj...@gmail.com wrote: The ony worthly ones mentioning as an gui builder are boa constructor fo wx, qtDesigner with the famous licence problems why companies do not want to work with it, sharpdevelop for ironpython and netbeans for jython. There is

Re: Wgy isn't there a good RAD Gui tool fo python

2011-07-11 Thread sturlamolden
On 11 Jul, 21:58, sturlamolden sturlamol...@yahoo.no wrote: http://wxformbuilder.org/ This Demo is using C++, it works the same with Python (wxPython code is generated similarly). http://zamestnanci.fai.utb.cz/~bliznak/screencast/wxfbtut1/wxFBTut1_controller.swf Sturla -- http

Re: Wgy isn't there a good RAD Gui tool fo python

2011-07-11 Thread sturlamolden
On 11 Jul, 22:35, Kevin Walzer k...@codebykevin.com wrote: One reason there hasn't been much demand for a GUI builder is that, in many cases, it's just as simpler or simpler to code a GUI by hand. Often a GUI builder is used as a bad replacement for sketch-pad and pencil. With layout managers

Re: perceptron feed forward neural networks in python

2011-07-11 Thread sturlamolden
On 11 Jul, 20:47, Ken Watford kwatford+pyt...@gmail.com wrote: On Mon, Jul 11, 2011 at 2:31 PM, Igor Begić igor.be...@gmail.com wrote: Hi, I,m new to Python and i want to study and write programs about perceptron feed forward neural networks in python. Does anyone have a good book or link

Re: Wgy isn't there a good RAD Gui tool fo python

2011-07-11 Thread sturlamolden
On 12 Jul, 01:33, Dave Cook davec...@nowhere.net wrote: I prefer spec-generators (almost all generate XML these days) like QtDesigner to code-generators like Boa. I've only seen one good argument for code generation, and that's to generate code for a layout to see how it's done. But code

Re: Wgy isn't there a good RAD Gui tool fo python

2011-07-11 Thread sturlamolden
On 12 Jul, 01:33, Dave Cook davec...@nowhere.net wrote: I prefer spec-generators (almost all generate XML these days) like QtDesigner to code-generators like Boa. I've only seen one good argument for code generation, and that's to generate code for a layout to see how it's done.  But code

Re: Python's super() considered super!

2011-05-27 Thread sturlamolden
On 26 Mai, 18:31, Raymond Hettinger pyt...@rcn.com wrote: I just posted a tutorial and how-to guide for making effective use of super(). One of the reviewers, David Beazley, said, Wow,  that's really great!    I see this becoming the definitive post on the subject The direct link is:  

Re: Python's super() considered super!

2011-05-27 Thread sturlamolden
On 27 Mai, 16:27, sturlamolden sturlamol...@yahoo.no wrote: Assuming that 'self' will always be named 'self' in my code, I tend to patch __builtins__.super like this: import sys def super():     self = sys._getframe().f_back.f_locals['self']     return __builtins__.super(type(self),self

Re: Python's super() considered super!

2011-05-27 Thread sturlamolden
On 27 Mai, 17:05, Duncan Booth duncan.bo...@invalid.invalid wrote: class C(B): pass C().foo() ... infinite recursion follows ... That's true :( -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's super() considered super!

2011-05-27 Thread sturlamolden
On 27 Mai, 17:05, Duncan Booth duncan.bo...@invalid.invalid wrote: Oops. There's a reason why Python 2 requires you to be explicit about the class; you simply cannot work it out automatically at run time. Python 3 fixes this by working it out at compile time, but for Python 2 there is no way

Re: Python's super() considered super!

2011-05-27 Thread sturlamolden
On 27 Mai, 23:49, Stefan Behnel stefan...@behnel.de wrote: I think Sturla is referring to the compile time bit. CPython cannot know that the builtin super() will be called at runtime, even if it sees a super() function call. Yes. And opposite: CPython cannot know that builtin super() is not

Re: Python's super() considered super!

2011-05-27 Thread sturlamolden
On 27 Mai, 18:06, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: Why? The fault is not that super is a function, or that you monkey- patched it, or that you used a private function to do that monkey- patching. The fault was that you made a common, but silly, mistake when

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

2011-05-04 Thread sturlamolden
On May 3, 3:50 pm, Hrvoje Niksic hnik...@xemacs.org wrote: I would say that, considering currently most popular languages and platforms, Python's data model is in the majority.  It is only the people coming from a C++ background that tend to be confused by it. In C++, one will ususally put

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

2011-05-04 Thread sturlamolden
On May 3, 6:33 pm, Mel mwil...@the-wire.com wrote: def identify_call (a_list): a_list[0] = If you can see this, you don't have call-by-value a_list = [If you can see this, you have call-by-reference] The first one is a mistake. If it were pass-by-value, it would assign the string to a

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

2011-05-04 Thread sturlamolden
On May 4, 5:40 pm, Michael Torrie torr...@gmail.com wrote: Which is exactly what the code showed.  The first one isn't a mistake. You just read it wrong. No, I read call-by-value but it does not make a copy. Call-by-value dictates a deep copy or copy-on-write. Python does neither. Python pass

Re: Hooking into Python's memory management

2011-05-04 Thread sturlamolden
On May 4, 6:51 pm, Daniel Neilson ddneil...@gmail.com wrote:   In either case, if such a module is possible, any pointers you could provide regarding how to implement such a module would be appreciated. The gc module will hook into the garbage collector. The del statement will remove an

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

2011-05-04 Thread sturlamolden
On May 4, 7:15 pm, Benjamin Kaplan benjamin.kap...@case.edu wrote: You missed a word in the sentence. If you can see this, you DON'T have call-by-value Indeed I did, sorry! Then we agree :) Sturla -- http://mail.python.org/mailman/listinfo/python-list

Re: Vectors

2011-04-23 Thread sturlamolden
On Apr 23, 2:26 pm, Algis Kabaila akaba...@pcug.org.au wrote: I do understand that many people prefer Win32 and appreciate their right to use what they want.  I just am at a loss to understand *why* ... For the same reason some people prefered OS/2 or DEC to SunOS or BSD. For the same reason

Re: About threads in python

2011-04-22 Thread sturlamolden
On Apr 21, 3:19 pm, dutche dut...@gmail.com wrote: My question is about the efficiency of threads in python, does anybody has something to share? Never mind all the FUD about the GIL. Most of it is ill-informed and plain wrong. The GIL prevents you from doing one thing, which is parallel

Re: Vectors

2011-04-22 Thread sturlamolden
On Apr 20, 9:47 am, Algis Kabaila akaba...@pcug.org.au wrote: Are there any modules for vector algebra (three dimensional vectors, vector addition, subtraction, multiplication [scalar and vector]. Could you give me a reference to such module? NumPy Or one of these libraries (ctypes or

Re: Vectors

2011-04-22 Thread sturlamolden
On Apr 23, 2:32 am, Algis Kabaila akaba...@pcug.org.au wrote: Thanks for that.  Last time I looked at numpy (for Python3) it was available in source only.  I know, real men do compile, but I am an old man...  I will compile if it is unavoidable, but in case of numpy it does not seem  a simple

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 15, 6:33 pm, Chris H chris.humph...@windsorcircle.com wrote: 1. Are you sure you want to use python because threading is not good due to the Global Lock (GIL)?  Is this really an issue for multi-threaded web services as seems to be indicated by the articles from a Google search?  If

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 16, 4:59 am, David Cournapeau courn...@gmail.com wrote: My experience is that if you are CPU bound, asynchronous programming in python can be  more a curse than a blessing, mostly because the need to insert scheduling points at the right points to avoid blocking and because profiling

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 17, 12:10 am, Michael Torrie torr...@gmail.com wrote: Many GUI toolkits are single-threaded.  And in fact with GTK and MFC you can't (or shouldn't) call GUI calls from a thread other than the main GUI thread. Most of them (if not all?) have a single GUI thread, and a mechanism by which

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 15, 6:33 pm, Chris H chris.humph...@windsorcircle.com wrote: 1. Are you sure you want to use python because threading is not good due to the Global Lock (GIL)?  Is this really an issue for multi-threaded web services as seems to be indicated by the articles from a Google search?  If

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 17, 5:15 pm, Ian hobso...@gmail.com wrote: 5) Even in CPython, I/O-bound processes are not slowed significantly by the GIL.  It's really CPU-bound processes that are. Its ONLY when you have two or more CPU bound threads that you may have issues. And when you have a CPU bound

Re: An unusual question...

2011-04-17 Thread sturlamolden
On Apr 17, 2:15 pm, wisecrac...@tesco.net wrote: I can also find out where it is EXACTLY just as easily so this is not my problem. The problem is calling it! You'll need to mmap or valloc a page-alligned memory buffer (for which the size must be a multiple of the system page size), and call

Re: An unusual question...

2011-04-17 Thread sturlamolden
On Apr 17, 7:25 pm, Chris Angelico ros...@gmail.com wrote: It sounds to me like you're trying to pull off a classic buffer overrun and remote code execution exploit, in someone else's Python program. And all I have to say is Good luck to you. He might. But this also has reputable use,

Re: Free software versus software idea patents (was: Python benefits over Cobra)

2011-04-12 Thread sturlamolden
On 7 apr, 09:39, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: It's astonishing how anti-Mono FUD just won't die. (Something can be true, and still FUD. Oh no, people might *choke* on a peanut, or have an allergic reaction, we must label every piece of food May Contain Nuts

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-11 Thread sturlamolden
On 11 apr, 09:21, John Nagle na...@animats.com wrote:      Because nobody can fix the Global Interpreter Lock problem in CPython.      The multiprocessing module is a hack to get around the fact that Python threads don't run concurrently, and thus, threaded programs don't effectively use

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-11 Thread sturlamolden
On 11 apr, 21:11, sturlamolden sturlamol...@yahoo.no wrote: import numpy as np import sharedmem as sm private_array = np.zeros((10,10)) shared_array  = sm.zeros((10,10)) I am also using this to implement synchronization primitives (barrier, lock, semaphore, event) that can be sent over

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-10 Thread sturlamolden
On 9 apr, 22:18, John Ladasky lada...@my-deja.com wrote: So, there are limited advantages to trying to parallelize the evaluation of ONE cascade network's weights against ONE input vector. However, evaluating several copies of one cascade network's output, against several different test

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-10 Thread sturlamolden
On 10 apr, 18:27, John Nagle na...@animats.com wrote:     Unless you have a performance problem, don't bother with shared memory.     If you have a performance problem, Python is probably the wrong tool for the job anyway. Then why does Python have a multiprocessing module? In my opinion,

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-10 Thread sturlamolden
On 8 apr, 03:10, sturlamolden sturlamol...@yahoo.no wrote: That was easy, 64-bit support for Windows is done :-) Now I'll just have to fix the Linux code, and figure out what to do with os._exit preventing clean-up on exit... :-( Now it feel dumb, it's not worse than monkey patching os._exit

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-09 Thread sturlamolden
On 9 apr, 09:36, John Ladasky lada...@my-deja.com wrote: Thanks for finding my discussion!  Yes, it's about passing numpy arrays to multiple processors.  I'll accomplish that any way that I can. My preferred ways of doing this are: 1. Most cases for parallel processing are covered by

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-07 Thread sturlamolden
On 5 apr, 02:05, Robert Kern robert.k...@gmail.com wrote: PicklingError: Can't pickle class 'multiprocessing.sharedctypes.c_double_Array_10': attribute lookup multiprocessing.sharedctypes.c_double_Array_10 failed Hehe :D That is why programmers should not mess with code they don't

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-07 Thread sturlamolden
On 4 apr, 22:20, John Ladasky lada...@my-deja.com wrote: https://bitbucket.org/cleemesser/numpy-sharedmem/src/3fa526d11578/shm... I've added a few lines to this code which allows subclassing the shared memory array, which I need (because my neural net objects are more than just the array,

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-07 Thread sturlamolden
On 8 apr, 02:03, sturlamolden sturlamol...@yahoo.no wrote: http://folk.uio.no/sturlamo/python/sharedmem-feb13-2009.zip Known issues/bugs: 64-bit support is lacking, and os._exit in multiprocessing causes a memory leak on Linux. I should probably fix it for 64-bit now. Just recompiliong

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-07 Thread sturlamolden
On 8 apr, 02:38, sturlamolden sturlamol...@yahoo.no wrote: I should probably fix it for 64-bit now. Just recompiliong with 64-bit integers will not work, because I intentionally hardcoded the higher 32 bits to 0. That was easy, 64-bit support for Windows is done :-) Now I'll just have to fix

Re: Extending dict (dict's) to allow for multidimensional dictionary

2011-03-07 Thread sturlamolden
On 7 Mar, 09:30, Chris Rebert c...@rebertia.com wrote: You see a tree, I see a database (http://docs.python.org/library/sqlite3.html): +--+-+-+---+ | Manufacturer | Model   | MPG | Price | +--+-+-+---+ | Ford         | Taurus  | ...

Re: Python fails on math

2011-02-22 Thread sturlamolden
On 22 Feb, 14:20, christian schulze xcr...@googlemail.com wrote: Hey guys, I just found out, how much Python fails on simple math. I checked a simple equation for a friend. Python does not fail. Floating point arithmetics and numerical approximations will do this. If you need symbolic maths,

Re: logging module -- better timestamp accuracy on Windows

2011-02-16 Thread sturlamolden
On 16 Feb, 15:30, benhoyt benh...@gmail.com wrote: It seems to me that the logging module should use a millisecond-accurate timestamp (time.clock) on Windows, just like the timeit module does. AFAIK, the Windows performance counter has long-term accuracy issues, so neither is perfect.

Re: Non-linear regression help in Python

2011-02-15 Thread sturlamolden
On 15 Feb, 05:24, Akand Islam sohel...@gmail.com wrote: Dear Sturlamolden, Thanks for reply. I will follow-up if I need further assistance. -- Akand You should rather use the SciPy user mailing list than comp.lang.python for this. Sturla -- http://mail.python.org/mailman/listinfo/python

Re: EPD 7.0 released

2011-02-14 Thread sturlamolden
On 14 Feb, 01:50, Robert Kern robert.k...@gmail.com wrote: I'd just like to jump in here to clear up this last statement as an Enthought employee. While Enthought and its employees do contribute to the development of numpy and scipy in various ways (and paying us money is a great way to let

Re: EPD 7.0 released

2011-02-14 Thread sturlamolden
On 14 Feb, 13:35, Colin J. Williams cjwilliam...@gmail.com wrote: The purchase price for what, until now, has been open source and free seems high. The price is not high compared to other tools scientists are using, e.g. Matlab and S-PLUS. If you consider to buy an MKL license from Intel only

Re: Non-linear regression help in Python

2011-02-14 Thread sturlamolden
On 14 Feb, 22:02, Akand Islam sohel...@gmail.com wrote: Hello all, I want to do non-linear regression by fitting the model (let say, y = a1*x+b1*x**2+c1*x**3/exp(d1*x**4)) where the parameter (say c1) must be in between (0 to 1), and others can be of any values. How can I perform my job in

Re: EPD 7.0 released

2011-02-13 Thread sturlamolden
EPD is great, at least for scientific users. There is just one installer, with everything we need, instead of struggling with dozens of libraries to download, configure and build. It is still Python 2.7 (not 3.1) due to libraries like SciPy. A subscription for EPD is also a contribution to the

Re: Idea for removing the GIL...

2011-02-08 Thread sturlamolden
On 8 Feb, 10:39, Vishal vsapr...@gmail.com wrote: Is it possible that the Python process, creates copies of the interpreter for each thread that is launched, and some how the thread is bound to its own interpreter ? In .NET lingo this is called an 'AppDomain'. This is also how tcl works --

Re: Perl Hacker, Python Initiate

2011-02-03 Thread sturlamolden
On 2 Feb, 05:36, Gary Chambers gwch...@gwcmail.com wrote: Given the following Perl script: (...) Let me quote the deceased Norwegian lisp hacker Erik Naggum: Excuse me while I barf in Larry Wall's general direction. Sturla -- http://mail.python.org/mailman/listinfo/python-list

Re: Python critique

2011-01-31 Thread sturlamolden
On 10 Des 2010, 21:02, John Nagle na...@animats.com wrote:     Probably the biggest practical problem with CPython is that C modules have to be closely matched to the version of CPython.  There's no well-defined API that doesn't change. ctypes and DLLs in plain C do not change, and do not

Re: Python critique

2011-01-31 Thread sturlamolden
On 11 Des 2010, 00:09, Antoine Pitrou solip...@pitrou.net wrote:     Probably the biggest practical problem with CPython is that C modules have to be closely matched to the version of CPython.  There's no well-defined API that doesn't change. Please stop spreading

Re: WxPython versus Tkinter.

2011-01-31 Thread sturlamolden
On 23 Jan, 01:07, rantingrick rantingr...@gmail.com wrote: It is time to prove once and for all how dated and worthless Tkinter is compared to wxPython. Yes, WxPython is not as advanced as i would like it to be for a 21st century GUI library. So use PyQt instead. However compared to

Re: Why is python not written in C++ ?

2010-08-11 Thread sturlamolden
On 11 Aug, 08:40, Ulrich Eckhardt eckha...@satorlaser.com wrote: That's true, maybe I don't remember the exact rationale. Especially if even someone like you, who is much deeper into Python development, doesn't, I'm wondering if I'm misremembering something Header (definition) and source

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread sturlamolden
On 9 Aug, 10:21, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: And that it's quite finicky about blank lines between methods and inside functions. Makes it hard to paste code directly into the interpreter. The combination of editor, debugger and interpreter is what I miss most

Re: Why is python not written in C++ ?

2010-08-03 Thread sturlamolden
On 4 Aug, 04:41, Grant Edwards inva...@invalid.invalid wrote: The issue that would prevent its use where I work is the inability to hire anybody who knows Ada.  You can't hire anybody who knows C++ either, but you can hire lots of people who claim they do.   That is very true. --

Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 2 Aug, 01:08, candide cand...@free.invalid wrote: Has it ever been planned to rewrite in C++ the historical implementation (of course in an object oriented design) ? OO programming is possible in C. Just take a look at GNOME and GTK. Perl is written in C++. That is not enough to make me

Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 2 Aug, 05:04, Tomasz Rola rto...@ceti.pl wrote: And one should not forget about performance. C++ was for a long time behind C, and even now some parts (like iostreams) should be avoided in fast code. For fast I/O one must use platform specific APIs, such as Windows' i/o completion ports

Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 3 Aug, 00:27, Paul Rubin no.em...@nospam.invalid wrote: Certain folks in the functional-programming community consider OO to be a 1980's or 1990's approach that didn't work out, and that what it was really trying to supply was polymorphism.  C++ programs these days apparently tend to use

Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 3 Aug, 01:14, Martin Gregorie mar...@address-in-sig.invalid wrote: Bottom line: All this would still have happened regardless of the programming language used. I am quite sure C and Fortran makes it unlikely for an unhandled exception to trigger the autodestruct sequence. But it's nice to

Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 3 Aug, 01:37, Mark Lawrence breamore...@yahoo.co.uk wrote: A bug is a bug is a bug? According to Grace Hopper, a bug might be a moth, in which case the best debugger is a pair of forceps. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 3 Aug, 02:47, Roy Smith r...@panix.com wrote: This one I don't understand.  Yes, I get RAII, but surely there are valid reasons to allocate memory outside of constructors.  Containers which resize themselves (such as std::vector) are one obvious example. That is because an exception might

Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 3 Aug, 04:03, sturlamolden sturlamol...@yahoo.no wrote: struct File {     std::FILE *fid;     File(const char *name) {         // acquire resource in constructor         fid = std::fopen(name);         if (!fid) throw some_exception;     }     ~File() {         // free resource

Re: Normalizing A Vector

2010-08-02 Thread sturlamolden
On 30 Jul, 13:46, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: Say a vector V is a tuple of 3 numbers, not all zero. You want to normalize it (scale all components by the same factor) so its magnitude is 1. The usual way is something like this:     L = math.sqrt(V[0] * V[0]

Re: Performance ordered dictionary vs normal dictionary

2010-07-28 Thread sturlamolden
On 29 Jul, 03:47, Navkirat Singh navkir...@gmail.com wrote: I was wondering what would be better to do some medium to heavy book keeping in memory - Ordered Dictionary or a plain simple Dictionary object?? It depends on the problem. A dictionary is a hash table. An ordered dictionary is a

Re: Accumulate function in python

2010-07-27 Thread sturlamolden
On 19 Jul, 13:18, dhruvbird dhruvb...@gmail.com wrote: Hello,   I have a list of integers: x = [ 0, 1, 2, 1, 1, 0, 0, 2, 3 ]   And would like to compute the cumulative sum of all the integers from index zero into another array. So for the array above, I should get: [ 0, 1, 3, 4, 5, 5, 5, 7,

Re: Exposing buffer interface for non-extension types?

2010-07-20 Thread sturlamolden
On 21 Jul, 02:38, Ken Watford kwatford+pyt...@gmail.com wrote: Perhaps, but *why* is it only a pure C-level interface? It is exposed to Python as memoryview. If memoryview is not sufficient, we can use ctypes.pythonapi to read the C struct. --

Re: why is this group being spammed?

2010-07-18 Thread sturlamolden
On 18 Jul, 07:01, be.krul be.k...@gmail.com wrote: why is this group being spammed? There used to be bots that issued cancel messages against spam, but I don't think they are actively maintained anymore. -- http://mail.python.org/mailman/listinfo/python-list

Re: Struqtural: High level database interface library

2010-07-17 Thread sturlamolden
On 17 Jul, 07:29, Nathan Rice nathan.alexander.r...@gmail.com wrote: Let’s push things to the edge now with a quick demo of many to many relationship support. For this example we’re going to be using the following XML: Departments     Department         DeptNum123/DeptNum        

Re: Sharing: member type deduction for member pointers (Alf's device?)

2010-07-17 Thread sturlamolden
On 17 Jul, 15:02, Alf P. Steinbach /Usenet alf.p.steinbach +use...@gmail.com wrote: #include progrock/cppy/PyClass.h      // PyWeakPtr, PyPtr, PyModule, PyClass using namespace progrock; namespace {      using namespace cppy;      struct Noddy      {          PyPtr       first;          

Re: Cpp + Python: static data dynamic initialization in *nix shared lib?

2010-07-13 Thread sturlamolden
On 9 Jul, 17:52, Alf P. Steinbach /Usenet alf.p.steinbach +use...@gmail.com wrote: For an extension module it seems that Python requires each routine to be defined as 'extern C'. That is strange. PyMethodDef is just a jump table. So why should 'extern C' matter? Good luck on re-inventing

Re: Cpp + Python: static data dynamic initialization in *nix shared lib?

2010-07-13 Thread sturlamolden
On 13 Jul, 21:39, Alf P. Steinbach /Usenet alf.p.steinbach +use...@gmail.com wrote: Thanks! It seems that SCXX does those things that I've been planning to do but haven't got around to (wrapping standard Python types), while what it doesn't do (abstracting away all those tables etc. and

  1   2   3   4   5   6   7   8   >