Re: Possible PEP - two dimensional arrays?

2016-06-08 Thread Terry Reedy
On 6/7/2016 8:17 PM, 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 cont

how to extract a variable as parameter which has index using by a for loop?

2016-06-08 Thread meInvent bbird
b = [str(i)+str(j)+str(k) for i in range(m) for j in range(m) for k in range(m)] b[21][0:1]+b[21][1:2] b[21][1:2]+b[21][2:3] b[21][0:1]+b[21][2:3] originally, mmm = 5 H2 = [MM[mmm][b[i][0:1]+b[i][1:2]] for i in range(len(b))] how to extract b[i][0:1] and b[i][1:2] as parameters? def node(mmm,

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

2016-06-08 Thread Antoon Pardon
Op 07-06-16 om 17:33 schreef 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

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

2016-06-08 Thread Antoon Pardon
Op 07-06-16 om 18:03 schreef 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 arra

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

2016-06-08 Thread Steven D'Aprano
On Wednesday 08 June 2016 17:53, Antoon Pardon wrote: > Python could go the simula route, which has two kinds of > assignment. One with the python semantics and one with C > semantics. > > Let as use := for the C sematics assignment and <- for the > python sematics assignment. We could then do so

Re: how to extract a variable as parameter which has index using by a for loop?

2016-06-08 Thread Steven D'Aprano
On Wednesday 08 June 2016 17:31, meInvent bbird wrote: > b = [str(i)+str(j)+str(k) for i in range(m) for j in range(m) for k in > range(m)] > b[21][0:1]+b[21][1:2] > b[21][1:2]+b[21][2:3] > b[21][0:1]+b[21][2:3] > > > originally, > > mmm = 5 > H2 = [MM[mmm][b[i][0:1]+b[i][1:2]] for i in range(l

Re: Creating A Pythonic API Binding

2016-06-08 Thread Steven D'Aprano
On Wednesday 08 June 2016 12:31, Lawrence D’Oliveiro wrote: > The wrong way: [...] > The right way : That's quite good. A few minor issues: I don't understand why you have a method that returns files called "get_children". And I would expect that if you passed a

Re: how to extract a variable as parameter which has index using by a for loop?

2016-06-08 Thread meInvent bbird
just extract b[i][0:1] and b[i][1:2] out of for loop but i depend on for loop def node(mmm, A, B): H2 = [MM[mmm][A+B] for i in range(len(b))] return H2 node(5, b[i][0:1], b[i][1:2]) it is not convenient to disclose in detail just expect to discuss from the view of programming On Wednesd

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

2016-06-08 Thread Antoon Pardon
Op 08-06-16 om 10:47 schreef Steven D'Aprano: > On Wednesday 08 June 2016 17:53, Antoon Pardon wrote: > >> Python could go the simula route, which has two kinds of >> assignment. One with the python semantics and one with C >> semantics. >> >> Let as use := for the C sematics assignment and <- for

Re: how to extract a variable as parameter which has index using by a for loop?

2016-06-08 Thread Joonas Liik
On 8 June 2016 at 12:20, meInvent bbird wrote: > just extract b[i][0:1] and b[i][1:2] out of for loop > > but i depend on for loop > > def node(mmm, A, B): > H2 = [MM[mmm][A+B] for i in range(len(b))] > return H2 > > node(5, b[i][0:1], b[i][1:2]) > > it is not convenient to disclose in detail >

Re: [Q] ImportError by __import__() on Python >= 3.4

2016-06-08 Thread Makoto Kuwata
On Tue, Jun 7, 2016 at 7:28 AM, Michael Selik wrote: > On Thu, Jun 2, 2016 at 10:06 AM Makoto Kuwata wrote: > >> I have a trouble around __import__(). >> > > The docs for __import__ strongly recommend that you use importlib instead > https://docs.python.org/3.5/library/importlib.html#importlib.i

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

2016-06-08 Thread BartC
On 08/06/2016 10:41, Antoon Pardon wrote: Op 08-06-16 om 10:47 schreef Steven D'Aprano: On Wednesday 08 June 2016 17:53, Antoon Pardon wrote: Python could go the simula route, which has two kinds of assignment. One with the python semantics and one with C semantics. Let as use := for the C se

Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-08 Thread rocky
For those who are interested in experimenting with parser systems in Python, there has been one around for a long while. But in my opinion it was a bit lacking in graded example demonstrating how to use it. So in the recently in spark_parser 1.3.0 [1], I've beefed up the examples a little. In a

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

2016-06-08 Thread Antoon Pardon
Op 08-06-16 om 12:33 schreef BartC: > On 08/06/2016 10:41, Antoon Pardon wrote: >> Op 08-06-16 om 10:47 schreef Steven D'Aprano: >>> On Wednesday 08 June 2016 17:53, Antoon Pardon wrote: >>> Python could go the simula route, which has two kinds of assignment. One with the python semantics

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

2016-06-08 Thread Rustom Mody
On Wednesday, June 8, 2016 at 4:32:33 PM UTC+5:30, Antoon Pardon wrote: > It means that if you mutate the object through one variable, > you can see the result of that mutation through the other variable. But if the > assignment doesn't mutate, you can't have such effect through assignment. > It

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

2016-06-08 Thread BartC
On 08/06/2016 12:01, Antoon Pardon wrote: Op 08-06-16 om 12:33 schreef BartC: But a 'proper' reference allows a complete replacement of what it refers to. That would mean being able to do: B = "Cat" print A # "Cat" No tricks involving in-place updates such as assigning to list elemen

Recursive type annotations

2016-06-08 Thread Nagy László Zsolt
class Test: def test(self, child : Test): pass NameError: name 'Test' is not defined I understand that the class "Test" is not defined until the class definition is executed. But it is very very common to build recursive data structures, and I have concrete use case where the IDE did

Re: Recursive type annotations

2016-06-08 Thread Jon Ribbens
On 2016-06-08, Nagy László Zsolt wrote: > class Test: > def test(self, child : Test): > pass > > NameError: name 'Test' is not defined I think you can fix this by using a string annotation as follows: class Test: def test(self, child: "Test"): pass -- https:/

Re: [Q] ImportError by __import__() on Python >= 3.4

2016-06-08 Thread Michael Selik
By the way, why choose to write, import, and delete modules? I'd think exec'ing code would be sufficient. On Wed, Jun 8, 2016, 5:52 AM Makoto Kuwata wrote: > On Tue, Jun 7, 2016 at 7:28 AM, Michael Selik > wrote: > >> On Thu, Jun 2, 2016 at 10:06 AM Makoto Kuwata wrote: >> >>> I have a trouble

Re: Recursive type annotations

2016-06-08 Thread Nagy László Zsolt
>> pass >> >> NameError: name 'Test' is not defined > I think you can fix this by using a string annotation as follows: > > class Test: > def test(self, child: "Test"): > pass Yes, you are right. It is not directly written in the official documentation ( https://doc

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

2016-06-08 Thread Antoon Pardon
Op 08-06-16 om 14:34 schreef BartC: > > So you have partial updates and full updates. A proper reference will > be able to do both via the reference. Python can only do a partial > update and the reason is that the reference points to the object, not > the variable; there is no way to change the va

Re: Recursive type annotations

2016-06-08 Thread Ian Kelly
On Wed, Jun 8, 2016 at 7:31 AM, Nagy László Zsolt wrote: > >>> pass >>> >>> NameError: name 'Test' is not defined >> I think you can fix this by using a string annotation as follows: >> >> class Test: >> def test(self, child: "Test"): >> pass > Yes, you are right. I

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

2016-06-08 Thread Marko Rauhamaa
Antoon Pardon : > You can do something like that in simula, but only because > simula has two kinds of assignments. One kind that is > simular to python and one that is similar to C. > The one that is similar that python is the reference assignment. I see Python as doing the exact same thing with

Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-08 Thread Robin Becker
On 08/06/2016 11:38, rocky wrote: ... [1] https://pypi.python.org/pypi/spark_parser/1.3.0 ... the page above shows one can implement a time travel machine as it boldly states "The original version of this was written by John Aycock and was described in his 1988 paper: “Compiling Li

Design an encrypted time-limited API on Client/Server side

2016-06-08 Thread iMath
​I am planning design an encrypted time-limited API on both Client and Server sides, the server side is written in Django, the client side is a GUI program which call the API by import requests c = requests.post("http://127.0.0.1:8000/VideoParser/";, data={'videoUrl': videoUrl }) The way it call

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

2016-06-08 Thread BartC
On 08/06/2016 15:18, Antoon Pardon wrote: Op 08-06-16 om 14:34 schreef BartC: So you have partial updates and full updates. A proper reference will be able to do both via the reference. Python can only do a partial update and the reason is that the reference points to the object, not the variab

Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-08 Thread rocky
On Wednesday, June 8, 2016 at 12:50:57 PM UTC-4, Robin Becker wrote: > On 08/06/2016 11:38, rocky wrote: > ... > > [1] https://pypi.python.org/pypi/spark_parser/1.3.0 > ... > the page above shows one can implement a time travel machine as it boldly > states > > "The original version o

Re: Possible PEP - two dimensional arrays?

2016-06-08 Thread Michael Torrie
On 06/07/2016 06:17 PM, 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 dictio

MAthematical formula terms make for terrible names in a program (was: What's good for mathematical formulas can be bad for program code (was: how to extract a variable as parameter which has index usi

2016-06-08 Thread Ben Finney
Steven D'Aprano writes: > On Wednesday 08 June 2016 17:31, meInvent bbird wrote: > > > H2 = [MM[mmm][b[i][0:1]+b[i][1:2]] for i in range(len(b))] > > This is a mess. I don't understand what you are trying to do. You have > these variable names that don't mean anything, like "b" and "H2", and > ot

Re: how to extract a variable as parameter which has index using by a for loop?

2016-06-08 Thread Ben Finney
meInvent bbird writes: > it is not convenient to disclose in detail > just expect to discuss from the view of programming It is not convenient to discuss programming without a good understanding of what the program is meant to do. (Also, please don't top-post, instead post your responses interl

Re: Recommendation for GUI lib?

2016-06-08 Thread Dietmar Schwertberger
On 07.06.2016 23:45, Roland Koebler via Python-list wrote: 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 Window

movie from pictures

2016-06-08 Thread nevzat . guler
Dear Users, I am trying to combine several pictures to create a movie file. I create the pictures in a loop. I would like to add each picture to a movie within the loop, like it is done in MATLAB. However, it is also acceptable to create all the picture in the loop, afterwards use some ffmpeg c

Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-08 Thread Gregory Ewing
Robin Becker wrote: "Python was conceived in the late 1980s[1] and its implementation was started in December 1989[2] by Guido van Rossum at CWI in the Netherlands" so that Aycocks's paper must have been at the -1st Python Conference When the time machine was invented, Guido thought it would

Re: movie from pictures

2016-06-08 Thread Lawrence D’Oliveiro
On Thursday, June 9, 2016 at 10:11:16 AM UTC+12, Nev wrote: > ... afterwards use some ffmpeg command to combine them into a picture. This is a very common use case for FFmpeg. 1) Generate your frames in some high-quality lossless format, like PNG. 2) Name them sequentially “0001.png”, “0002.png”

Re: for / while else doesn't make sense

2016-06-08 Thread Lawrence D’Oliveiro
On Wednesday, June 8, 2016 at 5:27:41 PM UTC+12, Marko Rauhamaa wrote: > Someone mentioned you had a 500-line function. In my undergraduate Comp Sci classes, we used to discuss arbitrary rules like limiting functions to n lines. With real-world experience, it soon became clear that such rules w

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

2016-06-08 Thread Lawrence D’Oliveiro
On Thursday, June 9, 2016 at 4:37:58 AM UTC+12, Marko Rauhamaa wrote: > I see Python as doing the exact same thing with variables as C. > > What is different is that in Python, every expression evaluates to a > pointer. Thus, you can only assign pointers to variables. Yup. I think some people are

xlwt 1.1.2 released!

2016-06-08 Thread Chris Withers
Hi All, I'm pleased to announce the release of xlwt 1.1.2. This release contains the following: - Fix failure in style compression under Python 3. - Documentation tweaks. If you find any problems, please ask about them on the python-ex...@googlegroups.com list, or submit an issue on GitHub:

xlutils 2.0.0 released!

2016-06-08 Thread Chris Withers
Hi All, I'm pleased to announce the release of xlutils 2.0.0: http://pypi.python.org/pypi/xlutils/2.0.0 This release has a couple of small changes: - Updated documentation. - Move to virtualenv/pip based development. - Move to Read The Docs for documentation. - Use Travis CI for testing and

run code error with numpy and scipy

2016-06-08 Thread meInvent bbird
when i run code in window has an error not a valid win32 dll then i install scipy first in this site, then install numpy-mkl all python 2.7 and win32 http://www.lfd.uci.edu/~gohlke/pythonlibs/ then i run code below, got error , and captured screen in this link https://drive.google.com/file/d/0B

Re: run code error with numpy and scipy

2016-06-08 Thread Ben Finney
meInvent bbird writes: > when i run code in window has an error not a valid win32 dll Simplify the example, to diagnose it. What is the *simplest* example code that shows the problem? In other words, remove statements from the example until the problem no longer happens. Then add back *one* sta

which library has map reduce and how to use it for this case

2016-06-08 Thread Ho Yeung Lee
i got M1 to M5 and V6 operator and would like to do a full combination and result will also act among each other, map reduce attract my application how to use this in this example? actually below is like vlookup then example is op3(op2(op1(x->y, y->z)), x->z) search which combinations will r