Re: I'm wrong or Will we fix the ducks limp?

2016-06-07 Thread Gregory Ewing
Marko Rauhamaa wrote: > [concerning leashed puppies] Note: no boxes! However, there are strings attached. Now you can truly *bind* objects to variables. If you wanted to really bind them good and proper, you'd use duct tape (or "duck tape" as some people call it -- arguably more appropriate in

Re: Recommendation for GUI lib?

2016-06-07 Thread Nick Sarbicki
> > Qt Designer is certainly a good GUI builder, but not more than that. > When you actually want to use the designed GUI in Python, you will find > that this needs almost as much know how and work as if you did the GUI > in code. > I think that's a bit of an unfair statement. Sure conversion can

Re: for / while else doesn't make sense

2016-06-07 Thread Lawrence D’Oliveiro
On Tuesday, June 7, 2016 at 4:36:37 PM UTC+12, Ian wrote: > A 500-line function? Yikes, what an eyesore. When you have to include > #end comments in order to visually match things up, that should be a > smell that your code is excessively complex. Feel free to come up with a simpler version. >

Re: for / while else doesn't make sense

2016-06-07 Thread Lawrence D’Oliveiro
On Tuesday, June 7, 2016 at 3:34:39 PM UTC+12, Dan Sommers wrote: > I used to write a lot of assembly code, for a lot of different CPUs, and > they all had a common, versatile looping form which could be arranged in > different ways to suit the problem at hand. On most chips, it was (and > still

Re: I'm wrong or Will we fix the ducks limp?

2016-06-07 Thread Marko Rauhamaa
Gregory Ewing : > Marko Rauhamaa wrote: >> Seriously, though, it is notable that the high-level programming >> languages pretty unanimously refuse to make variables first-class >> objects. I wonder why. > > That's an interesting question. One reason might be > that in the absence of static type an

Re: for / while else doesn't make sense

2016-06-07 Thread Marko Rauhamaa
Lawrence D’Oliveiro : > On Tuesday, June 7, 2016 at 4:36:37 PM UTC+12, Ian wrote: >> A 500-line function? Yikes, what an eyesore. When you have to include >> #end comments in order to visually match things up, that should be a >> smell that your code is excessively complex. > > [...] > > Wow, that

Re: for / while else doesn't make sense

2016-06-07 Thread Steven D'Aprano
On Tuesday 07 June 2016 17:52, Lawrence D’Oliveiro wrote: > On Tuesday, June 7, 2016 at 4:36:37 PM UTC+12, Ian wrote: >> A 500-line function? Yikes, what an eyesore. When you have to include >> #end comments in order to visually match things up, that should be a >> smell that your code is excessiv

Re: I'm wrong or Will we fix the ducks limp?

2016-06-07 Thread Jussi Piitulainen
Marko Rauhamaa writes: > Gregory Ewing : > >> Marko Rauhamaa wrote: >>> Seriously, though, it is notable that the high-level programming >>> languages pretty unanimously refuse to make variables first-class >>> objects. I wonder why. >> >> That's an interesting question. One reason might be >> th

How to implement semaphores in python?

2016-06-07 Thread karthik jagilinki
Hello All, I need some help with semaphore implementation between two programs in python. I'd be glad if anyone can give me some help. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to implement semaphores in python?

2016-06-07 Thread David Palao
Hi, Have you checked this https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Semaphore ? Best 2016-06-07 11:43 GMT+02:00 karthik jagilinki : > Hello All, > > I need some help with semaphore implementation between two programs in > python. I'd be glad if anyone can give me som

Re: I'm wrong or Will we fix the ducks limp?

2016-06-07 Thread Steven D'Aprano
On Tuesday 07 June 2016 15:42, Gregory Ewing wrote: > Steven D'Aprano wrote: >> Even if you were right that objects must exist at >> a single well-defined location, that is strictly irrelevant. That's >> implementation, not interface. > > We're talking about mental models. Sure, you could come up

Re: I'm wrong or Will we fix the ducks limp?

2016-06-07 Thread BartC
On 07/06/2016 08:56, Marko Rauhamaa wrote: Gregory Ewing : Marko Rauhamaa wrote: Seriously, though, it is notable that the high-level programming languages pretty unanimously refuse to make variables first-class objects. I wonder why. That's an interesting question. One reason might be that

reshape and keep x,y,z ordering

2016-06-07 Thread Heli
Hello, I have a question regarding reshaping numpy array. I either have a 1D array that I need to reshape to a 3D array or a 3D array to reshape to a 1d numpy array. In both of these cases it is assumed that data follows x,y,z ordering. and I use the following to reshape the numpy array.

Re: for / while else doesn't make sense

2016-06-07 Thread Ian Kelly
On Tue, Jun 7, 2016 at 1:52 AM, Lawrence D’Oliveiro wrote: > Wow, that’s only twice the length of the code you’re replacing. Well done. Huh? The example that you posted was 17 lines, excluding comments. My replacement code is 17 lines, excluding comments. Where are you getting "twice the length"

Re: xlrd 1.0.0 released!

2016-06-07 Thread derek
Gmail and the Gmail Digest only ever show the 0.9.4 tag - not sure if this a big issue or not (but I know I would like to the 1.0.0 tag to be proudly displayed!) On Friday, 3 June 2016 03:57:35 UTC+2, Chris Withers wrote: > > Ugh, and once again, this time with a corrected title... > > > On 02

Re: for / while else doesn't make sense

2016-06-07 Thread Dan Sommers
On Tue, 07 Jun 2016 00:53:31 -0700, Lawrence D’Oliveiro wrote: > On Tuesday, June 7, 2016 at 3:34:39 PM UTC+12, Dan Sommers wrote: > >> I used to write a lot of assembly code, for a lot of different CPUs, and >> they all had a common, versatile looping form which could be arranged in >> different

Re: I'm wrong or Will we fix the ducks limp?

2016-06-07 Thread Antoon Pardon
Op 07-06-16 om 12:18 schreef Steven D'Aprano: > We're talking about mental models. Sure, you could come up > with some kind of Tardis-like mental model where objects > exist in more than one location at once. But why would > you bother going to such mental contortions? > Because (self-recursive dat

Re: reshape and keep x,y,z ordering

2016-06-07 Thread Joel Goldstick
On Tue, Jun 7, 2016 at 7:25 AM, Heli wrote: > Hello, > > I have a question regarding reshaping numpy array. > > I either have a 1D array that I need to reshape to a 3D array or a 3D array > to reshape to a 1d numpy array. > > In both of these cases it is assumed that data follows x,y,z ordering.

Re: reshape and keep x,y,z ordering

2016-06-07 Thread Michael Selik
On Tue, Jun 7, 2016 at 7:31 AM Heli wrote: > Hello, > I have a question regarding reshaping numpy array. > > I either have a 1D array that I need to reshape to a 3D array or a 3D > array to reshape to a 1d numpy array. > > In both of these cases it is assumed that data follows x,y,z ordering. > a

Re: reshape and keep x,y,z ordering

2016-06-07 Thread Heli
Thanks Michael, This did the trick. array.flatten('F') works exactly as I need. Thanks a lot, -- https://mail.python.org/mailman/listinfo/python-list

Re: I'm wrong or Will we fix the ducks limp?

2016-06-07 Thread Random832
On Tue, Jun 7, 2016, at 03:03, Gregory Ewing wrote: > a = 42 > b = 17 > c = &a > c = &b > > does 'c' now hold a reference to the variable 'b', or > does it still hold a reference to 'a' and 'a' now > holds a reference to 'b'? It'd have to be spelled *c = &b, or c.value = &b or c.setvalue(&b), or

Re: I'm wrong or Will we fix the ducks limp?

2016-06-07 Thread Random832
On Tue, Jun 7, 2016, at 08:32, Antoon Pardon wrote: > > Here's a thought experiment for you. Suppose in Python 3.6, Guido announces > > that Python will support a form of high-level pointer (not the scary, > > dangerous > > low-level pointer of C) called "reference". There will be a dereference

Re: I'm wrong or Will we fix the ducks limp?

2016-06-07 Thread Steven D'Aprano
On Tue, 7 Jun 2016 10:32 pm, Antoon Pardon wrote: > That people often use the shortcut "x is 999" doesn't make the statement > wrong that variables are essentially references in Python. No, I'm sorry, you're wrong, variables are essentially arrays of bits in Python. -- Steven -- https://mai

Re: Recommendation for GUI lib?

2016-06-07 Thread Dietmar Schwertberger
On 07.06.2016 09:22, Nick Sarbicki wrote: I think that's a bit of an unfair statement. Sure conversion can be a bit of a pain and there is some setup for getting the classes working. But that is generally a small static piece of code you can find all over the net, which is then usable for most

conception heritage or interface to multiprotocol read/write

2016-06-07 Thread Ni Va
Hi, In industrial project many protocols are often used for read/write goal at arrival. I would like to implement the better designed conception to enable read/write feature my main program. Example be abale to read/write on opc, s7 or others protocoles. If you have advices about this. Than

Re: Recommendation for GUI lib?

2016-06-07 Thread Roland Koebler via Python-list
Hi, the two "big" GUI toolkits on Linux are GTK+ and Qt. Both are free, have Python bindings and a graphical GUI designer, and both have ports for Windows and Mac OS X. Qt does have a better cross-platform- support and supports more platforms, but GTK+3 also works for Linux, Mac OS X and Windows.

Re: for / while else doesn't make sense

2016-06-07 Thread Lawrence D’Oliveiro
On Wednesday, June 8, 2016 at 12:28:02 AM UTC+12, Dan Sommers wrote: > I notice plenty of break statements scattered throughout your loop > bodies. Mixing the loop's exit conditions in with the logic is equally > unstructured. Is this the old “structured-programming-is-mathematically-equivalent-t

Re: for / while else doesn't make sense

2016-06-07 Thread Lawrence D’Oliveiro
On Tuesday, June 7, 2016 at 11:53:46 PM UTC+12, Ian wrote: > On Tue, Jun 7, 2016 at 1:52 AM, Lawrence D’Oliveiro wrote: >> Wow, that’s only twice the length of the code you’re replacing. Well done. > > Huh? The example that you posted was 17 lines, excluding comments. My > replacement code is 17

Re: for / while else doesn't make sense

2016-06-07 Thread Lawrence D’Oliveiro
On Tuesday, June 7, 2016 at 8:00:31 PM UTC+12, Marko Rauhamaa wrote: > I understand you are hurt when your code is criticized bluntly. However, > you *did* stick your head out. Don’t worry, I am not the thin-skinned type. > I, too, insist that every function/method must be visible at once in the

Re: for / while else doesn't make sense

2016-06-07 Thread Marko Rauhamaa
Lawrence D’Oliveiro : > While elsewhere, you were criticizing my code for already being so > terribly large... Code can be large, only no function should be longer than ~70 lines or wider than 79 columns. If your function grows above that limit, you should refactor it and break it into multiple su

Re: for / while else doesn't make sense

2016-06-07 Thread Lawrence D’Oliveiro
On Wednesday, June 8, 2016 at 10:07:05 AM UTC+12, Marko Rauhamaa wrote: > Lawrence D’Oliveiro: >> While elsewhere, you were criticizing my code for already being so >> terribly large... > > Code can be large, only no function should be longer than ~70 lines or > wider than 79 columns. If your fun

Re: Recommendation for GUI lib?

2016-06-07 Thread Michael Torrie
Accidentally didn't reply to the list... On 06/07/2016 03:45 PM, Roland Koebler via Python-list wrote: > You can also try Qt (http://qt.io), and one of its Python-bindings. > But I was never happy with Qt and think some GUI-concepts of GTK+ are much > better than the ones of Qt, and I like Glade m

Re: for / while else doesn't make sense

2016-06-07 Thread Ian Kelly
On Tue, Jun 7, 2016 at 3:58 PM, Lawrence D’Oliveiro wrote: > On Tuesday, June 7, 2016 at 11:53:46 PM UTC+12, Ian wrote: >> On Tue, Jun 7, 2016 at 1:52 AM, Lawrence D’Oliveiro wrote: > >>> Wow, that’s only twice the length of the code you’re replacing. Well done. >> >> Huh? The example that you pos

Possible PEP - two dimensional arrays?

2016-06-07 Thread Harrison Chudleigh
I was programming a computer game and found that while 1D arrays can be created using the module array, there is no module for two-dimensional arrays, unlike languages like C. Currently, the closest thing Python has to a 2D array is a dictionary containing lists. I propose that a module , 2DArray,

Re: Possible PEP - two dimensional arrays?

2016-06-07 Thread Paul Rubin
Harrison Chudleigh writes: > Currently, the closest thing Python has to a 2D array is a dictionary > containing lists. Tuples work fine: d = {} d[2,3] = 5 # etc... > Is this idea PEPable? I don't think it would get any traction. If you're doing something numerical that needs 2d arrays, nu

Re: for / while else doesn't make sense

2016-06-07 Thread Ned Batchelder
On Tuesday, June 7, 2016 at 6:07:23 PM UTC-4, Lawrence D’Oliveiro wrote: > On Tuesday, June 7, 2016 at 8:00:31 PM UTC+12, Marko Rauhamaa wrote: > > I understand you are hurt when your code is criticized bluntly. However, > > you *did* stick your head out. > > Don’t worry, I am not the thin-skinned

Re: Possible PEP - two dimensional arrays?

2016-06-07 Thread Ned Batchelder
On Tuesday, June 7, 2016 at 8:19:33 PM UTC-4, Harrison Chudleigh wrote: > I was programming a computer game and found that while 1D arrays can be > created using the module array, there is no module for two-dimensional > arrays, unlike languages like C. Currently, the closest thing Python has to >

Re: Possible PEP - two dimensional arrays?

2016-06-07 Thread Rob Gaddi
Harrison Chudleigh wrote: > I was programming a computer game and found that while 1D arrays can be > created using the module array, there is no module for two-dimensional > arrays, unlike languages like C. Currently, the closest thing Python has to > a 2D array is a dictionary containing lists.

Re: for / while else doesn't make sense

2016-06-07 Thread Lawrence D’Oliveiro
On Wednesday, June 8, 2016 at 12:32:01 PM UTC+12, Ned Batchelder wrote: > On Tuesday, June 7, 2016 at 6:07:23 PM UTC-4, Lawrence D’Oliveiro wrote: > > On Tuesday, June 7, 2016 at 8:00:31 PM UTC+12, Marko Rauhamaa wrote: > > > I understand you are hurt when your code is criticized bluntly. However,

Re: for / while else doesn't make sense

2016-06-07 Thread Lawrence D’Oliveiro
On Wednesday, June 8, 2016 at 12:32:01 PM UTC+12, Ned Batchelder wrote: > Lawrence writes code in an unusual style... “Unusual” I can deal with. But when some people react with outrage, then it becomes clear they view my code as a personal attack. -- https://mail.python.org/mailman/listinfo/pyt

Re: for / while else doesn't make sense

2016-06-07 Thread Ned Batchelder
On Tuesday, June 7, 2016 at 9:29:59 PM UTC-4, Lawrence D’Oliveiro wrote: > On Wednesday, June 8, 2016 at 12:32:01 PM UTC+12, Ned Batchelder wrote: > > > Lawrence writes code in an unusual style... > > “Unusual” I can deal with. But when some people react with outrage, then it > becomes clear the

pandas.datetime addition: What's wrong?

2016-06-07 Thread Paulo da Silva
Hi all! What's wrong with this? import pandas as pd x=pd.to_datetime("20160501") x+pd.DateOffset(days=1) Timestamp('2016-05-02 00:00:00', tz=None) x.__add__(pd.DateOffset(days=1)) NotImplemented More generally I have a class derived from pandas.datetime and I want to implement its own __add__

Creating A Pythonic API Binding

2016-06-07 Thread Lawrence D’Oliveiro
The wrong way: ldo@theon:~> python2 Python 2.7.11+ (default, May 9 2016, 15:54:33) [GCC 5.3.1 20160429] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pymtp >>> mtp = pymtp.MTP() >>> mtp.connect() Device 0 (VID=04e8 and

Re: pandas.datetime addition: What's wrong?

2016-06-07 Thread MRAB
On 2016-06-08 03:09, Paulo da Silva wrote: Hi all! What's wrong with this? import pandas as pd x=pd.to_datetime("20160501") x+pd.DateOffset(days=1) Timestamp('2016-05-02 00:00:00', tz=None) x.__add__(pd.DateOffset(days=1)) NotImplemented More generally I have a class derived from pandas.dat

Re: for / while else doesn't make sense

2016-06-07 Thread Ethan Furman
On 06/01/2016 04:39 PM, Lawrence D’Oliveiro wrote: [multiple apparent trolls redacted] This thread is dead. Please stop beating it. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: pandas.datetime addition: What's wrong?

2016-06-07 Thread Paulo da Silva
Às 04:08 de 08-06-2016, MRAB escreveu: > On 2016-06-08 03:09, Paulo da Silva wrote: >> Hi all! >> ... >> >> More generally I have a class derived from pandas.datetime and I want to >> implement its own __add__ that at a given point call super __add__. >> >> For example: >> >> class C(pandas.datetim

Re: for / while else doesn't make sense

2016-06-07 Thread Marko Rauhamaa
Lawrence D’Oliveiro : > On Tuesday, June 7, 2016 at 8:00:31 PM UTC+12, Marko Rauhamaa wrote: >> I, too, insist that every function/method must be visible at once in the >> editor window. > > From subprocess.py in the Python 3.5 distribution: > [...] > Is that “visible at once” in your editor windo

Re: for / while else doesn't make sense

2016-06-07 Thread Marko Rauhamaa
Lawrence D’Oliveiro : > On Wednesday, June 8, 2016 at 10:07:05 AM UTC+12, Marko Rauhamaa wrote: >> Lawrence D’Oliveiro: > >>> While elsewhere, you were criticizing my code for already being so >>> terribly large... >> >> Code can be large, only no function should be longer than ~70 lines >> or wi

Re: I'm wrong or Will we fix the ducks limp?

2016-06-07 Thread Gregory Ewing
Random832 wrote: Er, how would that make them not first class? They wouldn't be as transparent as references in C++, which you just assign to like any other variable. That works because C++ makes a distinction between initialisation and assignment. It's not so easy to separate those in Python.