Re: Calling python from C with OpenMP

2016-05-12 Thread Sturla Molden
wrote: > Second and most important question: When I run this code it sometimes > segementation faults, and sometimes some threads run normal and some > other threads says "Cannot call 'do_multiply'". Sometimes I get the > message: Fatal Python error: GC object already tracked. And some times it >

Re: python and matlab

2014-02-06 Thread Sturla Molden
Sam wrote: > is it able to utilize functions written in Python in Matlab? Yes, if you embed the Python interpreter in a MEX-file. -- https://mail.python.org/mailman/listinfo/python-list

Re: python and matlab

2014-02-06 Thread Sturla Molden
Sam Adams wrote: > Thanks Sturla, could you please explain in more details, I am new to Python :) All the information you need to extend or embed Python is in the docs. Apart from that, why do you need Matlab? A distro like Enthought Canopy or Anaconda has all the tools you will ever need for

Re: python and matlab

2014-02-07 Thread Sturla Molden
Rustom Mody wrote: > What Sturla is probably saying is that the matmab-python imp-mismatch is > so high that jumping across is almost certainly not worth the trouble. I am saying that the abundance of Python packages for numerical and scientific computing (NumPy et al.) and their quality is now

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-10 Thread Sturla Molden
Wesley wrote: > [Wesley] This is not homework:-) > And actually I am new to algorithm, so you guys can feel free to say anything > you want In general, we cannot sort a sequence in O(n) time. O(n log n) is the lower bound on the complexity. -- https://mail.python.org/mailman/listinfo/python-l

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-10 Thread Sturla Molden
Chris Angelico wrote: > That's assuming it really is a sort operation. The problem description > isn't entirely clear on this point, but if it's actually a zip, then > it can definitely be done in O(n). Ah, I didn't read it carefully enough. :-) Granted, a zip can be done in O(n) time and O(1)

Re: Python has arrived!

2014-11-06 Thread Sturla Molden
Grant Edwards wrote: > According to > http://www.theregister.co.uk/2014/11/06/hackers_use_gmail_drafts_as_dead_drops_to_control_malware_bots: > > "Attacks occur in two phases. Hackers first infect a targeted >machine via simple malware that installs Python onto the device, >[...]" >

Re: "**" in python

2014-11-23 Thread Sturla Molden
Abdul Abdul wrote: > Wxy**2 > > What do ** mean here? Exponentiation. Same as ** means in Fortran. Sturla -- https://mail.python.org/mailman/listinfo/python-list

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Sturla Molden
Zachary Ware wrote: > On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote: >> Wouldn’t it be neat to write: >> >>foo == 42 or else >> >> and have that be an synonym for: >> >> assert foo == 42 >> >> :-) > > Never going to happen, but I like it! Perhaps raise IntimidationError > instead

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Sturla Molden
Dennis Lee Bieber wrote: >> foo == 42 or else >> > > Has a PERL stink to it... like: foo == 42 or die I think this statement needs to take ellipsis as well foo == 42 or else ... Sturls -- https://mail.python.org/mailman/listinfo/python-list

Re: Python, C++ interaction

2014-12-03 Thread Sturla Molden
Cython is nearly always the answer to scientific computing in Python, including wrapping C++. Sturla Michael Kreim wrote: > Hi, > > we are working on a small scientific program that helps us in developing > and testing of new numerical methods for a certain type of biochemical > problems. I

Re: Python, C++ interaction

