Re: Linq to Python

2008-09-24 Thread sturlamolden
On Sep 24, 5:22 pm, hrishy <[EMAIL PROTECTED]> wrote: > Well wouldn't it be a lot easier to query and join a xml source with a > relational source with LINQ capabilites in Python. > > Hmm what am i missing here is there a site that takes all LINQ examples and > does them using list comprehension

Re: Linq to Python

2008-09-24 Thread sturlamolden
On Sep 24, 9:11 pm, [EMAIL PROTECTED] wrote: > In the meantime where I > live lot of people will keep using C# instead of Python and CLisp, > natural selection at work indeed. Please explain to me what Linq can do that Python does not. Put you emphasis on why this can't be done with a library, an

Re: Linq to Python

2008-09-24 Thread sturlamolden
On Sep 24, 10:59 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Simple LINQ expressions like the one you gave map easily to Python list > comprehensions. What Microsoft have done though is provide a consistent > implementation which allows you to write complex SQL like expressions which > will work

Re: Making small executive file for distribution

2008-09-24 Thread sturlamolden
On Sep 24, 3:17 pm, Marin Brkic <[EMAIL PROTECTED]> wrote: > Has anyone had a situation like this ? All your inputs and suggestions > are more then welcomed. Send them the .py file and confirm that it does work. The lack of Python can be blamed on the incompetent BOFH. Chances are the situation w

Re: Linq to Python

2008-09-25 Thread sturlamolden
On 25 Sep, 10:08, Duncan Booth <[EMAIL PROTECTED]> wrote: > A lot of what LINQ does is already easy to do in Python, and most of the > rest can probably be added fairly easily, but it does provide a consistent > framework which may make it easier to do complex LINQ statements than > complex list c

Re: The Python computer language

2008-09-25 Thread sturlamolden
On 25 Sep, 06:02, ROSEEE <[EMAIL PROTECTED]> wrote: > http://pythoncomputer.blogspot.com I wonder where the usenet cancelbots have gone? -- http://mail.python.org/mailman/listinfo/python-list

Re: Linq to Python

