Re: Python vs. C++11

2012-02-12 Thread sturlamolden
On Feb 13, 4:21 am, sturlamolden 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

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: Data Plotting Library Dislin 10.2

2011-11-18 Thread sturlamolden
On 18 Nov, 22:16, Tony the Tiger 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 and engineers u

Re: Complex sort on big files

2011-08-06 Thread sturlamolden
On Aug 1, 5:33 pm, aliman 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 the file (mmap.mmap)

Re: Complex sort on big files

2011-08-05 Thread sturlamolden
On Aug 1, 5:33 pm, aliman 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 would consider using m

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

2011-07-22 Thread sturlamolden
On 21 Jul, 16:52, Kevin Walzer 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 nice GUI toolkit by

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

2011-07-22 Thread sturlamolden
On 22 Jul, 02:34, Gregory Ewing 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, Pyrex or Cython? -- ht

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

2011-07-20 Thread sturlamolden
On 21 Jul, 00:52, Phlip 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

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

2011-07-20 Thread sturlamolden
On 20 Jul, 22:58, Phlip 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). -- 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, 22:58, Phlip 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 that bad with the rec

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

2011-07-20 Thread sturlamolden
On 20 Jul, 06:28, Steven D'Aprano 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 "enthought" for more information. >>>

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

2011-07-20 Thread sturlamolden
On 20 Jul, 17:21, Thomas Jollans 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 does not work o

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

2011-07-20 Thread sturlamolden
On 20 Jul, 13:08, Tim Chase 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, 13:04, Adam Tauno Williams 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 don't work that

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

2011-07-20 Thread sturlamolden
On 20 Jul, 16:17, Mel 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 accessed again. tp_dealloc

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

2011-07-20 Thread sturlamolden
On 20 Jul, 11:59, Thomas Jollans 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 the display

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