2014-12-04 Thread Sturla Molden
Dan Stromberg wrote: > 1) writing in Cython+CPython (as opposed to wrapping C++ with Cython) That is an option, but it locks the code to Cython and CPython forever. C and C++ are at least semi-portable. > 2) using numba+CPython (It's a pretty fast decorator - I've heard it's > faster than Cytho

Re: jitpy - Library to embed PyPy into CPython

2014-12-06 Thread Sturla Molden
Albert-Jan Roskam wrote: > Interesting, but it is not clear to me when you would use jitpy instead > of pypy. Too bad pypy alone was not included in the benchmarks (cython > would have also been nice). And Numba can JIT compile this far better than PyPy and jitpy. Sturla -- https://mail.pytho

Re: Python, C++ interaction

2014-12-07 Thread Sturla Molden
On 05/12/14 23:17, wesleiram...@gmail.com wrote: m'giu vous êtès nom souris, pseudo nom cha'rs out oiu êtès, i'ret egop c'hâse I have not idea what that means, but I am sure it would be interesting if I knew French (or whatever it is). Sturla -- https://mail.python.org/mailman/listinfo/py

Re: Multiprocessing process termination

2014-12-31 Thread Sturla Molden
Why not use a multiuser database server instead of trying to make one? You do not have the resources to a better job on your own. You know where to find Firebird SQL, MariaDB, MySQL, PostegreSQL, IBM DB2, Oracle, etc. Personally I prefer Firebird because like SQLite the database is stored in a fi

Re: Trees

2015-01-20 Thread Sturla Molden
On 20/01/15 01:49, Dan Stromberg wrote: I think probably the most common need for a tree is implementing a cache, That is probably true, at least if you're a squirrel. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python is DOOMED! Again!

2015-01-22 Thread Sturla Molden
Steven D'Aprano wrote: > Remember too that type-hinting will *absolutely* remain *completely* > optional for Python. Developers can choose to use it or not, No! Developers have to do what managers and customers tell them to do. They will start to require type hinting everywhere. And then the qu

Re: Python is DOOMED! Again!

2015-01-22 Thread Sturla Molden
Marko Rauhamaa wrote: > I think the SATAN is in the optional type declarations, not in the > particular syntax chosen. Yes. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python is DOOMED! Again!

2015-01-22 Thread Sturla Molden
Skip Montanaro wrote: > FUD? What evidence do you have that this will be the way things shake out? I don't underestimate the stupidity of those who are not writing the code themselves. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python is DOOMED! Again!

2015-01-22 Thread Sturla Molden
Chris Angelico wrote: > Uhh... if your managers and customers are stipulating non-Pythonic > coding styles, then it's time to find new managers/customers. If > they're not writing the code, code quality shouldn't be their concern. I am saying the day someone requires me to write a type hint, I w

Re: Python is DOOMED! Again!

2015-01-22 Thread Sturla Molden
Mark Lawrence wrote: > If they're too stupid to know the > meaning of the word "hint" that's their problem. It will also be Python's problem, because people are that stupid. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python is DOOMED! Again!

2015-01-22 Thread Sturla Molden
On 22/01/15 20:10, Mario Figueiredo wrote: Customers don't have access to static analysis output and project managers should know better than to demand static analysis without properly contextualize it. I just don't see a project manager having no idea what static analysis means. I don't know

Re: Python is DOOMED! Again!

2015-01-22 Thread Sturla Molden
On 22/01/15 20:43, Skip Montanaro wrote: The way you couched your opinion as a certainty, as if you could see the future, How do you know I cannot? -- https://mail.python.org/mailman/listinfo/python-list

Re: Python is DOOMED! Again!

2015-01-22 Thread Sturla Molden
On 22/01/15 21:03, Mario Figueiredo wrote: That is fine. But then the problem isn't type hinting, is it? Neither I think you are suggesting we don't introduce language because there are bad project managers out there. The problem is then bad project managers. That has nothing to do with type hi

Re: Python is DOOMED! Again!

2015-01-22 Thread Sturla Molden
On 22/01/15 23:08, Ian Kelly wrote: T = TypeVar('T') def adder(a: T, b: T) -> T: return a + b I'm not thrilled about having to actually declare T in this sort of situation, but I don't have a better proposal. Here is a better proposal: def adder(a, b): return a + b Sturla -- h

Re: Python is DOOMED! Again!

2015-01-23 Thread Sturla Molden
On 23/01/15 04:53, Steven D'Aprano wrote: If your manager is so bad, why isn't he insisting that you program in PHP or Java or Algol 68 [insert name of some language you dislike] instead of Python? Is your bad manager forcing you to write Java-style code in Python, or insisting on Hungarian Nota

Re: multiprocessing module backport from 3 to 2.7 - spawn feature

2015-01-30 Thread Sturla Molden
Skip Montanaro wrote: > Can you explain what you see as the difference between "spawn" and "fork" > in this context? Are you using Windows perhaps? I don't know anything > obviously different between the two terms on Unix systems. spawn is fork + exec. Only a handful of POSIX functions are requ

Re: multiprocessing module backport from 3 to 2.7 - spawn feature

2015-01-30 Thread Sturla Molden
Andres Riancho wrote: > Spawn, and I took that from the multiprocessing 3 documentation, will > create a new process without using fork(). > This means that no memory > is shared between the MainProcess and the spawn'ed sub-process created > by multiprocessing. If you memory map a segment with

Re: RAII vs gc (was fortran lib which provide python like data type)

2015-01-30 Thread Sturla Molden
Rustom Mody wrote: > The case of RAII vs gc is hardly conclusive: > > http://stackoverflow.com/questions/228620/garbage-collection-in-c-why The purpose of RAII is not to be an alternative to garbage collection (which the those answers imply), but to ensure deterministc execution of setup and t

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Sturla Molden
Michael Torrie wrote: > Yes I can tell you haven't used C++. Compared to C, I've always found > memory management in C++ to be quite a lot easier. The main reason is > that C++ guarantees objects will be destroyed when going out of scope. > So when designing a class, you put any allocation rout

Re: multiprocessing module backport from 3 to 2.7 - spawn feature

2015-01-30 Thread Sturla Molden
On 30/01/15 23:25, Marko Rauhamaa wrote: Sturla Molden : Only a handful of POSIX functions are required to be "fork safe", i.e. callable on each side of a fork without an exec. That is a pretty surprising statement. Forking without an exec is a routine way to do multiproc

Re: Monte Carlo probability calculation in Python

2015-02-07 Thread Sturla Molden
Paul Moore wrote: > > Yes. And a number of other variations. None gave anything that seemed to > relate. It's quite likely though that I'm simply not understanding how > things like pymc (which came up in the searches) might help me, or how to > convert my problem into a Monte Carlo integration

Re: Python discussed in Nature

2015-02-13 Thread Sturla Molden
On 12/02/15 15:39, Marko Rauhamaa wrote: I write both Py2 and Py3 code, but I keep the two worlds hermetically separated from each other. In SciPy world we run the same code on Python 2 and Python 3. Sturla -- https://mail.python.org/mailman/listinfo/python-list

Re: Bug in timsort!?

2015-02-25 Thread Sturla Molden
On 24/02/15 22:34, Roy Smith wrote: http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/ This is awful. It is broken for arrays longer than 2**49 elements. With 8 bytes per PyObject* pointer this is >4096 terabytes of RAM. I don't see how

Re: Bug in timsort!?

2015-02-25 Thread Sturla Molden
On 25/02/15 15:33, Chris Angelico wrote: It's even worse than that. Unless you have a list of 2**49 references to the same few objects, you're going to need to have some actual content for each one. The absolute best you could do is to sort integers, which would take 32 bytes each [1]; if you're

Re: Bug in timsort!?

2015-02-25 Thread Sturla Molden
On 25/02/15 17:04, Peter Otten wrote: These guys found a bug that is subtler than what most of us have dealt with in a widely used piece of code originally developed by one of the smarter members of the python "community". I bow my head to them and say thank you. I am not joking about that. I

Re: Bug in timsort!?

2015-02-25 Thread Sturla Molden
On 25/02/15 18:22, Mario Figueiredo wrote: And also presented a solution. Which also was incorrect :-D But now Benjamin Peterson has finally fixed it, it appears: http://bugs.python.org/issue23515 Sturla -- https://mail.python.org/mailman/listinfo/python-list

Re: which async framework?

2014-03-11 Thread Sturla Molden
Chris Withers wrote: > Hi All, > > I see python now has a plethora of async frameworks and I need to try > and pick one to use from: > > - asyncio/tulip > - tornado > - twisted Looking at Tornado's examples on the web I find this: tornado.ioloop.IOLoop.instance().start() This single line

Re: which async framework?

2014-03-11 Thread Sturla Molden
Chris Withers wrote: > Hi All, > > I see python now has a plethora of async frameworks and I need to try > and pick one to use from: > > - asyncio/tulip > - tornado > - twisted I'd go for using iocp, epoll and kqueue/kevent directly. Why bother to learn a framework? You will find epoll and kqu

Re: which async framework?

2014-03-11 Thread Sturla Molden
Marko Rauhamaa wrote: > Now, I've taken a brief look at the new asyncio and it looks as if it > has everything one would hope for (and then some). You'd still need to > supply the protocol implementations yourself. Tulip (the new async module) is nice. But I am a bit confused as to how it combin

Re: which async framework?

2014-03-11 Thread Sturla Molden
Antoine Pitrou wrote: > Yes, why use a library when you can rewrite it all yourself? This assumes something equivalent to the library will have to be written. But if it can be replaced with something very minimalistic it is just bloat. I would also like to respond that the select module and pywi

Re: which async framework?

2014-03-11 Thread Sturla Molden
Antoine Pitrou wrote: > This is the usual assumption that high-level libraries are made of useless > cruft piled up by careless programmers. It often is the case, particularly in network programming. But in this case the programmer is Guido, so it doesn't apply. :) > What irks me with your r

Re: Examples of modern GUI python programms

2014-03-31 Thread Sturla Molden
Metallicow wrote: > My opinion would be wxPython if not actually using for a mobile, or > PySide if you are. Both of these have acceptable licenses if you want to > go commercial also without having to pay for commercial library usage. If you are to distribute a program using LGPL software on A

Re: Examples of modern GUI python programms

2014-03-31 Thread Sturla Molden
Metallicow wrote: > One would have to tool through the PySide agreement for their specifics, > but as I recall it is exactly the same as Qt is, which makes sense. According to their web page, PySide is only LGPL. Qt is LGPL or commercial. > Just because a library is LGPL doesn't mean the auth

Re: Line of best fit

2014-03-31 Thread Sturla Molden
Roy Smith wrote: > Please tell us more about the environment you're working in. I'm > guessing from the fact that you're calling plt.plot(), that you've > already got some add-on modules loaded. Pandas, maybe? Probably matplotlib.pyplot -- https://mail.python.org/mailman/listinfo/python-li

Re: Examples of modern GUI python programms

2014-04-03 Thread Sturla Molden
Wolfgang Keller wrote: >> Id like to ask.. do you know any modern looking GUI examples of > Judging from the example screenshots on their website, Kivy might be > adequate. If you want to build something from scratch, libSDL is excellent and free (zlib license). Official supported platforms are:

Re: Examples of modern GUI python programms

2014-04-03 Thread Sturla Molden
Wolfgang Keller wrote: > Judging from the example screenshots on their website, Kivy might be > adequate. Kivy depends on PyGame which is GPL, and can only be used to build GPL software. -- https://mail.python.org/mailman/listinfo/python-list

Re: Examples of modern GUI python programms

2014-04-03 Thread Sturla Molden
On 03/04/14 16:02, Robert Kern wrote: Kivy depends on PyGame which is GPL, and can only be used to build GPL software. It is not. http://www.pygame.org/LGPL Their web paged says GPL, but I assume that is an error. Is Python allowed on iOS anyway? Apple used to ban any code not written in

Re: Examples of modern GUI python programms

2014-04-03 Thread Sturla Molden
Chris Angelico wrote: > Where? I can't see it. The home page redirects me to /news.html which > doesn't say anything about GPL (other than in its collection of tags, > which seem to be for finding other people's projects - that is, > clicking that link takes you to a list of all pygame-using proj

Re: Python streaming media server

2014-04-05 Thread Sturla Molden
Wesley wrote: > Anyone knows open source streaming media server written by Python? > > I am trying to setup a streaming media server in python, wanna find an > existing one and have a look. Not open source, but there is a famous closed-source one called YouTube. -- https://mail.python.org/m

Re: Python streaming media server

2014-04-06 Thread Sturla Molden
Wesley wrote: >> Not open source, but there is a famous closed-source one called YouTube. > > Are you kidding? > I know youtube, but do you think we can use it setup our own streaming media > server? Obviously not. Before YouTube was bought by Google, it was common knowledge that it ran on S

Re: threading

2014-04-07 Thread Sturla Molden
Dennis Lee Bieber wrote: > That's been my experience too... Threading works for me... My attempts > at so called asyncio (whatever language) have always led to my having to > worry about losing data if some handler takes too long to return. > > To me, asyncio is closer to a polling

Re: threading

2014-04-08 Thread Sturla Molden
Marko Rauhamaa wrote: > The main problems with threads include: > > * Thread-safety is rarely done right. Also, when it's done wrong, it >can be virtually impossible to fix it without a significant rewrite. >This is not a theoretical concern: I have had to deal with the >resulting n

Re: threading

2014-04-08 Thread Sturla Molden
alister wrote: > As my only professional coding experience has been with embedded 8 bit > processors with limited resources i naturally abhorrent to the process of > "Just throw more RAM (Or any other resource for that matter)at it". I understand. I do not advocate threads for parallel i/o on

Re: threading

2014-04-08 Thread Sturla Molden
Roy Smith wrote: > Let's say I've got a program which consumes 60 GB of RAM, so I'm renting > the 2xlarge instance to run it. My software architect could recode the > program to be more efficient, and fit into just 30 GB, saving me > $3000/year. How much of his time is it worth to do that?

Re: threading

2014-04-08 Thread Sturla Molden
Roy Smith wrote: > Thread 1 and Thread 2 use a pair of queues to communicate. T1 sends > work to T2 using Q1, and T2 sends back results using Q2. > > T1 pushes Item1 onto Q1, and waits for Result1 to come back on Q2. > > T2 reads Item1 from its end of Q1, and waits to read Item2, which it >

Re: threading

2014-04-08 Thread Sturla Molden
alister wrote: > My main point was that when you have only 8K of ROM & 128 byte of ram you > have to think about your algorithms first. And that also happens if you have a 32 bit system, with just 2 GB of memory available to user space (the operating system reserves the upper half of the 4 GB a

Re: threading

2014-04-08 Thread Sturla Molden
Marko Rauhamaa wrote: > Queues are fine if you hermetically insulate your objects. IOW, you > group your objects in single-threaded pseudoprocesses that don't make > any direct method calls to each other. If you do that, you might as well > use real processes. That way, you can even naturally enf

Re: threading

2014-04-08 Thread Sturla Molden
Paul Rubin wrote: > Sturla Molden writes: >> When should we use C++ or Fortran instead of Python? Ever? > > When performance matters? Sometimes, but usually performance only matters in certain types of calculations like matrix algebra or FFTs. But we always use specialized lib

Re: threading

2014-04-08 Thread Sturla Molden
On 07/04/14 05:56, Chris Angelico wrote: On Mon, Apr 7, 2014 at 1:48 PM, Roy Smith wrote: There is (or at least, was) another reason. Creating a new process used to be far more expensive than creating a new thread. In modern Unix kernels, however, the cost difference has become much less, so

Re: threading

2014-04-08 Thread Sturla Molden
On 08/04/14 22:30, Grant Edwards wrote: Unix maybe, but what about Windows? Is it efficient to create processes under Windows? Processes are very heavy-weight on Windows. Not surprising given its VMS heritage. I remember running shell scripts under VMS on a VAX-11/780 that took hours to do

Re: threading

2014-04-09 Thread Sturla Molden
"Frank Millman" wrote: > If I have understood correctly, then is there any benefit at all in my going > async? I might as well just stick with threads for the request handling as > well as the database handling. 1. There is a scalability issue with threads, particularly if you don't have enoug

Re: threading

2014-04-09 Thread Sturla Molden
Sturla Molden wrote: > 3. It is nice to be able to abort a read or write that hangs (for whatever > reason). Killing a thread with pthread_cancel or TerminateThread is not > recommended. While "graceful timeout" is easy to do on Unix, using fcntl.fcntl or signal.alarm, on

Re: threading

2014-04-09 Thread Sturla Molden
Chris Angelico wrote: > People with a fear of threaded programming almost certainly never grew > up on OS/2. :) I learned about GUI programming thus: Write your > synchronous message handler to guarantee that it will return in an > absolute maximum of 0.1s, preferably a lot less. If you have any

Re: threading

2014-04-10 Thread Sturla Molden
Marko Rauhamaa wrote: > Other points: > > * When you wake up from select() (or poll(), epoll()), you should treat >it as a hint. The I/O call (accept()) could still raise >socket.error(EAGAIN). > > * The connections returned from accept() have to be individually >registered with s

Re: threading

2014-04-10 Thread Sturla Molden
On 10/04/14 21:44, Marko Rauhamaa wrote: I'm happy that asyncio is happening after all these long years. It would be nice if it supported edge-triggered wakeups, but I suppose that isn't supported in all operating systems. I have an issue with the use of coroutines. I think they are to evil. W

Re: threading

2014-04-10 Thread Sturla Molden
On 11/04/14 01:51, Sturla Molden wrote: I have an issue with the use of coroutines. I think they are to evil. When a man like David Beazley says this https://twitter.com/dabeaz/status/440214755764994048 there is something crazy going on. And why did Python get this Tulip beast, instead

Re: python obfuscate

2014-04-11 Thread Sturla Molden
Ian Kelly wrote: > The only reliable way to prevent a customer from reverse-engineering > your software is to not give them the software. Not really. You just need to make it so difficult that it is not worth the effort. In that case they will go away and do something else instead. At least if

Re: python obfuscate

2014-04-11 Thread Sturla Molden
Wesley wrote: > Does python has any good obfuscate? > > Currently our company wanna release one product developed by python to > our customer. But dont's wanna others see the py code. > > I googled for a while but mostly just say using pyc. Any better one? It depends on the threat and how co

Re: python obfuscate

2014-04-11 Thread Sturla Molden
Joshua Landau wrote: > However, if this really is your major blocker to using Python, I > suggest compiling with Cython. Cython restains all the code as text, e.g. to readable generate exceptions. Users can also still steal the extension modules and use them in their own code. In general, Cython

Re: threading

2014-04-11 Thread Sturla Molden
Steven D'Aprano wrote: >> I have an issue with the use of coroutines. I think they are to evil. > > They are to evil ... as what? To evil as chalk is to cheese? Black is to > white? Bees are to honey? I think coroutines are one of those things that don't fit the human mind. A class with a co

Re: python obfuscate

2014-04-11 Thread Sturla Molden
Ian Kelly wrote: > How is that last statement different from the one I made above, that > you disagreed with? Who says I disagreed? But to answer you question, it depends on the level of safety you need: Total secrecy or just enough protection to make it not worthwhile to access the code? St

Re: python obfuscate

2014-04-11 Thread Sturla Molden
wrote: >> It's worth noting, as an aside, that this does NOT mean you don't >> produce or sell anything. You can keep your code secure by running it >> on a server and permitting users to access it; that's perfectly safe. >> > Perfectly? :-) Unless you have a heartbleed :) Sturla -- https:/

Re: python obfuscate

2014-04-11 Thread Sturla Molden
alister wrote: > Concentrate on making the product (even) better rather than trying to > hide the unhideable. I think the number one reason for code obfuscation is an ignorant boss. Another reason might be to avoid the shame of showing crappy code to the customer. Sturla -- https://mail.p

Re: python obfuscate

2014-04-11 Thread Sturla Molden
Mark H Harris wrote: > This is the age of open source in computer science. > > It is far better to develop a strategy and culture of openness. > Everyone benefits; especially your customers. I recommend the GPLv3 > license. I also advocate for copyleft. I would not use GPL in a comme

Re: python obfuscate

2014-04-11 Thread Sturla Molden
Mark H Harris wrote: > Obfuscation (hiding) of your source is *bad*, usually done for one > of the following reasons: > 1) Boss is paranoid and fears loss of revenues due to intellectual > property theft. > 2) Boss is ignorant of reverse engineering strategies available to > folks

