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: 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

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: 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: 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: 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: 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: 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: (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: (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: 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: 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
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
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: 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: 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 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 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: 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: 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: 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: [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: 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: 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: 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: 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: 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-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 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 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
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
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
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
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
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: 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: 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: 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: 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-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: 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: 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: 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: "**" 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: 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: "High water" Memory fragmentation still a thing?

2014-10-04 Thread Sturla Molden
Steven D'Aprano wrote: > [Aside: The thing that people fail to understand is that the GIL is not in > fact something which *prevents* multi-tasking, but it *enables* cooperative > multi-tasking: > > http://www.dabeaz.com/python/GIL.pdf > > although that's not to say that there aren't some horri

Re: Obscuring Python source from end users

2014-09-29 Thread Sturla Molden
Chris Angelico wrote: >> I have a project that involves distributing Python code to users in an >> organisation. Users do not interact directly with the Python code; they >> only know this project as an Excel add-in. >> >> Now, internal audit takes exception in some cases if users are able to >>

Re: Obscuring Python source from end users

2014-09-29 Thread Sturla Molden
Steven D'Aprano wrote: > Another possibility is to distribute your modules inside a zip file. See > here: > > https://mail.python.org/pipermail/python-list/2014-July/675506.html > > Such zip files are not just runnable, but also importable. Depending on your > Excel requirements, you might need

Re: Windows Studio 2008 Download

2014-07-28 Thread Sturla Molden
Irmen de Jong wrote: > I haven't tried this, but installing the SDK should allow you to build > extensions as > well for that particular Python build. Be sure to get the SDK that belongs to > vs2008, > which is this one if I'm not mistaken: > > http://www.microsoft.com/en-us/download/details.a

Re: Windows Studio 2008 Download

2014-07-28 Thread Sturla Molden
You can download the Windows SDK for .NET 3.5, but it is very old. A better option is to use GCC. The "static mingw toolchain" (gcc 4.8.2 based) created for building the official NumPy and SciPy binary installers should be rather safe: https://github.com/numpy/numpy/wiki/Mingw-static-toolchain S

Re: .Net Like Gui Builder for Python?

2014-07-28 Thread Sturla Molden
Michael Torrie wrote: > Pages '09 was the last good version. The latest version is rubbish. > Lots of removed features, crappy ui. I think they took the stripped > down ipad version and tried to make the new desktop version. I think Apple has realized the mistake, because Pages is gradually im

Re: .Net Like Gui Builder for Python?

2014-07-28 Thread Sturla Molden
Kevin Walzer wrote: > I'm not sure which GUI framework you use, but Tkinter is so simple to > code in directly that you don't really need a UI builder. Give that a try. This is always true for GUI toolkits which use layout managers. A sketchpad is much more useful. If you can quickly sketch ut

Re: .Net Like Gui Builder for Python?

2014-07-27 Thread Sturla Molden
Chris “Kwpolska” Warrick wrote: > And Publisher could work out for a home user, except Word can do the > same, equally well (at least for a home user). Why would they play > with a more complicated program, when they have a good enough thing in > Word? Actually, Apple Pages is much better for t

Re: .Net Like Gui Builder for Python?

2014-07-26 Thread Sturla Molden
Martin S wrote: > Also if you look at any newbie programmer software, it's flawed. But it > wouldn't hurt making it easier creating flawed software. Better than less > software (unless it it's malware) Malware is rarely flawed. I wish it were, though. -- https://mail.python.org/mailman/listinf

Re: problem on multi-threading

2014-07-25 Thread Sturla Molden
"水静流深" <1248283...@qq.com> wrote: > name=['60', '01', '600319', '600531','600661', '600983', '600202', > '600149'] > x=webdata(name) > x.run()‍ > > never quit from the thread ,why? Call .start() instead of .run() -- https://mail.python.org/mailman/listinfo/python-list

Re: .Net Like Gui Builder for Python?

2014-07-25 Thread Sturla Molden
Orochi wrote: > I tried PyQt Designer' and 'Glade', No doubt its great but it created only > interface. > I have to code all the things in separate file. That's what you should do. Keep autogenerated and hand-written code separate. Also take a look at wxFormBuilder. > what I was searching fo

Re: Exploring Python for next desktop GUI Project

2014-07-25 Thread Sturla Molden
Zachary Ware wrote: > How so? Like any other facet of programming, using Tk(inter) has it's > frustrations, but for the most part it has always worked as expected > for me. Granted, I haven't done anything terribly fancy. In my experience, tkinter and ttk is fine until you need to do something

Re: OT: usenet reader software

2014-07-23 Thread Sturla Molden
Monte Milanuk wrote: > Aaaannnd here we have a good example of why it would be really nice to > be able to filter/score based on the message *body*, not just the > headers. 8( Actually, here we have the reason why Usenet died. -- https://mail.python.org/mailman/listinfo/python-list

Re: OT: usenet reader software

2014-07-19 Thread Sturla Molden
wrote: > That doesn't address the problem at all! :-) You still need a news > reader. The problem was that Thunderbird does not support killfiles when used as a newsreader. Leafnode adds filtering capabilities which Thunderbird (supposedly) does not have. Sturla -- https://mail.python.org/ma

Re: OT: usenet reader software

2014-07-19 Thread Sturla Molden
Martin S wrote: > Is there a point to still use Usenet? Last time I checked noise > overwhelmed signal by a factor of something close to 542. news.gmane.org can be a convinient way to read mailing lists instead of getting tons of mail. Sturla -- https://mail.python.org/mailman/listinfo/python-

Re: OT: usenet reader software

2014-07-18 Thread Sturla Molden
memilanuk wrote: > Used leafnode way back when... correct me if I'm wrong, but if memory > serves its a small news spool /server, not really a client/reader type > application. Used to be popular back before slrnpull came about. Leafnode is an NNTP proxy server. It allows you to filter messag

Re: OT: usenet reader software

2014-07-18 Thread Sturla Molden
> Guess where I'm going with this is... is there anything out there worth > trying - on Linux - that I'm missing? leafnode -- https://mail.python.org/mailman/listinfo/python-list

Re: patch request for os.urandom()

2014-07-17 Thread Sturla Molden
On 17/07/14 20:34, Paul Rubin wrote: Could os.urandom() be patched to use the new Linux getrandom() system call on systems where it is available? /dev/urandom exists on other Unix-like systems as well. Right now os.urandom only uses special system calls on Windows. Sturla -- https://mail.

Re: how to check if a value is a floating point or not

2014-06-20 Thread Sturla Molden
Nicholas Cannon wrote: > Guys i am only a beginner at python most of the stuff you are saying i > need to do i dont understand. Then listen and try to learn :-) In C it is customary to do all sorts of sanity checks in advance. Validating user input is an example. We can call this "to ask permis

Re: how to check if a value is a floating point or not

2014-06-19 Thread Sturla Molden
wrote: > I am making a calculator and i need it to support floating point values > but i am using the function isnumeric to check if the user has entered an > int value. I need the same for floating point types so i could implement > an or in the if statement that checks the values the user has en

Re: Interfacing Fortran applications

2014-06-09 Thread Sturla Molden
On 09/06/14 14:24, Michael Welle wrote: >> If you are to rewrite the Fortran app you can just as well use f2py from >> NumPy. > a rewrite of the application isn't possible. That would require > knowledge about what the used algorithms are, why they are implemented > as they are, that would require

Re: Interfacing Fortran applications

2014-06-09 Thread Sturla Molden
Michael Welle wrote: > I thought about equipping the Fortran application with sockets, so that > I can send input data and commands (which is now done via cmd line) and > reading output data back. Any opinions on this? Best pratices? If you are to rewrite the Fortran app you can just as well u

Re: OT: This Swift thing

2014-06-08 Thread Sturla Molden
Chris Angelico wrote: >>> Kurdt: I wouldn't disturb the fan controller. >>> Kurdt: Ever seen an AMD without a fan? ;) >>> Leshrak: heh, yeah >>> Leshrak: actually. it's not a pretty smell >>> Kurdt: Especially when it's overclocked. It goes FT in under two >>> seconds. >>> >>> I think that

Re: OT: This Swift thing

2014-06-08 Thread Sturla Molden
Chris Angelico wrote: > Kurdt: I wouldn't disturb the fan controller. > Kurdt: Ever seen an AMD without a fan? ;) > Leshrak: heh, yeah > Leshrak: actually. it's not a pretty smell > Kurdt: Especially when it's overclocked. It goes FT in under two seconds. > > I think that's about right. On

Re: OT: This Swift thing

2014-06-06 Thread Sturla Molden
Alain Ketterlin wrote: >> When is static analysis actually needed and for what purpose? > > For example WCET analysis (where predictability is more important than > performance). Or code with strong security constraint. Or overflow > detection tools. Or race condition analyzers. And there are ma

Re: OT: This Swift thing

2014-06-06 Thread Sturla Molden
Alain Ketterlin wrote: > Sturla Molden writes: > >> Alain Ketterlin wrote: >> >>> Many of these students suggest Python as the >>> development language (they learned it and liked it), and the suggestion >>> is (almost) always rejected, in favor of

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
On 06/06/14 02:13, Roy Smith wrote: > Well, you *can* play evil games with the struct module :-) But then you are asking for it, it does not happen by accident. Sturla -- https://mail.python.org/mailman/listinfo/python-list

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
On 06/06/14 01:41, Mark Lawrence wrote: > s/almost// :) Sometimes it is the right decision, like when your code is firmware for some avionics or medial life-support apparatus. Sturla -- https://mail.python.org/mailman/listinfo/python-list

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
On 05/06/14 22:27, Alain Ketterlin wrote: > I have seen dozens of projects where Python was dismissed because of the > lack of static typing, and the lack of static analysis tools. If you are worried your code will bring down the next Ariane launch, I can understand this argument. If you are onl

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
Alain Ketterlin wrote: > Many of these students suggest Python as the > development language (they learned it and liked it), and the suggestion > is (almost) always rejected, in favor of Java or C# or C/C++. And it was almost always the wrong decision... Sturla -- https://mail.python.org/mail

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
Chris Angelico wrote: > "Type safety" means many different things to different people. What > Python has is untyped variables, and hierarchically typed objects. > It's impossible to accidentally treat an integer as a float, and have > junk data [1]. It's impossible to accidentally call a base cla

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
Alain Ketterlin wrote: >> Perhaps. Python has strong type safety. > > Come on. You cannot spoof the type of an object in Python. In C++ you can downcast any address to void* and make an object be treated as anything. You cannot make Python treat an int as a float and return garbage. Types in Py

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
Alain Ketterlin wrote: >> And that's counting only CPU time. If you count wall time, your >> typical Python program spends most of its time deep inside kernel API >> calls, waiting for the user or I/O or something. > > But this is true of any IO-bound program, whatever the language. Exactly, th

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
On 05/06/14 16:33, Michael Torrie wrote: > In any case I'm a bit surprised by people comparing Python to Swift at > all, implying that Python would have worked just as well and Apple > should have chosen it to replace Objective C. Because if you look at the spec, Swift is essentially a staticall

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
On 05/06/14 10:14, Alain Ketterlin wrote: > Type safety. Perhaps. Python has strong type safety. It is easier to spoof a type in C or C++ than Python. Python 3 also has type annotations that can be used to ensure the types are correct when we run tests. In a world of consenting adults I am n

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: 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

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: 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

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: 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: 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 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: 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 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: 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: 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-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
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
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
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: 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
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: 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
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

  1   2   >