Re: List of Functions

2016-03-28 Thread Christian Gollwitzer
Am 29.03.16 um 08:21 schrieb Rustom Mody: Dijkstra liked to point out that CS was backward in America compared to Europe because in Europe they used 'store' but Americans used anthropomorphism like memory Now given that store can mean -- among other things -- - room where I dump stuff - shop wh

Re: List of Functions

2016-03-28 Thread Marko Rauhamaa
Rustom Mody : > And my mum made the strange remark: "You guys use all the words that I > know. And you make them into sentences that have no meaning at all." That's what I think when I hear Estonian spoken. > My own finding is that repurposing old words to new concepts causes > more confusion an

Re: [newbie] tkFileDialog does not show title

2016-03-28 Thread jenswaelkens
Op dinsdag 29 maart 2016 00:29:29 UTC+2 schreef Peter Pearson: > On Mon, 28 Mar 2016 14:10:28 -0700 (PDT), jenswaelk...@gmail.com wrote: > > I'm using the tkFileDialog-module in Python 2.7, it works fine except > > for one thing: when I add a title, the title isn't shown. > > > > e.g. I have this l

Re: Re-using TCL code from python over network

2016-03-28 Thread Christian Gollwitzer
Am 29.03.16 um 07:20 schrieb sharad1...@gmail.com: We've a test automation framework written in TCL (including the automated test cases). We are evaluating shifting to Python and have a test framework in Python (including the automated test cases). Python provides a lot more 3rd party libraries t

Re: List of Functions

2016-03-28 Thread Rustom Mody
On Tuesday, March 29, 2016 at 8:16:12 AM UTC+5:30, Ben Bacarisse wrote: > Steven D'Aprano writes: > > > On Mon, 28 Mar 2016 06:51 pm, Jussi Piitulainen wrote: > > > >> Ben Bacarisse writes: > >> > >>> It's shame that anonymous functions (for that's what's being returned > >>> here -- a function w

Re-using TCL code from python over network

2016-03-28 Thread sharad1087
Hi We've a test automation framework written in TCL (including the automated test cases). We are evaluating shifting to Python and have a test framework in Python (including the automated test cases). Python provides a lot more 3rd party libraries that we'd like to make use of. We use a pretty

Re: List of Functions

2016-03-28 Thread Chris Angelico
On Tue, Mar 29, 2016 at 3:45 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Tue, Mar 29, 2016 at 12:40 AM, Marko Rauhamaa wrote: >>> Dan Sommers : >>> On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: > As for Python, I don't feel a great need for anonymous functions.

Re: List of Functions

2016-03-28 Thread Marko Rauhamaa
Steven D'Aprano : > On Tue, 29 Mar 2016 08:40 am, Chris Angelico wrote: > >> On Tue, Mar 29, 2016 at 12:40 AM, Marko Rauhamaa wrote: >>> Dan Sommers : >>> On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: > As for Python, I don't feel a great need for anonymous functions. > H

Re: List of Functions

2016-03-28 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Mar 29, 2016 at 12:40 AM, Marko Rauhamaa wrote: >> Dan Sommers : >> >>> On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: >>> As for Python, I don't feel a great need for anonymous functions. However, I keep running into a need for anonymous classes, o

Re: Which are best, well-tested ways to create REST services, with Json, in Python?

2016-03-28 Thread justin walters
Hi David, once again, please reply all on this list. I sent you a couple of step by step guides. Pleas look at the links that I sent. On Mon, Mar 28, 2016 at 9:12 PM, David Shi wrote: > Hello, Justin, > > Is there any official step by step guide. > > Send me the download link and link to Offici

Re: Learning Python (or Haskell) makes you a worse programmer

2016-03-28 Thread Michael Torrie
On 03/28/2016 06:44 PM, Steven D'Aprano wrote: > http://lukeplant.me.uk/blog/posts/why-learning-haskell-python-makes-you-a-worse-programmer/ I have the same problem as the writer. Working in Python makes me really dislike working in any other language! -- https://mail.python.org/mailman/listinf

Re: Learning Python (or Haskell) makes you a worse programmer

2016-03-28 Thread Ethan Furman
On 03/28/2016 05:44 PM, Steven D'Aprano wrote: http://lukeplant.me.uk/blog/posts/why-learning-haskell-python-makes-you-a-worse-programmer/ Beautiful. And my deepest sympathies for the OP. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: List of Functions

2016-03-28 Thread Chris Angelico
On Tue, Mar 29, 2016 at 1:45 PM, Ben Bacarisse wrote: > If functions were defined > > fun f(x): return x * x > > then an anonymous function could be written as a function definition but > the name > > fun (x): return x * x > > I suppose you could do that even with "def" but it's a bit less > m

Re: List of Functions

2016-03-28 Thread Ben Bacarisse
Steven D'Aprano writes: > On Mon, 28 Mar 2016 06:51 pm, Jussi Piitulainen wrote: > >> Ben Bacarisse writes: >> >>> It's shame that anonymous functions (for that's what's being returned >>> here -- a function with no name) were born of a subject that used >>> arbitrary Greek letters for things.

Re: List of Functions

2016-03-28 Thread Rustom Mody
On Tuesday, March 29, 2016 at 5:11:02 AM UTC+5:30, Steven D'Aprano wrote: > On Mon, 28 Mar 2016 06:51 pm, Jussi Piitulainen wrote: > > > Ben Bacarisse writes: > > > >> It's shame that anonymous functions (for that's what's being returned > >> here -- a function with no name) were born of a subjec

Re: Which are best, well-tested ways to create REST services, with Json, in Python?

2016-03-28 Thread justin walters
On Mon, Mar 28, 2016 at 5:17 PM, David Shi wrote: > Hello, Justin, > > I am thinking of a fast, responsive, secure way of doing this. Python at > server-side. It provides REST services. Data exchange with the > web--page. Formatted XML or Json. > > Ideally, it uses the least code. > > Any exc

Learning Python (or Haskell) makes you a worse programmer

2016-03-28 Thread Steven D'Aprano
http://lukeplant.me.uk/blog/posts/why-learning-haskell-python-makes-you-a-worse-programmer/ -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: List of Functions

2016-03-28 Thread Chris Angelico
On Tue, Mar 29, 2016 at 10:50 AM, Random832 wrote: > On Mon, Mar 28, 2016, at 19:40, Steven D'Aprano wrote: >> Not to mention "Monad". I don't think *anyone* knows what a Monad is ;-) > > A monad is just a monoid in the category of endofunctors; what's the > problem? > > Well, someone had to say i