Re: python obfuscate

2014-04-12 Thread Sturla Molden
CM wrote: > You're saying that fear of patent trolls is yet another bad reason to > obfuscate your code? But then it almost sounds like you think it is a > justifiable reason. So I don't think I understand your point. Whether a > patent troll has your original code or not has no bearing on t

Re: What is the difference between 32 and 64 bit Python on Windows 7 64 bit?

2014-05-12 Thread Sturla Molden
On 11/05/14 08:56, Ross Gayler wrote: It looks to me as though 32 and 64 bit versions of Python on 64 bit Windows are both really 32 bit Python, differing only in how they interact with Windows. No! Pointers are 64 bit, Python integers (on Python 2.x) are 32 bit. Microsoft decided to use a 32

Re: NumPy, SciPy, & Python 3X Installation/compatibility issues

2014-05-12 Thread Sturla Molden
wrote: > 4.In the long run, would it be better to use UNIX instead of Windows, if > I were to use Python for all of my research? > Thanks in advance. EK For scientific computing, a UNIX or Linux system is clearly preferable. Most of the scientific computing software is built around the UNIX

Re: What is the difference between 32 and 64 bit Python on Windows 7 64 bit?

2014-05-12 Thread Sturla Molden
On 12/05/14 15:42, Sturla Molden wrote: - A one-dimensional NumPy array with dtype np.float64 can keep 16 GB of data before a 32 bit index is too small and Python starts to use long. A two-dimensional NumPy array with dtype np.float64 can keep 256 GB of data before a 32 bit index is too small