2011-07-20 Thread sturlamolden
On 20 Jul, 11:59, Thomas Jollans 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 and Tkinter are

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 (w

Re: subprocess & isql

2011-07-15 Thread sturlamolden
On 15 Jul, 04:47, "peterff66" 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 similar work before?

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 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 not mean that Python is

Re: How to write a file generator

2011-07-12 Thread sturlamolden
On 12 Jul, 16:46, Billy Mays 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: Python bug? Indexing to matrices

2011-07-12 Thread sturlamolden
On 12 Jul, 14:59, sturlamolden 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: Python bug? Indexing to matrices

2011-07-12 Thread sturlamolden
On 12 Jul, 07:39, David 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 the array module f

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

2011-07-11 Thread sturlamolden
On 12 Jul, 01:33, Dave Cook 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 could always be ge

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

2011-07-11 Thread sturlamolden
On 12 Jul, 01:33, Dave Cook 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 could always be ge

Re: perceptron feed forward neural networks in python

2011-07-11 Thread sturlamolden
On 11 Jul, 20:47, Ken Watford wrote: > On Mon, Jul 11, 2011 at 2:31 PM, Igor Begić 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 > > for this? > > Try Stephen Marsland's

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

2011-07-11 Thread sturlamolden
On 11 Jul, 22:35, Kevin Walzer 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 (cf. wxWidgets, Qt

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

2011-07-11 Thread sturlamolden
On 11 Jul, 21:58, sturlamolden 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://mail.python.org/mail

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

2011-07-11 Thread sturlamolden
On 11 Jul, 20:28, Ivan Kljaic 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 wxFormBuilder for wxPytho

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

2011-07-11 Thread sturlamolden
On 11 Jul, 21:58, sturlamolden 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 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 dicontinued f

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

2011-07-11 Thread sturlamolden
On 11 Jul, 16:10, Thorsten Kampe 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 1970s. I would expect

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

2011-07-11 Thread sturlamolden
On 11 Jul, 14:39, Ben Finney 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 "Windows model" of a one-click

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

2011-07-11 Thread sturlamolden
On 11 Jul, 00:50, Ivan Kljaic 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 happened to boa c

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 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 designers.  A > R

Re: Python's super() considered super!

2011-05-27 Thread sturlamolden
On 27 Mai, 18:06, Steven D'Aprano 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 > reasoning about type(self) inside a class

Re: Python's super() considered super!

2011-05-27 Thread sturlamolden
On 27 Mai, 23:49, Stefan Behnel 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 called, even i

Re: Python's super() considered super!

2011-05-27 Thread sturlamolden
On 27 Mai, 17:05, Duncan Booth 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 around it. Then it shoul

Re: Python's super() considered super!

2011-05-27 Thread sturlamolden
On 27 Mai, 17:05, Duncan Booth 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, 16:27, sturlamolden 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'] >     re

Re: Python's super() considered super!

2011-05-27 Thread sturlamolden
On 26 Mai, 18:31, Raymond Hettinger 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: > >  http://

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

2011-05-04 Thread sturlamolden
On May 4, 7:15 pm, Benjamin Kaplan 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: Hooking into Python's memory management

2011-05-04 Thread sturlamolden
On May 4, 6:51 pm, Daniel Neilson 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 object from the curren

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

2011-05-04 Thread sturlamolden
On May 4, 5:40 pm, Michael Torrie 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 a handle to th

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

2011-05-04 Thread sturlamolden
On May 3, 6:33 pm, Mel 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 list unseen by t

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

2011-05-04 Thread sturlamolden
On May 3, 3:50 pm, Hrvoje Niksic 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 class variables (o

Re: Vectors

2011-04-23 Thread sturlamolden
On Apr 23, 2:26 pm, Algis Kabaila 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 some people prefe

Re: Vectors

2011-04-22 Thread sturlamolden
On Apr 23, 2:32 am, Algis Kabaila 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 matter. Am I bad

Re: Vectors

2011-04-22 Thread sturlamolden
On Apr 20, 9:47 am, Algis Kabaila 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 Cython): BLAS (Intel MK

Re: About threads in python

2011-04-22 Thread sturlamolden
On Apr 21, 3:19 pm, dutche 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 compute-bound code

Re: An unusual question...

2011-04-17 Thread sturlamolden
On Apr 17, 7:25 pm, Chris Angelico 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, such as implement

Re: An unusual question...

2011-04-17 Thread sturlamolden
On Apr 17, 2:15 pm, 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 mprotect to make i

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 17, 5:15 pm, Ian 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 thread, it's time

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 15, 6:33 pm, Chris H 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 not, how do you avoid this issu

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 17, 12:10 am, Michael Torrie 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 to synchronize

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 16, 4:59 am, David Cournapeau 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 becomes that m

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 15, 6:33 pm, Chris H 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 not, how do you avoid this issu

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 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 > just in case, because you never know

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-11 Thread sturlamolden
On 11 apr, 21:11, sturlamolden 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 an

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-11 Thread sturlamolden
On 11 apr, 09:21, John Nagle 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 multi-core CPUs.

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-10 Thread sturlamolden
On 8 apr, 03:10, sturlamolden 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

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-10 Thread sturlamolden
On 10 apr, 18:27, John Nagle 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, if Python has

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-10 Thread sturlamolden
On 9 apr, 22:18, John Ladasky 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 inputs simultaneously

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-09 Thread sturlamolden
On 9 apr, 09:36, John Ladasky 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 libraries, even for neur

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-07 Thread sturlamolden
On 8 apr, 02:38, sturlamolden 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: Multiprocessing, shared memory vs. pickled copies

2011-04-07 Thread sturlamolden
On 8 apr, 02:03, sturlamolden 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 with 64-bit

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-07 Thread sturlamolden
On 4 apr, 22:20, John Ladasky 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, they also contain

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-07 Thread sturlamolden
On 5 apr, 02:05, Robert Kern wrote: > PicklingError: Can't pickle '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 understand! Gaël and I wrote shmem

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

2011-03-07 Thread sturlamolden
On 7 Mar, 09:30, Chris Rebert 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 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, consider using the

Re: logging module -- better timestamp accuracy on Windows

2011-02-16 Thread sturlamolden
On 16 Feb, 15:30, benhoyt 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. Preferably we should

Re: Non-linear regression help in Python

2011-02-15 Thread sturlamolden
On 15 Feb, 05:24, Akand Islam 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-list

Re: Non-linear regression help in Python

2011-02-14 Thread sturlamolden
On 14 Feb, 22:02, Akand Islam 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 python? First

Re: EPD 7.0 released

2011-02-14 Thread sturlamolden
On 14 Feb, 13:35, "Colin J. Williams" 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 to build NumPy and

Re: EPD 7.0 released

2011-02-14 Thread sturlamolden
On 14 Feb, 01:50, Robert Kern 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 us > do > more of

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 deve

Re: Idea for removing the GIL...

2011-02-08 Thread sturlamolden
On 8 Feb, 10:39, Vishal 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 -- one interpreter p

Re: Perl Hacker, Python Initiate

2011-02-03 Thread sturlamolden
On 2 Feb, 05:36, Gary Chambers 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: WxPython versus Tkinter.

2011-01-31 Thread sturlamolden
On 23 Jan, 01:07, rantingrick 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 > Tkinter, Wx is light ye

Re: Python critique

2011-01-31 Thread sturlamolden
On 11 Des 2010, 00:09, Antoine Pitrou 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 FUD:http://docs.python.org/c-api/ind

Re: Python critique

2011-01-31 Thread sturlamolden
On 10 Des 2010, 21:02, John Nagle 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 depend on CPython

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

2010-08-11 Thread sturlamolden
On 11 Aug, 08:40, Ulrich Eckhardt 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 (implementation) is n

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

2010-08-09 Thread sturlamolden
On 9 Aug, 10:21, Steven D'Aprano 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 from Matlab. In Matlab we can have a

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

2010-08-03 Thread sturlamolden
On 4 Aug, 04:41, Grant Edwards 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. -- http://mail.python.org/mailma

Re: Normalizing A Vector

2010-08-02 Thread sturlamolden
On 30 Jul, 13:46, Lawrence D'Oliveiro 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] + V[1] * V[1] + V[2] * V[2])

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

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

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

2010-08-02 Thread sturlamolden
On 3 Aug, 02:47, Roy Smith 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 skip an arbi

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

2010-08-02 Thread sturlamolden
On 3 Aug, 01:37, Mark Lawrence 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, 01:14, Martin Gregorie 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 know when flying that modern

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

2010-08-02 Thread sturlamolden
On 3 Aug, 00:27, Paul Rubin 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 template-based generi

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

2010-08-02 Thread sturlamolden
On 2 Aug, 05:04, Tomasz Rola 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 and memory map

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

2010-08-02 Thread sturlamolden
On 2 Aug, 01:08, candide 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 want to use it ;) T

Re: Performance ordered dictionary vs normal dictionary

2010-07-28 Thread sturlamolden
On 29 Jul, 03:47, Navkirat Singh 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 binary search tree (B

Re: Accumulate function in python

2010-07-27 Thread sturlamolden
On 19 Jul, 13:18, dhruvbird 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, 10 ] >   What is

Re: Exposing buffer interface for non-extension types?

2010-07-20 Thread sturlamolden
On 21 Jul, 02:38, Ken Watford 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. -- http://mail.python.org/mailman/listinfo/python-list

Re: why is this group being spammed?

2010-07-18 Thread sturlamolden
On 18 Jul, 07:01, "be.krul" 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: Sharing: member type deduction for member pointers (Alf's device?)

2010-07-17 Thread sturlamolden
On 17 Jul, 15:02, "Alf P. Steinbach /Usenet" wrote: > #include      // PyWeakPtr, PyPtr, PyModule, PyClass > using namespace progrock; > > namespace { >      using namespace cppy; > >      struct Noddy >      { >          PyPtr       first; >          PyPtr       last; >          int         num

Re: Struqtural: High level database interface library

2010-07-17 Thread sturlamolden
On 17 Jul, 07:29, Nathan Rice 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: > > >     >         123 >         Sales >         >             143 >             Raul Lopez >      

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

2010-07-13 Thread sturlamolden
On 13 Jul, 22:35, "Alf P. Steinbach /Usenet" wrote: > Yes, I know Boost.Python in more detail and I've heard of all the rest except > SIP, In my opinion, SIP is the easiest way of integrating C++ and Python. Just ignore the PyQt stuff. http://www.riverbankcomputing.co.uk/static/Docs/sip4/using

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

2010-07-13 Thread sturlamolden
On 13 Jul, 22:35, "Alf P. Steinbach /Usenet" wrote: > In practice, 'extern "C"' matters for the jump tables because for those few > compilers if any where it really matters (not just the compiler emitting a > warning like reportedly Sun CC does), different linkage can imply different > machine co

  1   2   3   4   5   6   7   8   >