Re: List of Functions

2016-03-28 Thread Random832
On Mon, Mar 28, 2016, at 19:40, Steven D'Aprano wrote: > Not to mention "Monad". I don't think *anyone* knows what a Monad is ;-) A monad is just a monoid in the category of endofunctors; what's the problem? Well, someone had to say it. -- https://mail.python.org/mailman/listinfo/python-list

Re: List of Functions

2016-03-28 Thread Steven D'Aprano
On Mon, 28 Mar 2016 06:51 pm, Jussi Piitulainen wrote: > Ben Bacarisse writes: > >> It's shame that anonymous functions (for that's what's being returned >> here -- a function with no name) were born of a subject that used >> arbitrary Greek letters for things. We seem stuck with the mysterious

Re: List of Functions

2016-03-28 Thread Chris Angelico
On Tue, Mar 29, 2016 at 9:52 AM, Steven D'Aprano wrote: > That would be called "type" :-) > > type(name, bases, namespace) returns a new class: > > > py> C = type("MyClass", (object,), {'foo': 1}) > py> C > > py> C.foo > 1 Yeah, but to do that in a single expression, you need to have all the fun

Re: Which are best, well-tested ways to create REST services, with Json, in Python?

2016-03-28 Thread justin walters
On Mon, Mar 28, 2016 at 2:06 PM, David Shi via Python-list < python-list@python.org> wrote: > Has anyone done a recent reviews of creating REST services, in Python? > Regards. > David > -- > https://mail.python.org/mailman/listinfo/python-list > There are a ton of different ways to do this. Can y

Re: List of Functions

2016-03-28 Thread Steven D'Aprano
On Tue, 29 Mar 2016 08:40 am, Chris Angelico wrote: > On Tue, Mar 29, 2016 at 12:40 AM, Marko Rauhamaa wrote: >> Dan Sommers : >> >>> On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: >>> As for Python, I don't feel a great need for anonymous functions. However, I keep running i

Re: [newbie] tkFileDialog does not show title

