Re: Holding until next value change

2016-08-19 Thread Steve D'Aprano
On Sat, 20 Aug 2016 02:53 pm, Arshpreet Singh wrote: > I am writing a function as main_call() which is continuously producing > values. (+ve or -ve) I want to print on screen only for first +ve value > and hold until -ve value comes around. here is my code: > > > def main_call(): > while Tru

Holding until next value change

2016-08-19 Thread Arshpreet Singh
I am writing a function as main_call() which is continuously producing values. (+ve or -ve) I want to print on screen only for first +ve value and hold until -ve value comes around. here is my code: def main_call(): while True: yield strategy() for value in main_call(): if(val

Re: Does This Scare You?

2016-08-19 Thread Wildman via Python-list
On Sat, 20 Aug 2016 11:20:44 +1000, Chris Angelico wrote: > On Sat, Aug 20, 2016 at 11:11 AM, Wildman via Python-list > wrote: >> Since I am fairly new to Python, I realize there is much that I >> still don't know but I don't understand how Windows can have >> reserved names on a Linux system. W

Re: saving octet-stream png file

2016-08-19 Thread Random832
On Fri, Aug 19, 2016, at 21:09, Steve D'Aprano wrote: > Depends what you mean by "byte", but the short answer is "Yes". > > In the C/C++ standard, bytes must be at least eight bytes. As the below > FAQ > explains, that means that on machines like the PDP-10 a C++ compiler will > define bytes to be

Re: Python Run Error

2016-08-19 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 11:57:16 AM UTC+12, MRAB wrote: > > On 2016-08-19 23:31, Lawrence D’Oliveiro wrote: > >> On Saturday, August 20, 2016 at 10:01:08 AM UTC+12, Suzanna McGee wrote: >>> “The program can’t start because api-ms-win-crt-runtime-l1-1-0.dll is >>> missing from your computer.

Re: Does This Scare You?

2016-08-19 Thread Chris Angelico
On Sat, Aug 20, 2016 at 11:11 AM, Wildman via Python-list wrote: > Since I am fairly new to Python, I realize there is much that I > still don't know but I don't understand how Windows can have > reserved names on a Linux system. What am I missing? The PureWindowsPath class is specifically worki

Re: Does This Scare You?

2016-08-19 Thread Wildman via Python-list
On Sat, 20 Aug 2016 10:57:37 +1000, Chris Angelico wrote: > On Sat, Aug 20, 2016 at 9:42 AM, Lawrence D’Oliveiro > wrote: >> Python 3.5.2+ (default, Aug 5 2016, 08:07:14) >> [GCC 6.1.1 20160724] on linux >> Type "help", "copyright", "credits" or "license" for more information. >>

Re: saving octet-stream png file

2016-08-19 Thread Steve D'Aprano
On Sat, 20 Aug 2016 06:51 am, Lawrence D’Oliveiro wrote: > On Saturday, August 20, 2016 at 6:03:53 AM UTC+12, Terry Reedy wrote: >> >> An 'octet' is a byte of 8 bits. > > Is there any other size of byte? Depends what you mean by "byte", but the short answer is "Yes". In the C/C++ standard, byt

Re: Does This Scare You?

2016-08-19 Thread Chris Angelico
On Sat, Aug 20, 2016 at 9:42 AM, Lawrence D’Oliveiro wrote: > Python 3.5.2+ (default, Aug 5 2016, 08:07:14) > [GCC 6.1.1 20160724] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> from pathlib import PureWindowsPath > >>> PureWindowsPath(

Re: The Joys Of Data-Driven Programming

2016-08-19 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 4:47:28 PM UTC+12, Marko Rauhamaa wrote: > ... as a rule, I dislike rules. Rule languages tend to > grow out of all bounds, always remain deficient and have impenetrable, > ad-hoc semantics. That’s a very peculiar thing to say, considering that data-driven programmi

Re: Python Run Error

2016-08-19 Thread MRAB
On 2016-08-19 23:31, Lawrence D’Oliveiro wrote: On Saturday, August 20, 2016 at 10:01:08 AM UTC+12, Suzanna McGee wrote: “The program can’t start because api-ms-win-crt-runtime-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.” Why not do what it says?

Does This Scare You?

2016-08-19 Thread Lawrence D’Oliveiro
Python 3.5.2+ (default, Aug 5 2016, 08:07:14) [GCC 6.1.1 20160724] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from pathlib import PureWindowsPath >>> PureWindowsPath("prn").is_reserved() True >>> PureWindowsPath("prn.doc").is_re

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Lawrence D’Oliveiro
On Friday, August 19, 2016 at 8:56:31 PM UTC+12, I wrote: > To avoid lines getting long, why not take advantage of the two available > screen/page dimensions to make [expression] structure clearer? Another aspect of this has to do with line length. I regularly set my editor window width to around

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 10:38:34 AM UTC+12, Chris Angelico wrote: > > On Sat, Aug 20, 2016 at 8:31 AM, Lawrence D’Oliveiro wrote: >> >> There is no short-cut evaluation when constructing tuples and lists. > > I'm not sure how that would make difference in these examples. The > three parts

Re: Two-Dimensional Expression Layout

2016-08-19 Thread codewizard
On Friday, August 19, 2016 at 6:38:34 PM UTC-4, Chris Angelico wrote: > On Sat, Aug 20, 2016 at 8:31 AM, Lawrence D’Oliveiro > wrote: > > On Saturday, August 20, 2016 at 9:56:05 AM UTC+12, codew...@gmail.com wrote: > >> > >> On Friday, August 19, 2016 at 5:30:22 PM UTC-4, Lawrence D’Oliveiro wrote

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Chris Angelico
On Sat, Aug 20, 2016 at 8:31 AM, Lawrence D’Oliveiro wrote: > On Saturday, August 20, 2016 at 9:56:05 AM UTC+12, codew...@gmail.com wrote: >> >> On Friday, August 19, 2016 at 5:30:22 PM UTC-4, Lawrence D’Oliveiro wrote: >> >>> On Saturday, August 20, 2016 at 7:52:09 AM UTC+12, codew...@gmail.com >

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 9:56:05 AM UTC+12, codew...@gmail.com wrote: > > On Friday, August 19, 2016 at 5:30:22 PM UTC-4, Lawrence D’Oliveiro wrote: > >> On Saturday, August 20, 2016 at 7:52:09 AM UTC+12, codew...@gmail.com >> wrote: >>> if any([ >>> not isinstance(src, Image), >

Re: Python Run Error

2016-08-19 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 10:01:08 AM UTC+12, Suzanna McGee wrote: > “The program can’t start because api-ms-win-crt-runtime-l1-1-0.dll is > missing from your computer. Try reinstalling the program to fix this > problem.” Why not do what it says? -- https://mail.python.org/mailman/listinfo/

Python Run Error

2016-08-19 Thread Suzanna McGee
I am unable to run Python on my computer because I keep getting the follow error: “The program can’t start because api-ms-win-crt-runtime-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.” -- Suzanna McGee Computer Science Teacher Notre Dame High School

Re: Two-Dimensional Expression Layout

2016-08-19 Thread codewizard
On Friday, August 19, 2016 at 5:30:22 PM UTC-4, Lawrence D’Oliveiro wrote: > On Saturday, August 20, 2016 at 7:52:09 AM UTC+12, codew...@gmail.com wrote: > > if any([ > > not isinstance(src, Image), > > mask != None and not isinstance(mask, Image), > > not isinstance(des

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 5:53:22 AM UTC+12, Terry Reedy wrote: > > To me, putting parens and '+' and 'or' on separate lines emphasizes them > too much and makes the layout more, not less, cluttered. So having whitespace around these symbols makes things look *more* cluttered, while packin

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 7:52:09 AM UTC+12, codew...@gmail.com wrote: > if any([ > not isinstance(src, Image), > mask != None and not isinstance(mask, Image), > not isinstance(dest, Image), > ]): > raise TypeError("image args must be Image objects") >

Re: saving octet-stream png file

2016-08-19 Thread Random832
On Fri, Aug 19, 2016, at 16:51, Lawrence D’Oliveiro wrote: > On Saturday, August 20, 2016 at 6:03:53 AM UTC+12, Terry Reedy wrote: > > > > An 'octet' is a byte of 8 bits. > > Is there any other size of byte? Not very often anymore. Used to be some systems had 9-bit bytes, and of course a lot of c

Re: saving octet-stream png file

2016-08-19 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 6:03:53 AM UTC+12, Terry Reedy wrote: > > An 'octet' is a byte of 8 bits. Is there any other size of byte? -- https://mail.python.org/mailman/listinfo/python-list

Re: saving octet-stream png file

2016-08-19 Thread Chris Kaynor
On Fri, Aug 19, 2016 at 12:00 PM, Larry Martell wrote: > On Fri, Aug 19, 2016 at 1:24 PM, Chris Angelico wrote: > > On Sat, Aug 20, 2016 at 3:10 AM, Larry Martell > wrote: > >> I have some python code (part of a django app) that processes a > >> request that contains a png file. The request is

Re: Two-Dimensional Expression Layout

2016-08-19 Thread codewizard
For some special cases, I prefer the versions below. On Friday, August 19, 2016 at 4:56:31 AM UTC-4, Lawrence D’Oliveiro wrote: > [snip] > > Computing a variable value (using redundant parentheses to avoid > backslash-continuations): > > dest_rect = \ > ( > draw_bounds

Re: saving octet-stream png file

2016-08-19 Thread Larry Martell
On Fri, Aug 19, 2016 at 3:00 PM, Larry Martell wrote: > On Fri, Aug 19, 2016 at 1:24 PM, Chris Angelico wrote: >> On Sat, Aug 20, 2016 at 3:10 AM, Larry Martell >> wrote: >>> I have some python code (part of a django app) that processes a >>> request that contains a png file. The request is sen

python module install manully

2016-08-19 Thread ldompeling
I have a module insteon.py what I need to install manually because it is not in the python index packages. I copied the module in /usr/lib/python2.7/dist-packages and /usr/local/lib/python2.7/dist-packages. When I try to import the module insteon.py I get this error: Does someone knows what the

Re: saving octet-stream png file

2016-08-19 Thread Larry Martell
On Fri, Aug 19, 2016 at 1:24 PM, Chris Angelico wrote: > On Sat, Aug 20, 2016 at 3:10 AM, Larry Martell > wrote: >> I have some python code (part of a django app) that processes a >> request that contains a png file. The request is send with >> content_type = 'application/octet-stream' >> >> In

Re: saving octet-stream png file

2016-08-19 Thread Terry Reedy
On 8/19/2016 1:10 PM, Larry Martell wrote: I have some python code (part of a django app) that processes a request that contains a png file. The request is send with content_type = 'application/octet-stream' An 'octet' is a byte of 8 bits. So the content is a stream of bytes and MUST NOT be d

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Terry Reedy
On 8/19/2016 4:56 AM, Lawrence D’Oliveiro wrote: It is handy to be able to keep complex expressions together sometimes, when breaking them up would simply obscure their structure. To avoid lines getting long, why not take advantage of the two available screen/page dimensions to make their stru

Re: saving octet-stream png file

2016-08-19 Thread Chris Angelico
On Sat, Aug 20, 2016 at 3:10 AM, Larry Martell wrote: > I have some python code (part of a django app) that processes a > request that contains a png file. The request is send with > content_type = 'application/octet-stream' > > In the python code I want to write this data to a file and still have

saving octet-stream png file

2016-08-19 Thread Larry Martell
I have some python code (part of a django app) that processes a request that contains a png file. The request is send with content_type = 'application/octet-stream' In the python code I want to write this data to a file and still have it still be a valid png file. The data I get looks like this:

Re: index for regex.search() beyond which the RE engine will not go.

2016-08-19 Thread Steve D'Aprano
On Fri, 19 Aug 2016 09:21 pm, Jon Ribbens wrote: > On 2016-08-19, iMath wrote: >> for >> regex.search(string[, pos[, endpos]]) >> The optional parameter endpos is the index into the string beyond >> which the RE engine will not go, while this lead me to believe the >> RE engine will still search

Re: index for regex.search() beyond which the RE engine will not go.

2016-08-19 Thread Steve D'Aprano
On Fri, 19 Aug 2016 09:14 pm, iMath wrote: > > for > regex.search(string[, pos[, endpos]]) > The optional parameter endpos is the index into the string beyond which > the RE engine will not go, while this lead me to believe the RE engine > will still search on till the endpos position even after

Re: use regex to search the page one time to get two types of Information

2016-08-19 Thread Friedrich Rentsch
On 08/19/2016 09:02 AM, iMath wrote: I need to use regex to search two types of Information within a web page, while it seems searching the page two times rather than one is much time consuming , is it possible to search the page one time to get two or more types of Information? >>> r = re.

Re: use regex to search the page one time to get two types of Information

2016-08-19 Thread Chris Angelico
On Fri, Aug 19, 2016 at 11:13 PM, iMath wrote: > 1. searching the page two times rather than one is a little bit time > consuming . Have you measured that? If not, ignore it. You're searching a web page; if you're downloading that before you search it, chances are very good that you spend far mo

Re: use regex to search the page one time to get two types of Information

2016-08-19 Thread iMath
1. searching the page two times rather than one is a little bit time consuming . 2. starting the second search from the first match.endpos does reduce the time consuming . 3. how to combine both patterns into one regex? while using the special | regex operator only matches one regex not both --

Re: How do I tell if I'm running on a PowerPC?

2016-08-19 Thread Tim Chase
On 2016-08-14 13:54, Steven D'Aprano wrote: > I need to be able to programmatically test whether I'm running on a > PowerPC. How can I do that? > > import platform > if platform.machine() in ('ppc', 'ppc64'): > print('running PowerPC') > > > Is that right? Running OpenBSD on a PPC iBook G4:

Re: index for regex.search() beyond which the RE engine will not go.

2016-08-19 Thread Jon Ribbens
On 2016-08-19, iMath wrote: > for > regex.search(string[, pos[, endpos]]) > The optional parameter endpos is the index into the string beyond > which the RE engine will not go, while this lead me to believe the > RE engine will still search on till the endpos position even after > it returned the

index for regex.search() beyond which the RE engine will not go.

2016-08-19 Thread iMath
for regex.search(string[, pos[, endpos]]) The optional parameter endpos is the index into the string beyond which the RE engine will not go, while this lead me to believe the RE engine will still search on till the endpos position even after it returned the matched object, is this Right ? --

Re: Nuitka Release 0.5.22

2016-08-19 Thread Steve D'Aprano
On Thu, 18 Aug 2016 06:58 am, breamore...@gmail.com wrote: > As Kay (him) is less than useless at sales and marketing, somebody has to > do it, so here you are folks > http://nuitka.net/posts/nuitka-release-0522.html Thanks for the link. -- Steve “Cheer up,” they said, “things could be worse.

Re: Scipy.signal, spectrogram??

2016-08-19 Thread Peter Otten
Ambroise Baudot wrote: http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.spectrogram.html > In Python (v. 3.4), scipy.signal.spectrogram doesn't exist? > Can you help me to find this function please? It's the scipy version that matters. The page you link to says """ New in version

Scipy.signal, spectrogram??

2016-08-19 Thread Ambroise Baudot
Hello, http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.spectrogram.html In Python (v. 3.4), scipy.signal.spectrogram doesn't exist? Can you help me to find this function please? Bonjour, Impossible de trouver la fonction scpiy.signal.spectrogram indiquée ici : http://docs.scipy.o

Two-Dimensional Expression Layout

2016-08-19 Thread Lawrence D’Oliveiro
It is handy to be able to keep complex expressions together sometimes, when breaking them up would simply obscure their structure. To avoid lines getting long, why not take advantage of the two available screen/page dimensions to make their structure clearer? As a bonus, spacing out parentheses

Re: use regex to search the page one time to get two types of Information

2016-08-19 Thread Peter Otten
iMath wrote: > I need to use regex to search two types of Information within a web page, Did you try specialised tools like BeautifulSoup? > while it seems searching the page two times rather than one is much time > consuming It "seems"? Try it and only "fix" it if it proves to be a problem,

Re: use regex to search the page one time to get two types of Information

2016-08-19 Thread iMath
each regex only has one matched result in the web page -- https://mail.python.org/mailman/listinfo/python-list

use regex to search the page one time to get two types of Information

2016-08-19 Thread iMath
I need to use regex to search two types of Information within a web page, while it seems searching the page two times rather than one is much time consuming , is it possible to search the page one time to get two or more types of Information? -- https://mail.python.org/mailman/listinfo/python-

Re: type lookuperror

2016-08-19 Thread Marko Rauhamaa
Steve D'Aprano : > And when all the hardware is migrated to "the cloud" (stupid marketing > speak for "a bunch of computers that you don't control connected to > the internet"), what exactly will "the cloud" be running on? Moonbeams > and kitten purrs? Your soul would no longer run on dedicated we