Re: Python 3.5.1 C API, the global available available is not destroyed when delete the module

2016-09-19 Thread dl l
Hi Steven, Thanks for reply. I logged bug https://bugs.python.org/issue28202. I added more info in this bug :). Yes, it's a workaround to set the global variables to None. But My app just provide a framework for my customers to run python scripts. That's means the workaround requires my customer

Re: Cython taking more time than regular Python

2016-09-19 Thread Arshpreet Singh
On Tuesday, 20 September 2016 11:00:40 UTC+5:30, Stefan Behnel wrote: > > In [8]: %timeit omega(10) > > 1 loops, best of 3: 91.6 µs per loop > > Note that this is the worst benchmark ever. Any non-dump C compiler will > happily apply Young Gauß and calculate the result in constant time.

Re: Python 3.5.1 C API, the global available available is not destroyed when delete the module

2016-09-19 Thread Steven D'Aprano
On Monday 19 September 2016 16:47, dl l wrote: > Hi, > > I have a app loading python35.dll. Use python API PyImport_AddModule > to run a py file. And use PyDict_DelItemString to delete the module. > There is a global vailable in the py file. The global variable is not > destroyed when calling PyD

Re: Cython taking more time than regular Python

2016-09-19 Thread Stefan Behnel
Peter Otten schrieb am 19.09.2016 um 14:55: > In [7]: %%cython > def omega(int n): > cdef long i > cdef long result = 0 > for i in range(n): result += i > return result >...: > > In [8]: %timeit omega(10) > 1 loops, best of 3: 91.6 µs per loop Note that this is the wo

Re: Looking for tips and gotchas for working with Python 3.5 zipapp feature

2016-09-19 Thread Malcolm Greene
Hi Paul, WOW!:) I really appreciate the detailed response. You answered all my questions. I'm looking forward to testing out your pylaunch wrapper. Thank you very much! Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.5.1 C API, the global available available is not destroyed when delete the module

2016-09-19 Thread dl l
Thanks for the replay. I run this script as __main__ module, this module is removed from sys.modules, and the ref count becomes 0. 2016-09-20 0:00 GMT+08:00 Chris Angelico : > On Mon, Sep 19, 2016 at 4:47 PM, dl l wrote: > > I have a app loading python35.dll. Use python API PyImport_AddModule >

Re: how to automate java application in window using python

2016-09-19 Thread meInvent bbird
Hi Matt Wheeler, can it contorl Maplesoft's maple which is a java executable file? On Sunday, September 18, 2016 at 5:02:15 PM UTC+8, Matt Wheeler wrote: > On Thu, 15 Sep 2016, 08:12 meInvent bbird, wrote: > > > how to automate java application in window using python > > > > 1. scroll up or do

Re: how to automate java application in window using python

2016-09-19 Thread Ned Batchelder
On Monday, September 19, 2016 at 4:24:31 PM UTC-4, Lawrence D’Oliveiro wrote: > On Monday, September 19, 2016 at 11:29:24 AM UTC+12, Ned Batchelder wrote: > > > > On Sunday, September 18, 2016 at 6:45:32 PM UTC-4, Lawrence D’Oliveiro > > wrote: > >> > >> A CLI gives the user power over the compute

Re: How to install Python.h on FreeBSD 10.3-RELEASE?

2016-09-19 Thread The Doctor
In article <201609...@crcomp.net>, Don Kuenz wrote: > >In article you wrote: >> In article <201609...@crcomp.net>, Don Kuenz wrote: >>> >>>The installed python packages are shown below. Searches lead me to >>>believe that a PTH option make play a role. >>> >>>--

Re: Another å, ä, ö question

2016-09-19 Thread Lawrence D’Oliveiro
On Tuesday, September 20, 2016 at 8:21:25 AM UTC+12, Martin Schöön wrote: > But -- now I tested using emacs instead using C-c C-c to execute. > Noting happens so I try to run the program from command line and > find that now Python can't stand my å, ä and ö. What version of Python? Python 3 accept

Re: Looking for tips and gotchas for working with Python 3.5 zipapp feature

2016-09-19 Thread Paul Moore
On 16 September 2016 19:48 at 21:08, Malcolm Greene wrote: > Looking for tips or edge case gotchas associated with using Python 3.5's > new zipapp feature. It's worth pointing out that support for executing zipped applications has been part of Python since Python 2.6 or so. The pyz files created

Re: Functions Of Functions Returning Functions

2016-09-19 Thread Lawrence D’Oliveiro
On Monday, September 19, 2016 at 6:54:31 PM UTC+12, dieter wrote: > Some time ago, we had a (quite heated) discussion here ... I have noticed that people get very defensive about things they don’t understand. > Often, functions returning functions are more difficult to understand > than "first o

Re: Another å, ä, ö question