2016-03-28 Thread Peter Pearson
On Mon, 28 Mar 2016 14:10:28 -0700 (PDT), jenswaelk...@gmail.com wrote: > I'm using the tkFileDialog-module in Python 2.7, it works fine except > for one thing: when I add a title, the title isn't shown. > > e.g. I have this line of code: > inputfilename=tkFileDialog.askopenfilename(defaultextensio

Re: [newbie] tkFileDialog does not show title

2016-03-28 Thread Wildman via Python-list
On Mon, 28 Mar 2016 14:10:28 -0700, jenswaelkens wrote: > I'm using the tkFileDialog-module in Python 2.7, it works fine except for one > thing: when I add a title, the title isn't shown. > > e.g. I have this line of code: > inputfilename=tkFileDialog.askopenfilename(defaultextension=".dat", >

Re: repeat items in a list

2016-03-28 Thread Erik
On 28/03/16 22:25, Chris Angelico wrote: Just out of interest, did you (generic you) happen to notice Mark's suggestion? It's a one-liner that nicely expresses the intention and accomplishes the goal: yy = [aa for aa in xx for _ in range(nrep)] It quietly went through without fanfare, but I wo

Re: Meta Data

2016-03-28 Thread Nick
Thanks Joel, A quick look on Amazon shows it is probably relevant. N. -- https://mail.python.org/mailman/listinfo/python-list

Re: Meta Data

2016-03-28 Thread Joel Goldstick
There is information in Pro Django Models chapter that may be what you want. Pro Django, Apress, Marty Alchin On Mon, Mar 28, 2016 at 4:49 PM, Nick wrote: > Django has the idea of specifying models using typed Fields. > The same exists within SQLAlchemy > > Are there any tutorials on setting up

Re: List of Functions

2016-03-28 Thread Chris Angelico
On Tue, Mar 29, 2016 at 12:40 AM, Marko Rauhamaa wrote: > Dan Sommers : > >> On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: >> >>> As for Python, I don't feel a great need for anonymous functions. >>> However, I keep running into a need for anonymous classes, or, >>> rather, classless o

Re: repeat items in a list

2016-03-28 Thread Chris Angelico
On Tue, Mar 29, 2016 at 4:30 AM, Rob Gaddi wrote: > beliav...@aol.com wrote: > >> On Saturday, March 26, 2016 at 7:24:10 PM UTC-4, Erik wrote: >>> >>> Or, if you want to "import operator" first, you can use 'operator.add' >>> instead of the lambda (but you _did_ ask for a one-liner ;)). >>> >>> Ou

[newbie] tkFileDialog does not show title

2016-03-28 Thread jenswaelkens
I'm using the tkFileDialog-module in Python 2.7, it works fine except for one thing: when I add a title, the title isn't shown. e.g. I have this line of code: inputfilename=tkFileDialog.askopenfilename(defaultextension=".dat", filetypes=(("data file", "*.dat"),("All Files", "*.*") ),title='Selec

Which are best, well-tested ways to create REST services, with Json, in Python?

2016-03-28 Thread David Shi via Python-list
Has anyone done a recent reviews of creating REST services, in Python? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Meta Data

2016-03-28 Thread Nick
Django has the idea of specifying models using typed Fields. The same exists within SQLAlchemy Are there any tutorials on setting up a similar system. ie. Declare classes and fields, query the meta data. Fields restricted to certain types. N. -- https://mail.python.org/mailman/listinfo/pytho

Re: Sending gmail with no clear password

2016-03-28 Thread Erik
Hi. It's hard to understand what your question is. On 28/03/16 20:55, zljubisic...@gmail.com wrote: > I have a python3 script that runs 24/7 on linux (raspberry pi) > server. It would be very nice for the script to be able to send an > email message about certain statuses. Reading between the li

Re: Why lambda in loop requires default?

2016-03-28 Thread Antoon Pardon
Op 27-03-16 om 03:46 schreef gvim: > Given that Python, like Ruby, is an object-oriented language why doesn't this: It has nothing to do with being object-oriented but by how scopes are used > def m(): > a = [] > for i in range(3): a.append(lambda: i) > return a Python doesn't create a new

Sending gmail with no clear password

2016-03-28 Thread zljubisicmob
Hi, I have a python3 script that runs 24/7 on linux (raspberry pi) server. It would be very nice for the script to be able to send an email message about certain statuses. As the linux server is headless, I don't have an option to key in the password while starting the script. Furthermore, fro

Re: Useless expressions [was Re: Undefined behaviour in C]

2016-03-28 Thread Terry Reedy
On 3/27/2016 9:26 PM, Steven D'Aprano wrote: On Mon, 28 Mar 2016 03:39 am, Terry Reedy wrote: So Bart is proposing whether 'actually' or 'hypothetically' I don't think Bart is intending this as an actual proposal to change Python so much as just a hypothetical to discuss. I don't remembe

Re: Using python heredoc to substitute the external file read by python script.

2016-03-28 Thread Ben Finney
I don't understand what you're trying to do. But I think you have fixed your problem: Hongyi Zhao writes: > It seems the above code will do the job for me. If I understand correctly this sentence, you now have a satisfactory solution. Good! -- \ “A man must consider what a rich realm

Re: repeat items in a list

2016-03-28 Thread Rob Gaddi
beliav...@aol.com wrote: > On Saturday, March 26, 2016 at 7:24:10 PM UTC-4, Erik wrote: >> >> Or, if you want to "import operator" first, you can use 'operator.add' >> instead of the lambda (but you _did_ ask for a one-liner ;)). >> >> Out of interest, why the fascination with one-liners? > > T

Re: Useless expressions [was Re: Undefined behaviour in C]

2016-03-28 Thread BartC
On 28/03/2016 02:24, Steven D'Aprano wrote: On Sun, 27 Mar 2016 10:31 pm, BartC wrote: Whether there are side-effects is not quite as important as picking up things that are likely to be errors: f() # Probably OK g() # Probably OK f()+g() # Probably not OK Yo

Re: List of Functions

2016-03-28 Thread Marko Rauhamaa
Dan Sommers : > On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: > >> As for Python, I don't feel a great need for anonymous functions. >> However, I keep running into a need for anonymous classes, or, >> rather, classless objects. Not a biggie. I just create a one-off >> inner class and

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-28 Thread Ben Bacarisse
BartC writes: > On 28/03/2016 01:54, Steven D'Aprano wrote: >> What should be the return value of this statement? >> >> while True: >> x += 1 >> if condition: break > > Many statements such as loops just returned 'void' in A68. The > interesting statements were if, case-switch and bloc

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-28 Thread Paul Rubin
BartC writes: > With more recent ones I've dropped that model, so that statements and > expressions are different, and that is strictly enforced. This makes > implementation simpler, and detects lots more errors. You should try Haskell, where there are only expressions, but the ones that perform

Re: List of Functions

2016-03-28 Thread Dan Sommers
On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: > As for Python, I don't feel a great need for anonymous functions. > However, I keep running into a need for anonymous classes, or, rather, > classless objects. Not a biggie. I just create a one-off inner class > and instantiate it, but I

Re: Useless expressions [was Re: Undefined behaviour in C]

2016-03-28 Thread Marko Rauhamaa
BartC : > So no matter how many potentially useful counter-examples you can dig > up, non-function-call expressions are still going to be highly > unusual. And suspect. > > That's why it's not going to be much loss to disallow them /in that > form/. Note that operators are front ends for dunder m

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-28 Thread BartC
On 28/03/2016 01:54, Steven D'Aprano wrote: On Mon, 28 Mar 2016 03:58 am, BartC wrote: One of Guido's principles in designing Python was to keep it simple, even where that might mean people could make errors with it. This part of the language is no different: any expression can be a statement.

Re: List of Functions

2016-03-28 Thread Marko Rauhamaa
Jussi Piitulainen : > Ben Bacarisse writes: >> It's shame that anonymous functions (for that's what's being returned >> here -- a function with no name) were born of a subject that used >> arbitrary Greek letters for things. We seem stuck with the mysterious >> but meaningless "lambda" for a very

Re: List of Functions

2016-03-28 Thread Jussi Piitulainen
Ben Bacarisse writes: > It's shame that anonymous functions (for that's what's being returned > here -- a function with no name) were born of a subject that used > arbitrary Greek letters for things. We seem stuck with the mysterious > but meaningless "lambda" for a very simple and useful idea.

Re: Path when reading an external file

2016-03-28 Thread ast
"Martin A. Brown" a écrit dans le message de news:mailman.108.1459179618.28225.python-l...@python.org... Greetings, In a program "code.py" I read an external file "foo.txt" supposed to be located in the same directory that "code.py" python/src/code.py python/src/foo.txt In "code.py": f =

Re: Path when reading an external file

2016-03-28 Thread Martin A. Brown
Greetings, > In a program "code.py" I read an external file "foo.txt" supposed > to be located in the same directory that "code.py" > > python/src/code.py > python/src/foo.txt > > In "code.py": f = open('foo.txt', 'r') > > But if I run "python code.py" in an other dir than src/ say in > python/

Re: newbie question

2016-03-28 Thread ast
"Matt Wheeler" a écrit dans le message de news:mailman.92.1458825746.2244.python-l...@python.org... On Thu, 24 Mar 2016 11:10 Sven R. Kunze, wrote: On 24.03.2016 11:57, Matt Wheeler wrote: import ast s = "(1, 2, 3, 4)" t = ast.literal_eval(s) t > (1, 2, 3, 4) I suppose

Path when reading an external file

2016-03-28 Thread ast
Hello In a program "code.py" I read an external file "foo.txt" supposed to be located in the same directory that "code.py" python/src/code.py python/src/foo.txt In "code.py": f = open('foo.txt', 'r') But if I run "python code.py" in an other dir than src/ say in python/, it will not work bec

Re: Problem With Embedded Icon and Python 3.4

2016-03-28 Thread Wildman via Python-list
On Mon, 28 Mar 2016 10:36:44 +0100, Mark Lawrence wrote: > On 26/03/2016 02:37, Wildman via Python-list wrote: >> On Sat, 26 Mar 2016 01:42:37 +, Mark Lawrence wrote: >> >>> On 25/03/2016 05:10, Wildman via Python-list wrote: I have a program that I have been trying to rewrite so it will

Re: repeat items in a list

2016-03-28 Thread Random832
On Mon, Mar 28, 2016, at 07:36, larudwer wrote: > in case you want to mainain order: > > ["a","b"]*3 > ['a', 'b', 'a', 'b', 'a', 'b'] > > is completely suffincient. I think you've completely missed the point of what order he's talking about. How do you turn ['a', 'c', 'b'] into ['a', 'a',

Re: Using python heredoc to substitute the external file read by python script.

2016-03-28 Thread Hongyi Zhao
On Mon, 28 Mar 2016 21:29:48 +1100, Ben Finney wrote: >> If I want to use python heredoc to substitute this external file for >> the above codes. Is this possible? > > What do you mean by “Python heredoc”? What Python feature are you > referring to? I find the following methods currently: impor

Re: repeat items in a list

2016-03-28 Thread larudwer
Am 27.03.2016 um 13:13 schrieb Antonio Caminero Garcia: On Sunday, March 27, 2016 at 11:52:22 AM UTC+2, larudwer wrote: how about sorted(["a", "b"]*3) ['a', 'a', 'a', 'b', 'b', 'b'] that's cooler, less efficient though and do not maintain the original order. In case such order was impo

Re: Using python heredoc to substitute the external file read by python script.

2016-03-28 Thread Ben Finney
Hongyi Zhao writes: > If I want to use python heredoc to substitute this external file for > the above codes. Is this possible? What do you mean by “Python heredoc”? What Python feature are you referring to? -- \ “Anyone who puts a small gloss on [a] fundamental technology, | `\

Re: Problem With Embedded Icon and Python 3.4

2016-03-28 Thread Mark Lawrence
On 26/03/2016 02:37, Wildman via Python-list wrote: On Sat, 26 Mar 2016 01:42:37 +, Mark Lawrence wrote: On 25/03/2016 05:10, Wildman via Python-list wrote: I have a program that I have been trying to rewrite so it will run on Python 2.7 and 3.4. This http://pythonhosted.org/six/ might c

Pyaudio and sockets

2016-03-28 Thread Shiva Upreti
I am trying to send audio using sockets to a different PC, but audio is not clear on the other end and I cant understand why. Here is the code: import socket import pyaudio import wave import sys import pickle import time HOST="" PORT=1061 s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) CHU

Using python heredoc to substitute the external file read by python script.

2016-03-28 Thread Hongyi Zhao
Hi all, See the following python codes: import os from subprocess import check_output # POSIX: name shall not contain '=', value doesn't contain '\0' output = check_output("source /home/werner/env-intel-toolchains.sh; env -0", shell=True, executable="/bin/bash") In the above codes, I

Re: help with program

2016-03-28 Thread Sibylle Koczian
Am 28.03.2016 um 02:20 schrieb Steven D'Aprano: On Mon, 28 Mar 2016 01:18 am, Bob Gailer wrote: The problem with putting input at the end of a program is: if the program raises an exception you won't see it. True. But the solution to that is simple: don't make mistakes when programming :-) I