Re: What is the difference between 32 and 64 bit Python on Windows 7 64 bit?

2014-05-12 Thread Sturla Molden
On 11/05/14 08:56, Ross Gayler wrote: Is that true?I have spent a couple of hours searching for a definitive description of the difference between the 32 and 64 bit versions of Python for Windows and haven't found anything. Why do you care if a Python int object uses 32 or 64 bits internally?

Re: What is the difference between 32 and 64 bit Python on Windows 7 64 bit?

2014-05-12 Thread Sturla Molden
On 13/05/14 02:09, Chris Angelico wrote: Sometimes you just want to confirm. :) Or maybe you want your program to be able to detect which it's on. There are ways of doing both, but sys.maxint isn't one of them, as it's specific to the int->long promotion of Py2. The OPs main mistake, I guess,

Re: Using threads for audio computing?

2014-05-14 Thread Sturla Molden
On 12/05/14 07:33, lgabiot wrote: But AFAIK the python GIL (and in smaller or older computers that have only one core) does not permit true paralell execution of two threads. I believe it is quite like the way multiple processes are handled by an OS on a single CPU computer: process A has x CPU

Re: Fortran

2014-05-14 Thread Sturla Molden
Ian Kelly wrote: > Also numba, which is reminiscent of psyco, but with more features and > Python 3 support. For numerical computing with NumPy, Numba tends to give performance comparable to -O2 in C. This is because it is very easy to do type inference in most scientific array computing. Numba

