Swig and distutils

2017-08-29 Thread Оlе Ѕtrеісhеr
Hi, I want to write a setup.py for a module from a swig source. The recommended way [1] does not work because it does not process the generated Python file. Searching on Stackoverflow gives an (ugly) workaround and the hint "this may be considered as a bug" [2]. However, I couldn't find a distuti

Re: doctest random output?

2017-08-29 Thread Steven D'Aprano
On Tue, 29 Aug 2017 12:25:45 +1000, Chris Angelico wrote: > On Tue, Aug 29, 2017 at 11:53 AM, Steve D'Aprano > wrote: >> (1) Disable doctesting for that example, and treat it as just >> documentation: >> >> def my_thing(): >> """blah blah blah >> >> >>> my_thing() #doctest:+SKIP >> 4

Re: doctest random output?

2017-08-29 Thread Chris Angelico
On Tue, Aug 29, 2017 at 5:39 PM, Steven D'Aprano wrote: > On Tue, 29 Aug 2017 12:25:45 +1000, Chris Angelico wrote: > >> For a lot of functions, this completely destroys the value of >> doctesting. > > > "The" value? Doc tests have two values: documentation (as examples of > use) and as tests. Dis

To mock/patch or not to, was Re: doctest random output?

2017-08-29 Thread Peter Otten
Steven D'Aprano wrote: > Wait... are you saying that importing test_mymodule monkey-patches the > current library? And doesn't un-patch it afterwards? That's horrible. There's something in the library, unittest.mock that makes this relatively safe -- if not painless with mock.patch("random.rand

Re: doctest random output?

2017-08-29 Thread Pavol Lisy
On 8/28/17, Leam Hall wrote: > On 08/28/2017 11:40 AM, Dennis Lee Bieber wrote: > > ... a bunch of good stuff ... > > I'm (re-)learning python and just trying make sure my function works. > Not at the statistical or cryptographic level. :) > > Thanks! > > Leam > -- > https://mail.python.org/mail

Latency for API call to a Python Function

2017-08-29 Thread shazianusra
Hi, I have an issue with one piece of code in Python that when my API using Nginx/Uwsgi/EC2 AWS calls this function it causes latency. I need help to figure out if there is I am doing something wrong with this particular function. Rest of the code calls for DB are working fine and no issues. Bu

Re: Latency for API call to a Python Function

2017-08-29 Thread Terry Reedy
On 8/29/2017 11:22 AM, [email protected] wrote: def getvideos(self, listitem): channelId = "" returnVideos,dictData = {},{} mode = 0 channelId = listitem[KEY_CHANNELID] if KEY_CHANNELMODE in listitem : mode = int(listitem[KEY_CHANNELMODE]) filteredVideos = [] ... Please make code readable

Re: Latency for API call to a Python Function

2017-08-29 Thread MRAB
On 2017-08-29 16:22, [email protected] wrote: Hi, I have an issue with one piece of code in Python that when my API using Nginx/Uwsgi/EC2 AWS calls this function it causes latency. I need help to figure out if there is I am doing something wrong with this particular function. Rest of the

Re: Latency for API call to a Python Function

2017-08-29 Thread shazianusra
You mean recursive linear search? Or is there a way I can test all my code with multiple files to see which function is causing issue? -- https://mail.python.org/mailman/listinfo/python-list

Re: IDLE won't install on manual installation

2017-08-29 Thread Yusuf Mohammad
Hi! i want to ask my question again. I have now subscribed to the list. I'll just copy and past it here again: Hi! My name is Yusuf Mohammad. I work for a hospital in Norway and we plan to use python to program a mobile application. I have a admin account on my computer and i am trying to install

Re: tkinter keypress events are a mess for numpad keys

2017-08-29 Thread Irmen de Jong
On 29/08/2017 06:32, Terry Reedy wrote: > *The* documentation (for 8.6) is the tcl.tk/man doc set: > https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm > For the level of detail you are looking at, they are essential. > > The nmt docs for 8.5 are neither complete (intentionally not) nor always > c

Re: Latency for API call to a Python Function

2017-08-29 Thread MRAB
On 2017-08-29 17:08, [email protected] wrote: You mean recursive linear search? Or is there a way I can test all my code with multiple files to see which function is causing issue? You can just put some timing around the methods that might be a problem, writing to a logfile. Process a fe

Re: doctest random output?

2017-08-29 Thread Chris Angelico
On Wed, Aug 30, 2017 at 1:39 AM, Stefan Ram wrote: > Dennis Lee Bieber writes: >>Testing randomness itself requires statistical tests... > > A perfectly random coin /can/ yield "heads" a thousand times > in sequence (which is very unlikely, but possible). > > This behavior should fail nearl

automatically set field values in django using function

2017-08-29 Thread Xristos Xristoou
I need t define some values of fields automatically in my model using function. my function get input image path and calculate and I need that calculation results to define my database fields in Django. but first the upload image need to get the path in server and after i can to define the value

pip which should be installed with Python3.62 doesn't work in windows

2017-08-29 Thread Bear Light
I found many rookies like me asking similar question: why "pip" is not recognized by cmd? I install Python 3.62 64bit in Win10 and I'm sure I add PATH, the Python tutorial doesn't even mention about PATH. You can see the following picture showing the tutorial doesn't work. Please give a hand to the

Re: pip which should be installed with Python3.62 doesn't work in windows

2017-08-29 Thread MRAB
On 2017-08-29 20:10, Bear Light wrote: I found many rookies like me asking similar question: why "pip" is not recognized by cmd? I install Python 3.62 64bit in Win10 and I'm sure I add PATH, the Python tutorial doesn't even mention about PATH. You can see the following picture showing the tutoria

RE: pip which should be installed with Python3.62 doesn't work inwindows

2017-08-29 Thread Bear Light
Thanks for help but it doesn’t work. (cmd) C:\Users\user>py -3.6 -m pip install regex C:\Program Files\Python36\python.exe: No module named pip The picture that I attached showed similar result. Though you can see the option of installing pip during python3 installing, the command about pip does