2016-09-19 Thread Christian Gollwitzer
Am 19.09.16 um 22:21 schrieb Martin Schöön: I am studying some of these tutorials: https://pythonprogramming.net/matplotlib-intro-tutorial/ I am recreating the code and I use my native Swedish for comments, labels and titles. Until now I have been doing so using Geany and executing using F5. Thi

Another å, ä, ö question

2016-09-19 Thread Martin Schöön
I am studying some of these tutorials: https://pythonprogramming.net/matplotlib-intro-tutorial/ I am recreating the code and I use my native Swedish for comments, labels and titles. Until now I have been doing so using Geany and executing using F5. This works fine. But -- now I tested using emacs

Re: how to automate java application in window using python

2016-09-19 Thread Lawrence D’Oliveiro
On Monday, September 19, 2016 at 11:29:24 AM UTC+12, Ned Batchelder wrote: > > On Sunday, September 18, 2016 at 6:45:32 PM UTC-4, Lawrence D’Oliveiro wrote: >> >> A CLI gives the user power over the computer. While a GUI is a great way to >> give the computer, and proprietary software companies, po

Re: Using copyreg to pickle unpicklable oblects

2016-09-19 Thread Peter Otten
kerbingamer376 wrote: > On Monday, September 19, 2016 at 5:48:35 PM UTC+1, Peter Otten wrote: >> kerbingamer376 wrote: >> >> > Hi, >> >> [No need to start a new thread for this] >> >> > I have an object (pygame.mixer.Sound) and, to convert it to a picklable >> > format, I can run: >> > >> > so

Re: How to install Python.h on FreeBSD 10.3-RELEASE?

2016-09-19 Thread Don Kuenz
In article you wrote: > In article <201609...@crcomp.net>, Don Kuenz wrote: >> >>The installed python packages are shown below. Searches lead me to >>believe that a PTH option make play a role. >> >> >>$ uname -v >>FreeBSD

Re: Using copyreg to pickle unpicklable oblects

2016-09-19 Thread kerbingamer376
On Monday, September 19, 2016 at 5:48:35 PM UTC+1, Peter Otten wrote: > kerbingamer376 wrote: > > > Hi, > > [No need to start a new thread for this] > > > I have an object (pygame.mixer.Sound) and, to convert it to a picklable > > format, I can run: > > > > sound_object.get_raw() > > > > and t

Re: Using copyreg to pickle unpicklable oblects

2016-09-19 Thread Peter Otten
kerbingamer376 wrote: > Hi, [No need to start a new thread for this] > I have an object (pygame.mixer.Sound) and, to convert it to a picklable > format, I can run: > > sound_object.get_raw() > > and to turn that back into an object, I can run: > > sound_object = pygame.mixer.Sound(raw_data) >

Re: Python 3.5.1 C API, the global available available is not destroyed when delete the module

2016-09-19 Thread Chris Angelico
On Mon, Sep 19, 2016 at 4:47 PM, dl l wrote: > I have a app loading python35.dll. Use python API PyImport_AddModule > to run a py file. And use PyDict_DelItemString to delete the module. > There is a global vailable in the py file. The global variable is not > destroyed when calling PyDict_DelItem

Re: How to install Python.h on FreeBSD 10.0-RELEASE?

2016-09-19 Thread The Doctor
In article <201609...@crcomp.net>, Don Kuenz wrote: > >The installed python packages are shown below. Searches lead me to >believe that a PTH option make play a role. > > >$ uname -v >FreeBSD 10.0-RELEASE #0 r260789: Thu Jan

Using copyreg to pickle unpicklable oblects

2016-09-19 Thread kerbingamer376
Hi, I have an object (pygame.mixer.Sound) and, to convert it to a picklable format, I can run: sound_object.get_raw() and to turn that back into an object, I can run: sound_object = pygame.mixer.Sound(raw_data) Is it possible to use copyreg or something similar so it's done automatically when

Re: Cython taking more time than regular Python

2016-09-19 Thread Peter Otten
Arshpreet Singh wrote: > Hope this is good place to ask question about Cython as well. > Following code of mine is taking 2.5 times more time than Native Python > code: > > %%cython > import numpy as np > a = np.array([]) > def large_sum2(int num_range): > np.append(a,[i for i in xrange(num_

Python 3.5.1 C API, the global available available is not destroyed when delete the module

2016-09-19 Thread dl l
Hi, I have a app loading python35.dll. Use python API PyImport_AddModule to run a py file. And use PyDict_DelItemString to delete the module. There is a global vailable in the py file. The global variable is not destroyed when calling PyDict_DelItemString to delete the module. That cause the memor

Cython taking more time than regular Python

2016-09-19 Thread Arshpreet Singh
Hope this is good place to ask question about Cython as well. Following code of mine is taking 2.5 times more time than Native Python code: %%cython import numpy as np a = np.array([]) def large_sum2(int num_range): np.append(a,[i for i in xrange(num_range)]) return a.sum %timeit large_