OT: This Swift thing

2014-06-03 Thread Sturla Molden
Dear Apple, Why should I be exited about an illegitmate child of Python, Go and JavaScript? Because it has curly brackets, no sane exception handling, and sucks less than Objective-C? Because init is spelled without double underscores? Because it faster than Python? Computers and smart phones

Re: OT: This Swift thing

2014-06-03 Thread Sturla Molden
Nicholas Cole wrote: > Of course, I wish they had picked Python rather than inventing their > own language. But Apple put a huge stock in the ability of their > libraries to make full use of multiple cores. The GIL is not relevant if they stick to the Objective-C runtime and LLVM. > The GIL

Re: OT: This Swift thing

2014-06-03 Thread Sturla Molden
On 04/06/14 01:39, Kevin Walzer wrote: On 6/3/14, 4:43 PM, Sturla Molden wrote: Are Python apps still banned from AppStore, even if we bundle an interpreter? Python apps are not banned from the App Store. See https://itunes.apple.com/us/app/quickwho/id419483981?mt=12. Mac AppStore yes, iOS

Re: Parallelization of Python on GPU?

2015-02-26 Thread Sturla Molden
If you are doing SVM regression with scikit-learn you are using libSVM. There is a CUDA accelerated version of this C library here: http://mklab.iti.gr/project/GPU-LIBSVM You can presumably reuse the wrapping code from scikit-learn. Sturla John Ladasky wrote: > I've been working with machine l