2008-09-25 Thread sturlamolden
On 25 Sep, 12:06, hrishy <[EMAIL PROTECTED]> wrote: > var stoogeGuys = >      Beginning with the XML source >      from xmlGuys in xmlSource.Descendants("Stooge") >      Join to the array on the common element "stoogeName" >      join arrayGuys in familyFacts >            on xmlGuys.Element("stoog

Re: Linq to Python

2008-09-25 Thread sturlamolden
On 25 Sep, 12:06, hrishy <[EMAIL PROTECTED]> wrote: > [code] > var stoogeGuys = >      Beginning with the XML source >      from xmlGuys in xmlSource.Descendants("Stooge") >      Join to the array on the common element "stoogeName" >      join arrayGuys in familyFacts >            on xmlGuys.Eleme

Re: Linq to Python

2008-09-25 Thread sturlamolden
On 25 Sep, 13:08, hrishy <[EMAIL PROTECTED]> wrote: > Pardon my ignorance again but id ont see any join in python or did i miss > something ? It's more Pythonic to use the syntax of dictionary lookups. -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple processes with private working dirs

2008-09-25 Thread sturlamolden
On 24 Sep, 19:37, "Tim Arnold" <[EMAIL PROTECTED]> wrote: > Am I missing something? Is there a better way? Use the pyprocessing module (to appear as standard module multiprocessing in Python 2.6). It has almost the same interface as Python's threading and Queue standard modules, except you are wo

Re: Linq to Python

2008-09-25 Thread sturlamolden
On 25 Sep, 14:22, Duncan Booth <[EMAIL PROTECTED]> wrote: > No Python's syntax is fine. The api's aren't as consistent though: > Microsoft added a common set of extension methods which work on > databases, xml, builtin sequences and can be easily extended to include > other custom sequences. That

Re: Python is slow?

2008-09-26 Thread sturlamolden
On Sep 26, 5:45 am, "David Cournapeau" <[EMAIL PROTECTED]> wrote: > I am fairly experienced in matlab (have been using it extensively for > 5 years in academical context), and now with numpy, and generally, > they are comparable speed-wise. Matlab has some niceties which makes > it faster in some

Re: Quick sort implementation in python

2008-09-26 Thread sturlamolden
On 26 Sep, 08:43, Terry Reedy <[EMAIL PROTECTED]> wrote: > That depends on the data structure.  Access to a singly-linked list is > by linear scanning from the front. Which is one reason why mergesort i preferred over quicksort for lists. Pythons built-in sort is a variant of mergesort and should

Re: blocking all threads

2008-09-29 Thread sturlamolden
On Sep 29, 4:56 pm, Alexandru Mosoi <[EMAIL PROTECTED]> wrote: > how can I block all threads for a specific amount of time? (i need to > sleep whole process for testing purposes). i thought of accessing GIL > and sleep for some amount of time, but I don't know how to do this and > whether GIL is

problem with matplotlib

2006-03-09 Thread sturlamolden
Recently, I have been trying to test Python as an alternative to Matlab. I have problems getting matplotlib to work on Windows (ActivePython 2.4.2). After installing the precompiled binary packages for NumPy 0.9.5 and Matplotlib 0.87.1, I get this error message: >>> import pylab as p Traceback (m

Re: string building

2006-04-03 Thread sturlamolden
John Salerno wrote: > Out of curiosity, is there any kind of equivalent in Python to the > StringBuilder class in C#? You can just append each string to a list and call "".join(list) on the list. Here is a mock-up StringBuilder class: class StringBuilder: def __init__(self): self.strlis

Re: xmlrpc idea for getting around the GIL

2009-12-02 Thread sturlamolden
On 2 Des, 02:47, Patrick Stinson wrote: > We don't need extension modules, and all we need to do is run some > fairly basic scripts that make callbacks and use some sip-wrapped > types. Sure, you use SIP but not extension modules... > - Python is not suitable for real-time work. > > Not true.

Re: Delaunay triangulation

2009-12-02 Thread sturlamolden
On 2 Des, 15:28, David Robinow wrote: > On Tue, Dec 1, 2009 at 8:31 PM, Vincent Davis > wrote: > > Anyone know of a python implementation of Delaunay triangulation? > > Matplotlib has one. > There's also Delny �...@pypi > > It's been several years since I needed this. I can't remember the pros/c

Re: Coding Cross Correlation Function in Python

2009-12-02 Thread sturlamolden
On 2 Des, 18:50, DarthXander wrote: > However to do this 700 times seems ridiculous. How would I get python > to perform this for me for t in a range of roughly 0-700? For two 1D ndarrays, the cross-correlation is from numpy.fft import rfft, irfft from numpy import fliplr xcorr = lambda x,y :

Re: Formatting logically nested actions -- Pythonic way?

2009-12-04 Thread sturlamolden
On 4 Des, 07:24, "Alf P. Steinbach" wrote: > And this leads to hierarchical code, which would be nice to indicate by > indenting, but oops, indenting in Python is syntactically significant... I've seen this with OpenGL as well. Intendation between glBegin and glEnd can be achieved with a context

Re: ctypes pointer from offset into array?

2009-12-05 Thread sturlamolden
On 5 Des, 10:13, Carl Banks wrote: > Is there a way to get the pointer to an array offset in ctypes. > Example, say I define an array like so: > > xfer = (c_char*bufsize)() > > How would I get a pointer to then nth byte (equivalient of &xfer[n])? > I guess I would have expected xfer+n to work, but

Re: ctypes pointer from offset into array?

2009-12-05 Thread sturlamolden
On 5 Des, 10:13, Carl Banks wrote: > Is there a way to get the pointer to an array offset in ctypes. Could also mention that Cython has pointer arithmetics. Cython can be easier to use than ctypes, but is not a standard module. -- http://mail.python.org/mailman/listinfo/python-list

Re: Are routine objects guaranteed mutable & with dictionary?

2009-12-05 Thread sturlamolden
On 5 Des, 12:55, Andreas Waldenburger wrote: > Can you please elaborate? To me, a function is something that > transforms some input to some output [1]. Which is exactly what Python > functions do, without fail. A mathematical function cannot have side effects. That is what functional languages

Re: Float precision and float equality

2009-12-05 Thread sturlamolden
On 5 Des, 16:37, Anton81 wrote: > I'd like to do calculations with floats and at some point equality of > two number will be checked. > What is the best way to make sure that equality of floats will be > detected, where I assume that mismatches beyond a certain point are > due to truncation errors

Re: Float precision and float equality

2009-12-06 Thread sturlamolden
On 6 Des, 21:52, r0g wrote: > > .> Right.  Using abs(x-y) < eps is the way to go. > > .> > > .> Raymond > > > This only works when abs(x) and abs(y) are larger that eps, but not > > too much larger. > > Okay, I'm confused now... I thought them being larger was entirely the > point. Yes. dbd got

Re: Float precision and float equality

2009-12-07 Thread sturlamolden
On 7 Des, 06:43, dbd wrote: > If you have > samples of a sine wave with peak amplitude of one half eps, the "abs(x- > y) < eps" test would report all values on the sine wave as equal to > zero. This would not be correct. You don't understand this at all do you? If you have a sine wave with an a

Re: Using Python to Execute a C or FORTRAN Program (Windows)

2009-12-16 Thread sturlamolden
On 17 Des, 03:41, "W. eWatson" wrote: > His program was originally written in Python, but a new > hardware device (capture card) had no good interface with Python, so he > wrote it in C++, which does. From my knowledge of the Python program > before the entry of c++, it seems he could have farmed

Re: shouldn't list comprehension be faster than for loops?

2009-12-18 Thread sturlamolden
On 17 Des, 18:37, Carlos Grohmann wrote: > Tenting the time spent by each approach (using time.clock()), with a > file with about 100,000 entries, I get 0.03s for the loop and 0.05s > for the listcomp. > > thoughts? Anything else being equal, list comprehensions will be the faster becuase they i

Re: shouldn't list comprehension be faster than for loops?

2009-12-18 Thread sturlamolden
On 17 Des, 18:42, "Alf P. Steinbach" wrote: > Have you tried this with > >    dip1 = [dp - 0.01 if dp == 90 else dp for dp in dipList] And for comparison with map: map(lambda dp: dp - 0.01 if dp == 90 else dp, dipList) -- http://mail.python.org/mailman/listinfo/python-list

Re: shouldn't list comprehension be faster than for loops?

2009-12-18 Thread sturlamolden
On 17 Des, 18:37, Carlos Grohmann wrote: > Tenting the time spent by each approach (using time.clock()), with a > file with about 100,000 entries, I get 0.03s for the loop and 0.05s > for the listcomp. > > thoughts? Let me ask a retoric question: - How much do you really value 20 ms of CPU time

Re: numpy performance and random numbers

2009-12-19 Thread sturlamolden
On 19 Des, 11:05, Carl Johan Rehn wrote: > I plan to port a Monte Carlo engine from Matlab to Python. However, > when I timed randn(N1, N2) in Python and compared it with Matlab's > randn, Matlab came out as a clear winner with a speedup of 3-4 times. > This was truly disappointing. I ran tthis t

Re: numpy performance and random numbers

2009-12-19 Thread sturlamolden
On 19 Des, 12:29, Steven D'Aprano wrote: > Perhaps > the Matlab random number generator is a low-quality generator which is > fast but not very random. Python uses a very high quality RNG which is > not cheap. Marsaglia and Matlab's implementation of ziggurat uses a slightly lower quality RNG fo

Re: numpy performance and random numbers

2009-12-19 Thread sturlamolden
On 19 Des, 14:06, Carl Johan Rehn wrote: > Matlab and numpy have (by chance?) the exact names for the same > functionality, Common ancenstry, NumPy and Matlab borrowed the name from IDL. LabView, Octave and SciLab uses the name randn as well. > So the basioc question is, how can I speed up r

Re: shouldn't list comprehension be faster than for loops?

2009-12-19 Thread sturlamolden
On 19 Des, 02:28, Ryan Kelly wrote: > Not so.  If you use the "dis" module to peek at the bytecode generated > for a list comprehension, you'll see it's very similar to that generated > for an explicit for-loop.  The byte-code for a call to map is very > different. First, you failed to realize t

Re: numpy performance and random numbers

2009-12-19 Thread sturlamolden
On 19 Des, 16:20, Carl Johan Rehn wrote: > How about mulit-core or (perhaps more exciting) GPU and CUDA? I must > admit that I am extremely interested in trying the CUDA-alternative. > > Obviously, cuBLAS is not an option here, so what is the safest route > for a novice parallel-programmer? The

Re: numpy performance and random numbers

2009-12-19 Thread sturlamolden
On 19 Des, 21:26, Lie Ryan wrote: > you can just start two PRNG at two distinct states No. You have to know for certain that the outputs don't overlap. If you pick two random states (using any PRNG), you need error- checking that states are always unique, i.e. that each PRNG never reaches the s

Re: numpy performance and random numbers

2009-12-19 Thread sturlamolden
On 19 Des, 22:58, sturlamolden wrote: > If you pick two random states (using any PRNG), you need error- > checking that states are always unique, i.e. that each PRNG never > reaches the starting state of the other(s). Another note on this: Ideally, we would e.g. know how to find (ana

Re: numpy performance and random numbers

2009-12-21 Thread sturlamolden
On 20 Des, 01:46, Lie Ryan wrote: > Not necessarily, you only need to be certain that the two streams don't > overlap in any reasonable amount of time. For that purpose, you can use > a PRNG that have extremely high period like Mersenne Twister and puts > the generators to very distant states. E

Re: Storing a C pointer in a Python class instance

2009-09-29 Thread sturlamolden
On 29 Sep, 10:27, "lallous" wrote: > Hello > > From my C extension module I want to store a C pointer in a given PyObject. > > The only way I figure how to do it is to use Py_BuildValues and store the > poiner casted to Py_ssize_t, Formally, you should cast the pointer to Py_intptr_t, as it has t

Re: Storing a C pointer in a Python class instance

2009-09-29 Thread sturlamolden
On 29 Sep, 19:11, Carl Banks wrote: > CObjects can be passed a C function as a deallocator; this should work > as reliably as a custom class deallocator. > > Carl Banks Except that __del__ prevents cyclic GC. -- http://mail.python.org/mailman/listinfo/python-list

Re: Serial connections and threads in a GUI

2009-09-29 Thread sturlamolden
On 29 Sep, 23:56, Aaron Hoover wrote: > how can I allow the thread   > access to the connection for reading, but then have it give up control   > over the connection when it's done so the main GUI thread can access   > the connection again for writing? Protect read/write access to the serial port

Re: Storing a C pointer in a Python class instance

2009-09-30 Thread sturlamolden
On 30 Sep, 19:03, Carl Banks wrote: > Second, CObjects do not have a __del__ method.  They call the supplied > constructor from the type's tp_dealloc slot.  Use of the tp_dealloc > slot does not, by itself, prevent cyclic GC. > > Bottom line is, the CObject's deallocator is as reliable as a custo

Re: Threaded GUI slowing method execution?

2009-10-02 Thread sturlamolden
On 2 Okt, 13:29, Dave Angel wrote: > Many people have concluded that (in Python) much of what threads are > used for should be done with processes. Remember that threads were invented long before multi-core CPUs were common. Java had threads before the VM could support more than one CPU. The ear

Re: Threaded GUI slowing method execution?

2009-10-02 Thread sturlamolden
On 2 Okt, 02:51, Aaron Hoover wrote: > All the thread is doing most of the time is sitting around checking   > the serial port for waiting data, reading it, and appending it to a   > list when it finds it. Do your threads ever block waiting for I/O? If they do, is the GIL released while they are

Re: Threaded GUI slowing method execution?

2009-10-02 Thread sturlamolden
On 2 Okt, 20:19, Ole Streicher wrote: > I *do* worry about speed. And I use Python. Why not? There are powerful > libraries available. I do as well. But "powerful libraries" should release the GIL. Let me rephrase that: I am not worried about speed in the part of my code that uses Python. > Us

Re: Threaded GUI slowing method execution?

2009-10-02 Thread sturlamolden
On 2 Okt, 22:29, Aaron Hoover wrote: > My external hardware is actually sending 2000 packets per second right   > now (but that can also be changed). Each packet currently contains 6   > bytes of data and 6 bytes of overhead. So, 12 bytes per packet * 2000   > packets per second is 24k bytes per

Re: numpy f2py question

2009-10-02 Thread sturlamolden
On 2 Okt, 22:41, George Trojan wrote: > I have a problem with numpy's vectorize class and f2py wrapped old > FORTRAN code. I found that the function _get_nargs() in > site-packages/numpy/lib/function_base.py tries to find the number of > arguments for a function from an error message generated whe

Re: numpy f2py question

2009-10-02 Thread sturlamolden
http://projects.scipy.org/numpy/ticket/1247 -- http://mail.python.org/mailman/listinfo/python-list

Re: Threaded GUI slowing method execution?

2009-10-03 Thread sturlamolden
On 2 Okt, 21:30, Dave Angel wrote: > There could very well be multiprocess support in wxPython.  I'd check > there first, before re-inventing the wheel. I don't think there is. But one can easily make a thread in the subprocess that polls a pipe and calls wx.PostEvent or wx.CallLater when someth

Re: No threading.start_new_thread(), useful addition?

2009-10-08 Thread sturlamolden
On 8 Okt, 09:17, Ulrich Eckhardt wrote: > I'm looking at the 'threading' module and see that other than the 'thread' > module it doesn't have a simple function to start a new thread. Instead, > you first have to instantiate a threading object and then start the new > thread on it: > >   t = threa

Re: efficient running median

2009-10-13 Thread sturlamolden
On 13 Okt, 18:33, Paul Rubin wrote: > The obvious way to compute a running median involves a tree structure > so you can quickly insert and delete elements, and find the median. > That would be asymtotically O(n log n) but messy to implement. QuickSelect will find t

Re: efficient running median

2009-10-14 Thread sturlamolden
On 14 Okt, 00:03, Steven D'Aprano wrote: > Obviously to run in O(log n) you must have already built the tree. You don't need a tree. Quickselect is a partial quicksort. But my memory served me badly, quickselect is O(n). -- http://mail.python.org/mailman/listinfo/python-list

Re: is None or == None ?

2009-11-07 Thread sturlamolden
On 6 Nov, 14:35, "Alf P. Steinbach" wrote: > As I understand it, 'is' will always work and will always be efficient (it > just > checks the variable's type), while '==' can depend on the implementation of > equality checking for the other operand's class. '==' checks for logical equality. 'is'

Re: is None or == None ?

2009-11-07 Thread sturlamolden
On 6 Nov, 18:28, "Alf P. Steinbach" wrote: > Dynamic allocation isn't hare-brained, but doing it for every stored integer > value outside a very small range is, because dynamic allocation is (relatively > speaking, in the context of integer operations) very costly even with a > (relatively speaki

Re: is None or == None ?

2009-11-07 Thread sturlamolden
On 6 Nov, 17:54, "Alf P. Steinbach" wrote: > But wow. That's pretty hare-brained: dynamic allocation for every stored value > outside the cache range, needless extra indirection for every operation. First, integers are not used the same way in Python as they are in C+ +. E.g. you typically don't

Re: Most efficient way to "pre-grow" a list?

2009-11-07 Thread sturlamolden
On 6 Nov, 13:12, kj wrote: > > The best I can come up with is this: > > arr = [None] * 100 > > Is this the most efficient way to achieve this result? Yes, but why would you want to? Appending to a Python list has amortized O(1) complexity. I am not sure about Perl, but in MATLAB arrays are p

Re: Most efficient way to "pre-grow" a list?

2009-11-07 Thread sturlamolden
On 7 Nov, 03:46, gil_johnson wrote:> > I don't have the code with me, but for huge arrays, I have used > something like: > > >>> arr[0] = initializer > >>> for i in range N: > >>>      arr.extend(arr) > > This doubles the array every time through the loop, and you can add > the powers of 2 to get

Re: Most efficient way to "pre-grow" a list?

2009-11-07 Thread sturlamolden
On 6 Nov, 22:03, kj wrote: > As I said, this is considered an optimization, at least in Perl, > because it lets the interpreter allocate all the required memory > in one fell swoop, instead of having to reallocate it repeatedly > as the array grows. Python does not need to reallocate repeatedly

Re: python simply not scaleable enough for google?

2009-11-13 Thread sturlamolden
On 14 Nov, 08:39, Robert Brown wrote: > > Using Python 3 annotations, one can imagine a Python compiler that does the > > appropriate thing (shown in the comments) with the following code. > > I can imagine a lot too, but we're talking about Python as it's specified > *today*.  The Python languag

Re: python simply not scaleable enough for google?

2009-11-14 Thread sturlamolden
On 12 Nov, 18:33, J Kenneth King wrote: > Where Python might get hit *as a language* is that the Python programmer > has to drop into C to implement optimized data-structures for dealing > with the kind of IO that would slow down the Python interpreter.  That's > why we have numpy, scipy, etc. T

Re: python simply not scaleable enough for google?

2009-11-14 Thread sturlamolden
On 12 Nov, 18:32, "Alf P. Steinbach" wrote: > Of course Python is slow: if you want speed, pay for it by complexity. Python is slow is really a misconception. Python is used for scientific computing at HPC centres around the world. NumPy's predecessor numarray was made by NASA for the Hubble spa

Re: python simply not scaleable enough for google?

2009-11-14 Thread sturlamolden
On 12 Nov, 18:32, "Alf P. Steinbach" wrote: > Hm, this seems religious. > > Of course Python is slow: if you want speed, pay for it by complexity. Not really. The speed problems of Python can to a large extent be attributed to a sub-optimal VM. Perl tends to be much faster than Python. Certain

Re: python simply not scaleable enough for google?

2009-11-14 Thread sturlamolden
On 14 Nov, 09:47, "Alf P. Steinbach" wrote: > > Python is slow is really a misconception. > > Sorry, no, I don't think so. No, i really think a lot of the conveived slowness in Python comes from bad programming practices. Sure we can deomstrate that C or LuaJIT is faster by orders of magnitude f

Re: Python & Go

2009-11-14 Thread sturlamolden
On 12 Nov, 01:53, kj wrote: > I'm just learning about Google's latest: the GO (Go?) language. > (e.g.http://golang.orgorhttp://www.youtube.com/watch?v=rKnDgT73v8s). > There are some distinctly Pythonoid features to the syntax, such > as "import this_or_that", the absence of parentheses at the top

Re: Choosing GUI Module for Python

2009-11-14 Thread sturlamolden
On 9 Nov, 05:49, Antony wrote: >    I just wanted to know which module is best for developing designing > interface in python . I personally feel the wxPython support in the 3.1 beta of wxFormBuilder makes the choise rather simple. It generates a Python file with classes for all WYSIWYG GUI form

Re: Choosing GUI Module for Python

2009-11-14 Thread sturlamolden
On 14 Nov, 15:35, Dietmar Schwertberger wrote: >    self.m_toolBar1 = self.CreateToolBar( wx.TB_HORIZONTAL, wx.ID_ANY ) >    self.m_button1 = wx.Button( self.m_toolBar1, wx.ID_ANY, u"MyButton", > wx.DefaultPosition, wx.DefaultSize, 0 ) >    m_toolBar1.AddControl( m_button1 ) > > (i.e. "self." is

Re: Choosing GUI Module for Python

2009-11-14 Thread sturlamolden
On 14 Nov, 19:02, Dietmar Schwertberger wrote: > 08/23/2009 Version 3.01.63 (Beta) > 08/19/2009 Version 3.01.62 (Beta) > > I tried 3.01.63. > I can see in the Python window already that the code is not correct. 3.01.63 Did you remember to install the wxAdditions? Could you send me an .fbp file

Re: Python & Go

2009-11-14 Thread sturlamolden
On 14 Nov, 19:18, John Nagle wrote: > Syntax for queues is a minor win. No, that's syntax bloat. The go keyword could be a problem as well. I suspect it could infringe on Cilk++ patents. Perhaps Go cannot be used without a licence from Cilk Arts? -- http://mail.python.org/mailman/listinfo

Re: Choosing GUI Module for Python

2009-11-15 Thread sturlamolden
On 15 Nov, 17:05, Dietmar Schwertberger wrote: > > Could you send me an .fbp file demonstrating the error? > > Sent by email. Did you receive it? No... could you please resend to stu...@molden.no? -- http://mail.python.org/mailman/listinfo/python-list

Re: Choosing GUI Module for Python

2009-11-15 Thread sturlamolden
On 15 Nov, 17:05, Dietmar Schwertberger wrote: > Sent by email. Did you receive it? > Yes I did, thank you :) (I thought I didn't, but it was just a problem with my e-mail filter.) -- http://mail.python.org/mailman/listinfo/python-list

Re: Choosing GUI Module for Python

2009-11-15 Thread sturlamolden
On 14 Nov, 15:35, Dietmar Schwertberger wrote: >    self.m_toolBar1 = self.CreateToolBar( wx.TB_HORIZONTAL, wx.ID_ANY ) >    self.m_button1 = wx.Button( self.m_toolBar1, wx.ID_ANY, u"MyButton", > wx.DefaultPosition, wx.DefaultSize, 0 ) >    m_toolBar1.AddControl( m_button1 ) I can confirm this.

Re: Python & Go

2009-11-15 Thread sturlamolden
On 15 Nov, 05:21, Steven D'Aprano wrote: > Psyco does JIT compilation to machine-code for CPython, at the cost of > much extra memory. It's also limited to 32-bit Intel processors. The aim > of the PyPy project is to (eventually) make JIT machine-code compilation > available to any Python, on any

Re: python simply not scaleable enough for google?

2009-11-15 Thread sturlamolden
On 16 Nov, 05:09, John Nagle wrote: >       Python is a very clean language held back from widespread use by slow > implementations.  If Python ran faster, Go would be unnecessary. That boggles me. NASA can find money to build a space telescope and put it in orbit. They don't find money to crea

Re: python simply not scaleable enough for google?

2009-11-15 Thread sturlamolden
On 16 Nov, 05:09, John Nagle wrote: >       Python is a very clean language held back from widespread use by slow > implementations. Python is clean, minimalistic, and beautiful. Python don't have bloat like special syntax for XML or SQL databases (cf C#) or queues (Go). Most of all, it is eas

Re: IDE for python

2009-11-15 Thread sturlamolden
On 15 Nov, 18:09, Peng Yu wrote: > There had been some discussion on IDE. But I'm not sure what pros and > cons of each choice. Current, I'm using vim and ctags. > > Could somebody give some advices on choosing the best IDE for me? There is a plug-in to develop (amd debug) Python using MS Visual

Re: Python & Go

2009-11-15 Thread sturlamolden
On 14 Nov, 23:10, Terry Reedy wrote: > It would be much better, for instance, to tweak Python, which it > has had great success with, to better run on multiple cores." Python run well on multiple cores, you just have to use processes instead of threads. -- http://mail.python.org/mailman/lis

Re: python simply not scaleable enough for google?

2009-11-16 Thread sturlamolden
On 14 Nov, 02:42, Robert Brown wrote: > If you want to know why Python *the language* is slow, look at the Lisp code > CLPython generates and at the code implementing the run time.  Simple > operations end up being very expensive. You can also see this by looking at the C that Cython or Pyrex ge

Re: IDE for python

2009-11-16 Thread sturlamolden
On 16 Nov, 10:05, Jonathan Hartley wrote: > As far as I can make out, TextPad has only two features, syntax > highlighting and the ability to define a 'make' command, and a regex > that is used to extract filenames and line-numbers from the resulting > output of that make command. These are, it t

Re: python gui builders

2009-11-16 Thread sturlamolden
On 16 Nov, 11:06, me wrote: > What Python gui builder is well supported, does not require me > to learn another framework/library, and can crank out stuff for > multiple platforms ? I use wxFormBuilder. The 3.1 beta can even create wxPython code, but it still has some minor issues (e.g. not alwa

Re: python gui builders

2009-11-16 Thread sturlamolden
On 16 Nov, 11:39, sturlamolden wrote: > If you are fine with Microsoft only, you can use Windows Forms with MS > Visual Studio and IronPython. I also forgot to mention: If you can restrict yourself to Windows, you can always use Visual Basic or Borland Delphi with pywin32. Either expos

Re: Python & Go

2009-11-16 Thread sturlamolden
On 16 Nov, 10:06, Terry Reedy wrote: > > Python run well on multiple cores, you just have to use processes > > instead of threads. > > But not so trivially as to add one word to an existing function. > Hence by tweak, I meant, as explained in another post, to add a keyword > or just a decorator t

Re: import subprocess in python

2009-11-16 Thread sturlamolden
On 16 Nov, 13:50, Kuhl wrote: > Python 2.2.3 (#1, Feb  2 2005, 12:22:48) > What's the mistake that I am making? How to solve it? Your Python version is too old. -- http://mail.python.org/mailman/listinfo/python-list

Re: Let python call a C function pointer passed from the C Python API

2009-11-16 Thread sturlamolden
On 16 Nov, 14:25, Carl Banks wrote: > Python can't call C function pointers.   Yes it can, use ctypes... -- http://mail.python.org/mailman/listinfo/python-list

Re: Code for finding the 1000th prime

2009-11-16 Thread sturlamolden
On 15 Nov, 15:30, mrholtsr wrote: > I am absolutely new to python and barely past beginner in programming. > Also I am not a mathematician. Can some one give me pointers for > finding the 1000th. prime for a course I am taking over the internet > on Introduction to Computer Science and Programmin

Re: python gui builders

2009-11-17 Thread sturlamolden
On 17 Nov, 19:34, r wrote: > Agreed! Tkinter (besides myself) seems to be the whipping boy of > c.l.py. Tkinter has it's place in Python because of the same > simplicity people laboriously lament about! Until something else comes > along that can offer the same benefits of Tkinter and a little ex

Re: python gui builders

2009-11-17 Thread sturlamolden
On 18 Nov, 04:21, Dave Cook wrote: > On 2009-11-16, me wrote: > > > Also looked at the frames/forms created with QtDesigner, which > > can be used by Python via pyuic. > > That's what I would recommend.  What did you not like about it? GPL -- http://mail.python.org/mailman/listinfo/python-lis

Re: python simply not scaleable enough for google?

2009-11-18 Thread sturlamolden
On 18 Nov, 00:31, Terry Reedy wrote: > The > problem for the future is the switch to multiple cores for further speedups. The GIL is not a big problem for scientists. Scientists are not so dependent on threads as the Java/webdeveloper crowd: - We are used to running multiple processes with MPI.

Re: python simply not scaleable enough for google?

2009-11-18 Thread sturlamolden
On 18 Nov, 00:24, greg wrote: > NumPy, for example, is *extremely* flexible. Someone put > in the effort, once, to write it and make it fast -- and > now an endless variety of programs can be written very easily > in Python to make use of it. I'm quite sure David Cournapeau knows about NumPy...

Re: python gui builders

2009-11-19 Thread sturlamolden
On 18 Nov, 20:19, Dave Cook wrote: > If it's an issue for your project, I suggest wxPython.  It's > cross-platform, fairly complete, and extensible.  But the API is > clunky compared to Qt. Not if we use wxFormBuilder 3.1. -- http://mail.python.org/mailman/listinfo/python-list

Re: python gui builders

2009-11-20 Thread sturlamolden
On 18 Nov, 23:56, Kevin Walzer wrote: > wxWidgets (the C++ library) has support for a lot of things other than > UI bits, as well. wxPython itself is mainly a GUI library because the > additional features of wxWidgets in C++ are redundant in Python. That is true. Nobody uses wxPython for socket

Re: Writing a Carriage Return in Unicode

2009-11-20 Thread sturlamolden
On 19 Nov, 01:14, Doug wrote: > Thanks for your help!! A carriage return in unicode is u"\r" how this is written as bytes is dependent on the encoder. Don't try to outsmart the UTF-8 codec, it knows how to translate "\r" to UTF-8. Sturla Molden -- http://mail.python.org/mailman/listinfo

Re: python gui builders

2009-11-20 Thread sturlamolden
On 18 Nov, 22:18, David Bolen wrote: > With that said, for various reasons I still prefer wxPython to Qt, and > at the moment, find wxFormBuilder the best fit for my own designs > (even before the direct Python support, just using XRC). Personally I prefer wxFormBuilder over QtDesigner for sizer

Re: python simply not scaleable enough for google?

2009-11-20 Thread sturlamolden
On 20 Nov, 11:12, Robin Becker wrote: > Presumably that means they could potentially run in parallel on the 10 cpu > machines of the future. > > I'm not so clear on whether the threadless tasklets will run on separate cpus. You can make a user-space scheduler and run a 10 tasklets on a t

Re: python simply not scaleable enough for google?

2009-11-20 Thread sturlamolden
On 20 Nov, 22:45, a...@pythoncraft.com (Aahz) wrote: > Are you advocating a high-fiber diet? Only if you are a ruminant. No really... Windows has user-space threads natively. But you must reserve some stack space for them (from virtual memory), which mainly makes them useful on 64 bit systems.

Re: Writing a Carriage Return in Unicode

2009-11-21 Thread sturlamolden
On 21 Nov, 09:12, Steven D'Aprano wrote: > Oh please, that's historical revisionism -- \r\n wasn't invented by > Microsoft. Microsoft didn't "get it right", they simply copied what CP/M > did, on account of the original MS-DOS being essentially a clone of CP/M. Actyually \r\n goes back to early

Re: Writing a Carriage Return in Unicode

2009-11-21 Thread sturlamolden
On 21 Nov, 08:10, Dennis Lee Bieber wrote: >         Of course, if you are describing a /real/ /manual/ typewriter, you > would rapidly discover that the sequence is -- since pushing > the bar would often trigger the line feed before it would slide the > carriage to the right. > >         But on

Re: How do I create a vanilla object in C?

2009-11-22 Thread sturlamolden
On 22 Nov, 04:05, Carl Banks wrote: > name = PyString_FromString("vanilla"); > bases = PyTuple_New(0); > dict = PyDict_New(); > vanilla_type = PyObject_CallObject( >         &PyType_Type,name,bases,dict,0); > > Then call the vanilla type (however you create it) to get a vanilla > object: > > vani

Re: xmlrpc idea for getting around the GIL

2009-11-24 Thread sturlamolden
On 22 Nov, 22:38, Patrick Stinson wrote: > Has anyone every tried wrapping the CPython lib into a daemon with an > RPC mechanism in order to move the GIL out of the process? > I imagine this is how the multiprocessing module works. It does not. -- http://mail.python.org/mailman/listinfo/pyth

Re: xmlrpc idea for getting around the GIL

2009-11-24 Thread sturlamolden
On 23 Nov, 22:02, Patrick Stinson wrote: > What I meant was that I am *not allowed* to make calls to the CPython > API from the threads I currently have because these threads are high > priority and are never allowed to make blocking calls. Fortunately, > each of these threads can have a complete

Re: xmlrpc idea for getting around the GIL

2009-11-24 Thread sturlamolden
On 24 Nov, 12:15, Daniel Fetchinson wrote: > By the way, you might be interested in this thread as well: > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/... It is Windows specific, and it does not work with extension modules. Yes we can embed multiple interpreters just

<    1   2   3   4   5   6   7   8   >