Re: Two-Dimensional Expression Layout

2016-08-20 Thread Michael Selik
On Sun, Aug 21, 2016 at 12:31 AM Lawrence D’Oliveiro wrote: > On Sunday, August 21, 2016 at 12:44:21 PM UTC+12, Michael Selik wrote: > > > > On Sat, Aug 20, 2016 at 6:21 PM Lawrence D’Oliveiro wrote: > > > >>> if any(not isinstance(obj, Image) for obj in [src, mask, dest]): > >>> ...

Re: Good Tutorial for Python3 winreg Module

2016-08-20 Thread eryk sun
On Sun, Aug 21, 2016 at 3:55 AM, wrote: > > I need to pull a saved value from the registry, and the only way I > know how to get it is through winreg. Here's an example that reads the value and type of "Temp" in HKCU\Environment: import winreg with winreg.OpenKey(winreg.HKEY_CURRENT_US

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Lawrence D’Oliveiro
On Sunday, August 21, 2016 at 12:44:21 PM UTC+12, Michael Selik wrote: > > On Sat, Aug 20, 2016 at 6:21 PM Lawrence D’Oliveiro wrote: > >>> if any(not isinstance(obj, Image) for obj in [src, mask, dest]): >>> ... >> >> Spot the bug in your version... > > - ``mask != None`` is unnecess

Good Tutorial for Python3 winreg Module

2016-08-20 Thread johncalvinhall
Does anyone have a good tutorial on how to use the Python 3 module winreg? I need to pull a saved value from the registry, and the only way I know how to get it is through winreg. If anyone is able to help, I sure would appreciate it. -- https://mail.python.org/mailman/listinfo/python-list

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Steve D'Aprano
Oh wait! The penny drops! On Sun, 21 Aug 2016 10:43 am, Michael Selik wrote: > On Sat, Aug 20, 2016 at 6:21 PM Lawrence D’Oliveiro >> >> if ( >> >> not isinstance(src, Image) >> >> or >> >> mask != None and not isinstance(mask, Image) >> >> or >> >>

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Steve D'Aprano
On Sun, 21 Aug 2016 10:43 am, Michael Selik wrote: > On Sat, Aug 20, 2016 at 6:21 PM Lawrence D’Oliveiro > wrote: > >> > p0 = (0, 0) >> > p1 = (major_dim, 0) >> > colour_stops = (0, rect_1_colour), (1, complement(rect_1_colour)) >> > rect_1_pattern = qah.Pattern.create_linear(p0,

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Steve D'Aprano
On Sun, 21 Aug 2016 09:44 am, Lawrence D’Oliveiro wrote: > Why do you think I put in those “#end” lines? Do you really want us to answer that? I don't think you will like the answer. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Steve D'Aprano
On Sun, 21 Aug 2016 08:22 am, Lawrence D’Oliveiro wrote: > Another example, from : the sequence of > values is laid out to allow easy additions/modifications in future. When replying, I normally try to trim unnecessary code snippets down to the critical line or two

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Michael Selik
On Sat, Aug 20, 2016 at 8:43 PM Michael Selik wrote: > On Sat, Aug 20, 2016 at 6:21 PM Lawrence D’Oliveiro < > lawrenced...@gmail.com> wrote: > >> > p0 = (0, 0) >> > p1 = (major_dim, 0) >> > colour_stops = (0, rect_1_colour), (1, complement(rect_1_colour)) >> > rect_1_pattern = qa

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Michael Selik
On Sat, Aug 20, 2016 at 6:21 PM Lawrence D’Oliveiro wrote: > > p0 = (0, 0) > > p1 = (major_dim, 0) > > colour_stops = (0, rect_1_colour), (1, complement(rect_1_colour)) > > rect_1_pattern = qah.Pattern.create_linear(p0, p1, colour_stops) > > That’s an example of what I mean about

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Lawrence D’Oliveiro
On Sunday, August 21, 2016 at 10:35:08 AM UTC+12, c...@zip.com.au wrote: > Aye, but beware that the expression is actually correct for the > indentation. > Compare: > >assert \ >( >len(self.points) == 0 >and >not self.points[0].off >or

Re: The Joys Of Data-Driven Programming

2016-08-20 Thread Lawrence D’Oliveiro
On Saturday, August 20, 2016 at 8:08:24 PM UTC+12, Marko Rauhamaa wrote: > > 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 hav

Re: Two-Dimensional Expression Layout

2016-08-20 Thread cs
On 19Aug2016 16:11, Lawrence D’Oliveiro wrote: 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 differenc

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Lawrence D’Oliveiro
On Friday, August 19, 2016 at 8:56:31 PM UTC+12, I 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 mak

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Lawrence D’Oliveiro
On Sunday, August 21, 2016 at 12:48:46 AM UTC+12, Michael Selik wrote: > > On Fri, Aug 19, 2016 at 5:01 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. > > p0 = (0, 0) >

Re: saving octet-stream png file

2016-08-20 Thread Marko Rauhamaa
Random832 : > On Sat, Aug 20, 2016, at 03:50, Marko Rauhamaa wrote: >> 2'scomplement arithmetics is quite often taken advantage of in C >> programming. Unfortunately, with the castration of signed integers >> with the most recent C standards, 2's-complement has been dangerously >> broken. > > No p

Re: saving octet-stream png file

2016-08-20 Thread Grant Edwards
On 2016-08-19, Random832 wrote: > 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 system

Re: saving octet-stream png file

2016-08-20 Thread Random832
On Sat, Aug 20, 2016, at 03:50, Marko Rauhamaa wrote: > 2'scomplement arithmetics is quite often taken advantage of in C > programming. Unfortunately, with the castration of signed integers with > the most recent C standards, 2's-complement has been dangerously broken. No part of any version of th

Knowing which thread had the GIL before

2016-08-20 Thread Julien Kauffmann
Hi, I've worked the past few days on a stastistical sampling profiling tool for an online Python 2.7 service that runs on Windows. My approach so far is: - I have a dedicated thread that sleeps most of the time and wakes up every n-th milliseconds. - Whenever the thread wakes-up, it gets the

Re: Holding until next value change

2016-08-20 Thread andrzej . brozi
Hello Perhaps this would suffice: prev = None for value in main_call(): if value==prev: pass else: prev = value if prev>0: print('+v') elif prev<0: print('-v') else: print('0') Of course this will work only if su

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Michael Selik
On Fri, Aug 19, 2016 at 5:01 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

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

2016-08-20 Thread iMath
On Friday, August 19, 2016 at 10:09:19 PM UTC+8, Steve D'Aprano wrote: > 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

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

2016-08-20 Thread iMath
On Friday, August 19, 2016 at 9:45:08 PM UTC+8, Friedrich Rentsch wrote: > 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 possibl

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

2016-08-20 Thread iMath
On Friday, August 19, 2016 at 9:19:22 PM UTC+8, Chris Angelico wrote: > 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

Re: The Joys Of Data-Driven Programming

2016-08-20 Thread Marko Rauhamaa
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, conside

Re: saving octet-stream png file

2016-08-20 Thread Marko Rauhamaa
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. The main difference between an octet and a byte is t

Re: Holding until next value change

2016-08-20 Thread Arshpreet Singh
On Saturday, 20 August 2016 11:38:03 UTC+5:30, Steve D'Aprano wrote: > 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 -