Re: Parallelization of Python on GPU?

2015-02-26 Thread Sturla Molden
GPU computing is great if you have the following: 1. Your data structures are arrays floating point numbers. 2. You have a data-parallel problem. 3. You are happy with single precision. 4. You have time to code erything in CUDA or OpenCL. 5. You have enough video RAM to store your data. For Pytho

Re: Parallelization of Python on GPU?

2015-02-26 Thread Sturla Molden
On 26/02/15 18:34, John Ladasky wrote: Hi Sturla, I recognize your name from the scikit-learn mailing list. If you look a few posts above yours in this thread, I am aware of gpu-libsvm. I don't know if I'm up to the task of reusing the scikit-learn wrapping code, but I am giving that option

Re: Parallelization of Python on GPU?

2015-02-26 Thread Sturla Molden
On 26/02/15 18:48, Jason Swails wrote: On Thu, 2015-02-26 at 16:53 +, Sturla Molden wrote: GPU computing is great if you have the following: 1. Your data structures are arrays floating point numbers. It actually works equally great, if not better, for integers. Right, but not

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-02 Thread Sturla Molden
Steven D'Aprano wrote: > Variations in idiom and spelling are a good thing. They open our minds to > new possibilities, remind us that we aren't all the same, and keep life > fresh. I remember the first time I realised that when Indians talk about "a > code" they aren't using "wrong English", the

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-03 Thread Sturla Molden
Mark Lawrence wrote: >> I can assure you that in a veterinary sence, Yersey cows will produce a >> milk with higher fat content. > > Yersey? Eh, Jersey. -- https://mail.python.org/mailman/listinfo/python-list

Re: Lockfile hanling

2015-04-01 Thread Sturla Molden
Ian Kelly wrote: > As long as there's not *also* some other external process that needs > to access the file occasionally. :-) Then there is multiprocessing.Lock :) -- https://mail.python.org/mailman/listinfo/python-list

Re: No ttk in 2.7

2015-05-21 Thread Sturla Molden
Zachary Ware wrote: > The way I would do it is as follows: > >try: >import tkinter as tk >from tkinter import ttk >except ImportError: >import Tkinter as tk >import ttk > > If I may suggest, just write it in Python3 first, then when it does > what you wan

Re: Question About Image Processing in Python

2015-05-28 Thread Sturla Molden
Serge Christian Ibala wrote: > Or what is the recommendation of Python for image processing? Basic setup everyone should have: Python NumPy SciPy (e.g. scipy.ndimage) Cython C and C++ compiler matplotlib scikit-image scikit-learn pillow Also consider: mahotas tifffile (by Christoph Gohlke) Ope

Re: Hi. I have questions about Python

2015-05-28 Thread Sturla Molden
이현상 wrote: > Hi.Please note that do not speak english well. > Do you know Python 2 vs Python3 MultiProcessing the difference > ?Multiprocessing is better performance? The main difference is that multiprocessing on Python 3.4 (and later) will allow you to use APIs that are not "forksafe" on Linux

Re: What is considered an "advanced" topic in Python?

2015-05-30 Thread Sturla Molden
Mike Driscoll wrote: > Hi, > > I've been asked on several occasions to write about intermediate or > advanced topics in Python and I was wondering what the community > considers to be "intermediate" or "advanced". I realize we're all growing > in our abilities with the language, so this is going

Re: Python Random vs. Cython C Rand for Dice Rolls

2015-06-08 Thread Sturla Molden
On 08/06/15 19:33, Laura Creighton wrote: Better C random number generator. http://www.pcg-random.org/download.html Or for something less minimalistic, just grab randomkit.c and randomkit.h from NumPy, which implements the same Mersenne Twister as Python. That is what I usually do to get fas

Re: Should iPython Notebook replace Idle

2015-07-04 Thread Sturla Molden
Jason Swails wrote: > Everything gets swallowed into Python. I can't imagine this ever happening. IPython's successor Jupyter is also an REPL environment for Julia and R, and many other languages will also be supported (e.g. Java and C++). Having this swallowed into Python is probably never go

  1   2   >