Re: tkinter MP working like a charm

2017-12-31 Thread Terry Reedy
On 12/31/2017 8:52 PM, Terry Reedy wrote: To do everything in the main thread, one can replace 'root.mainloop' with loop.run_forever (in the main thread) and repeated root.update calls. Wu Xi's example, rewritten more or less as suggested: from tkinter import * from tkinter import messagebox

Re: tkinter MP working like a charm

2017-12-31 Thread Terry Reedy
On 12/30/2017 7:57 PM, Wu Xi wrote: from tkinter import *#I cant see anything wrong with this , it works like a charm This imports about 200 names. A reader may not know which names are builtins and which are imports. There may also be accidental

Re: PyWin32 installer question

2017-12-29 Thread Terry Reedy
On 12/29/2017 11:38 AM, Paul Moore wrote: On 29 December 2017 at 16:04, Skip Montanaro wrote: Thanks. I'll shoot Thomas Heller an email... Actually, make that Christopher Toth. Seems he's the current maintainer. If you get no joy there, then in a week or two,

Re: Using the variable type annotation syntax as a placeholder in a nonlocal scope?

2017-12-22 Thread Terry Reedy
On 12/22/2017 8:53 AM, Kirill Balunov wrote: On Dec 20, 2017 22:43, "Kirill Balunov" wrote: Since PEP 526 -- Syntax for Variable Annotations was approved, in Python 3.6+ it is possible to provide type hint information in

Re: Regarding the error: TypeError: can’t pickle _thread.lock objects

2017-12-21 Thread Terry Reedy
On 12/21/2017 8:11 AM, Winston Manuel Vijay wrote: Hi, It would be of immense help, if someone could provide a suitable solution or related information that helps to sort out the below stated issue- Ø I had installed the Python version 3.6.4 Ø Then I installed the package: Tensorflow Ø

Re: How to edit a function in an interactive python session?

2017-12-21 Thread Terry Reedy
On 12/20/2017 8:42 PM, Peng Yu wrote: R has the function edit() which allows the editing of the definition of a function. Does python have something similar so that users can edit python functions on the fly? Thanks. https://www.rdocumentation.org/packages/utils/versions/3.4.3/topics/edit In

Re: correctness proof for alpha-beta algorithm

2017-12-18 Thread Terry Reedy
On 12/19/2017 1:01 AM, namenobodywa...@gmail.com wrote: can anybody tell me where to look for a proof of the correctness of a minimax/negamax algorithm with alpha-beta pruning? thanks if you can help Where or how have you looked so far? How formal do you want? -- Terry Jan Reedy --

Re: Python Learning

2017-12-16 Thread Terry Reedy
On 12/16/2017 8:26 AM, Marko Rauhamaa wrote: Unfortunately, Python's indentation mechanism makes the REPL too frustrating an environment to type in even the simplest of function definitions, let alone a whole class. The fundamental problem is that most REPLs are for 'command lines', and

Re: Can't start IDLE on mac os x high sierra can't import Tkinter

2017-12-15 Thread Terry Reedy
On 12/15/2017 6:37 AM, ceiussandi...@gmail.com wrote: Hi, I've been trying to get python 3.4.3 (needed for programming course) on my mac, running High Sierra. I've installed python and activetcl 8.5.18 as per instructions. When I start IDLE from finder it flashes in the dock and disappears.

Re: Python homework

2017-12-13 Thread Terry Reedy
On 12/13/2017 8:28 AM, bo...@choices.random.py wrote: nick.martin...@aol.com (nick martinez2) writes: def rollDie(number): rolls = [0] * 6 for i in range(0, number): roll=int(random.randint(1,6)) One could just as well use randint(0, 5) and skip the -1 below.

Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-12-09 Thread Terry Reedy
On 12/9/2017 5:57 AM, Gilmeh Serda wrote: And next demands to allow Unicode as keywords in a translated version of Python Python's liberal open source license allows people to revise and distribute their own python or python-like interpreters. I believe there are already a couple of

Re: How to use a regexp here

2017-12-08 Thread Terry Reedy
On 12/4/2017 11:14 AM, Ned Batchelder wrote: > On 12/4/17 9:13 AM, Rick Johnson wrote: >> Perhaps it's not politically correct for me to say this, but >> i've never been one who cared much about political >> correctness, so i'm just going to say it... > > Cecil, feel free to ignore the rest of

Re: we want python software

2017-12-06 Thread Terry Reedy
On 12/5/2017 4:39 PM, Igor Korot wrote: Hi, Tony, On Tue, Dec 5, 2017 at 11:10 AM, Tony van der Hoff wrote: On 05/12/17 16:55, Igor Korot wrote: Hi, On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy wrote: Sir, I am b.tech

Re: why won't slicing lists raise IndexError?

2017-12-06 Thread Terry Reedy
On 12/5/2017 9:23 PM, Rick Johnson wrote: Steve D'Aprano wrote: [...] You've already been told that there's no indication or reason to believe that it is a non-action. You've already been given at least one possible action. It isn't a non- action, it is two distinct actions: - the action you

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Terry Reedy
On 12/4/2017 1:54 PM, Jason Maldonis wrote: I was extending a `list` and am wondering why slicing lists will never raise an IndexError, even if the `slice.stop` value if greater than the list length. Is there any background on why that doesn't raise an IndexError? Slicing is perhaps most

Re: How to use a regexp here

2017-12-04 Thread Terry Reedy
On 12/4/2017 11:14 AM, Ned Batchelder wrote: On 12/4/17 9:13 AM, Rick Johnson wrote: Perhaps it's not politically correct for me to say this, but i've never been one who cared much about political correctness, so i'm just going to say it... Cecil, feel free to ignore the rest of Rick's

Re: asyncio loop.call_soon()

2017-11-28 Thread Terry Reedy
On 11/28/2017 11:02 AM, Ian Kelly wrote: On Tue, Nov 28, 2017 at 8:30 AM, ast wrote: Hello Python's doc says about loop.call_soon(callback, *arg): Arrange for a callback to be called as soon as possible. The callback is called after call_soon() returns, when control

Re: Compile Python 3 interpreter to force 2-byte unicode

2017-11-26 Thread nospam . nospam . Terry Reedy
On 11/25/2017 5:12 PM, Chris Angelico wrote: > On Sun, Nov 26, 2017 at 9:05 AM, wrote: >> Hi, my goal is to obtain an interpreter that internally >> uses UCS-2. Such a simple code should print 65535: >> >>import sys >>print sys.maxunicode >> >> This is enabled in

Re: connect four (game)

2017-11-26 Thread nospam . nospam . Terry Reedy
On 11/25/2017 4:57 PM, namenobodywa...@gmail.com wrote: > On Saturday, November 25, 2017 at 12:48:38 AM UTC-8, Terry Reedy wrote: > >> I did, and it looks buggy to me. The top and left frame lines are >> missing. If I click a square, the bottom square in the column lights >&

Re: connect four (game)

2017-11-26 Thread nospam . Terry Reedy
On 11/25/2017 4:57 PM, namenobodywa...@gmail.com wrote: > On Saturday, November 25, 2017 at 12:48:38 AM UTC-8, Terry Reedy wrote: > >> I did, and it looks buggy to me. The top and left frame lines are >> missing. If I click a square, the bottom square in the column lights >&

Re: Compile Python 3 interpreter to force 2-byte unicode

2017-11-26 Thread nospam . Terry Reedy
On 11/25/2017 5:12 PM, Chris Angelico wrote: > On Sun, Nov 26, 2017 at 9:05 AM, wrote: >> Hi, my goal is to obtain an interpreter that internally >> uses UCS-2. Such a simple code should print 65535: >> >>import sys >>print sys.maxunicode >> >> This is enabled in

Re: Compile Python 3 interpreter to force 2-byte unicode

2017-11-25 Thread Terry Reedy
On 11/25/2017 5:12 PM, Chris Angelico wrote: On Sun, Nov 26, 2017 at 9:05 AM, wrote: Hi, my goal is to obtain an interpreter that internally uses UCS-2. Such a simple code should print 65535: import sys print sys.maxunicode This is enabled in Windows, but I want

Re: connect four (game)

2017-11-25 Thread Terry Reedy
On 11/25/2017 4:57 PM, namenobodywa...@gmail.com wrote: On Saturday, November 25, 2017 at 12:48:38 AM UTC-8, Terry Reedy wrote: I did, and it looks buggy to me. The top and left frame lines are missing. If I click a square, the bottom square in the column lights up. But then I have no idea

Re: connect four (game)

2017-11-25 Thread Terry Reedy
On 11/24/2017 9:05 PM, namenobodywa...@gmail.com wrote: On Friday, November 24, 2017 at 12:13:18 PM UTC-8, Terry Reedy wrote: Since you did not start with tests or write tests as you wrote code, ... that I could tell ... I agree that I should have stuck in a qualifier, such as 'apparently

Re: Issues encountered while launching the IDLE of python 3.7 64-bit I downloaded recently.

2017-11-24 Thread Terry Reedy
On 11/24/2017 6:39 PM, STEPHINEXT TUTORIALS wrote: On Wed, Nov 22, 2017 at 4:29 AM, STEPHINEXT TUTORIALS < oladejist...@gmail.com> wrote: I just downloaded the new version 3.7 for my windows operating system 64-bits on your site. Does Python itself run? The error I got while launching the

Re: Benefits of unicode identifiers

2017-11-24 Thread Terry Reedy
On 11/24/2017 7:12 AM, bartc wrote: π = 3.141; That's great. But how do I type it on my keyboard? How do I view someone else's code on my crappy ASCII text editor? Input is a problem, but for reading, Python comes with a half-way decent Unicode BMP code editor, IDLE. No one needs to use a

Re: connect four (game)

2017-11-24 Thread Terry Reedy
On 11/24/2017 10:33 AM, namenobodywa...@gmail.com wrote: hi all i've just finished my first excursion into artificial intelligence with a game less trivial than tictactoe, and here it is in case anybody can offer criticism/suggestions/etc Since you did not start with tests or write tests as

Re: Should constants be introduced to Python?

2017-11-16 Thread Terry Reedy
On 11/16/2017 4:55 PM, Michael Torrie wrote: On 11/15/2017 11:16 PM, Saeed Baig wrote: - Do you guys think it would be a good idea? Why or why not? Do you think there’s a better way to do it? I’d like to know what others think about this idea before making any formal submission. Except for

Re: Windows - py363 crashes with "vonLöwis.py"

2017-11-16 Thread Terry Reedy
On 11/16/2017 5:51 AM, breamore...@gmail.com wrote: On Thursday, November 16, 2017 at 8:43:24 AM UTC, wxjm...@gmail.com wrote: Mark: Jmf's troll posts to the Google group are not propagated to python-list and the gmane mirror except when people, like you here, quote him. Please stop. Do

Re: Windows - py363 crashes with "vonLöwis.py"

2017-11-15 Thread Terry Reedy
On 11/15/2017 6:58 AM, breamore...@gmail.com wrote: On Wednesday, November 15, 2017 at 8:53:44 AM UTC, wxjm...@gmail.com wrote: Sorry, to have to say it. Have a nice day. Do you mean it segfaults or simply provides a traceback? If the latter is your environment set correctly? Why bother?

Re: How to modify this from Python 2.x to v3.4?

2017-11-11 Thread Terry Reedy
On 11/11/2017 9:06 PM, jf...@ms4.hinet.net wrote: Ned Batchelder於 2017年11月11日星期六 UTC+8下午8時49分27秒寫道: This looks like fairly advanced code.  It will be difficult to port to Python 3 *without* understanding some of the old history.  There seem to be forks on GitHub, including one with a pull

Re: Python Mailing list moderators

2017-11-05 Thread Terry Reedy
On 11/5/2017 4:14 PM, Cameron Simpson wrote: On 05Nov2017 13:09, Στέφανος Σωφρονίου wrote: Folks, More and more nonsense are coming in and I find it really difficult to follow any new post that may come and I have to either search for specific content or

Re: [TSBOAPOOOWTDI]using names from modules

2017-11-04 Thread Terry Reedy
On 11/4/2017 3:42 PM, Stefan Ram wrote: What is better: ... import math ... ... math.cos ... ... or ... from math import cos ... ... cos ... ... ? (To me, the first is more readable, because at the site where »math.cos« is used, it is made clear that »cos« comes from math.

Re: python3 byte decode

2017-11-03 Thread Terry Reedy
On 11/3/2017 5:24 AM, Ali Rıza KELEŞ wrote: Hi, Yesterday, while working with redis, i encountered a strange case. I want to ask why is the following `True` ``` "s" is b"s".decode() ``` while the followings are `False`? ``` "so" is b"so".decode() "som" is b"som".decode() "some" is

Re: A use-case for for...else with no break

2017-11-02 Thread Terry Reedy
On 11/2/2017 8:53 PM, Steve D'Aprano wrote: On Fri, 3 Nov 2017 09:20 am, Terry Reedy wrote: This seems like a bug in how Python interacts with your console. On Windows, in Python started from an icon or in Command Prompt: >>> for c in 'abc': print(c, end='') ... abc>>&

Re: FW: Reading a remove csv file

2017-11-02 Thread Terry Reedy
On 11/2/2017 9:18 AM, ROGER GRAYDON CHRISTMAN wrote: I have a partial answer to my own question: This seems to work for me: --- link = urllib.request.urlopen(urlpath) data = link.read().decode('utf-8').split('\n') reader = csv.DictReader(data) for row in reader: --- I think here my concern is

Re: A use-case for for...else with no break

2017-11-02 Thread Terry Reedy
On 11/2/2017 6:10 AM, Steve D'Aprano wrote: Occasionally it is useful to loop over a bunch of stuff in the interactive interpreter, printing them as you go on a single line: for x in something(): print(x, end='') If you do that, the prompt overwrites your output, and you get a mess: py>

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Terry Reedy
On 11/1/2017 5:12 PM, Alexey Muranov wrote: what do you think about the idea of replacing "`else`" with "`then`" in the contexts of `for` and `try`? This idea has been argued to death more than once before. I am opposed on both logical and practical grounds, but will not repeat myself for

Re: IDLE doesn't recognise installed packages

2017-10-26 Thread Terry Reedy
inary -m pip <args) on a command line. Your path-to-binary appears to be C:\Users\Daniel86\AppData\Local\Programs\Python\Python36\python.exe You should be able to replace that with py -3.6 but try py -3.6 -c "import sys; sys.executable" to be sure. Terry Reedy <tjre..

Re: Let's talk about debuggers!

2017-10-25 Thread Terry Reedy
On 10/25/2017 12:12 PM, Thomas Jollans wrote: On 2017-10-25 15:57, Rustom Mody wrote: pdb inside emacs works (to a fashion) And it shows the arrow for current line so its at least quasi-gui I believe idle too is much more usable than a few years earlier I haven't used IDLE in years (if

Re: IDLE doesn't recognise installed packages

2017-10-24 Thread Terry Reedy
On 10/23/2017 10:23 AM, Daniel Tangemann wrote: I've recently downloaded and installed python 3.6. (I had already also 2.7 and 3.2 on my computer) Initially pip was looking in the wrong directory to install to, so I changed that. then it had trouble installing matplotlib, so I decided to get

Re: How to debug an unfired tkinter event?

2017-10-21 Thread Terry Reedy
On 10/21/2017 1:25 PM, jf...@ms4.hinet.net wrote: Terry Reedy at 2017-10-20 UTC+8 AM 7:37:59 wrote: On 10/19/2017 5:07 AM, jf...@ms4.hinet.net wrote: I got some info below each time when I squeeze the table: . .5006 .5006.50712528 .5006.50712496 .5006.50712464

Re: How to debug an unfired tkinter event?

2017-10-19 Thread Terry Reedy
On 10/19/2017 11:28 PM, jf...@ms4.hinet.net wrote: Terry Reedy於 2017年10月20日星期五 UTC+8上午7時37分59秒寫道: On 10/19/2017 5:07 AM, jf...@ms4.hinet.net wrote: I got some info below each time when I squeeze the table: . .5006 .5006.50712528 .5006.50712496 .5006.50712464 .5006.50712144

Re: How to debug an unfired tkinter event?

2017-10-19 Thread Terry Reedy
On 10/19/2017 5:07 AM, jf...@ms4.hinet.net wrote: I got some info below each time when I squeeze the table: . .5006 .5006.50712528 .5006.50712496 .5006.50712464 .5006.50712144 .5006.50712528.50712560.50782256 .5006.50712528.50712560.50782256.50783024

Re: Can't find latest version of 3.4.x on download page

2017-10-18 Thread Terry Reedy
On 10/18/2017 2:09 AM, Christopher Reimer wrote: Greetings, I'm setting up different test environments for tox. I can't find Windows installer for the latest version of Python 3.4 on the download page. Versions 3.4.5 to 3.4.7 only have the source files available. Correct. These are

Re: multiprocessing shows no benefit

2017-10-17 Thread Terry Reedy
On 10/17/2017 10:52 AM, Jason wrote: I've got problem that I thought would scale well across cores. What OS? def f(t): return t[0]-d[ t[1] ] d= {k: np.array(k) for k in entries_16k } e = np.array() pool.map(f, [(e, k) for k in d] *Every* multiprocessing example in the doc

Re: why del is not a function or method?

2017-10-17 Thread Terry Reedy
On 10/17/2017 1:07 AM, Steve D'Aprano wrote: The point is, if del were a function, then calling del(x) would pass the *value* of x into the function, not the name 'x' So we would have to quote either the entire rest of the statement, or each item separately, -- unless the interpreter

Re: how to read in the newsreader

2017-10-16 Thread Terry Reedy
On 10/15/2017 10:50 PM, Andrew Z wrote: Gents, how do i get this group in a newsreader? Point your newsreader to news.gmane.org, group gmane.comp.python.general, which mirrors python-list, among hundreds or thousands of other lists. If you check the headers of this message, you should

Re: Unable to run pip in Windows 10

2017-10-11 Thread Terry Reedy
On 10/11/2017 10:46 AM, Michael Cuddehe wrote: - What exactly did you install? Latest install: Python 3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)] on win32 Downloaded from python.org. - Can you start the Python interpreter? Yes...works fine. * How exactly

Re: Unable to run pip in Windows 10

2017-10-11 Thread Terry Reedy
On 10/11/2017 11:54 AM, Michael Torrie wrote: On 10/11/2017 08:46 AM, Michael Cuddehe wrote: - What exactly did you install? Latest install: Python 3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)] on win32 ^^^ This is exactly what I

Re: about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread Terry Reedy
On 10/10/2017 10:37 AM, xieyuheng wrote: 2. what kind of functions does not have signature, so that 'inspect.signature(f)' can be used for them ? When .signature was added, it may not have been usable with *any* C-coded function. About the same, a mechanism was added to make signatures

Re: Is there a way to globally set the print function separator?

2017-10-09 Thread Terry Reedy
On 10/9/2017 12:22 PM, John Black wrote: I want sep="" to be the default without having to specify it every time I call print. Is that possible? John Black Define a replacement print function that makes this the default. Something like (untested, a detail may be wrong): _print = print def

Re: IDLE help.

2017-10-08 Thread Terry Reedy
On 10/8/2017 5:24 AM, Joe Wilde wrote: I am having trouble getting IDLE (Python 3.6 - 64-bit) to open for Windows 10. When I try and run IDLE, nothing happens. It works fine for Python 2.7, but won't open for Python 3.6. Give more information. How did you install Python? Did you select the

Re: The "loop and a half"

2017-10-07 Thread Terry Reedy
On 10/7/2017 10:45 AM, Grant Edwards wrote: On 2017-10-07, bartc wrote: Interactive Python requires quit() or exit(), complete with parentheses. Nonsense. On Unix you can just press ctrl-D (or whatever you have configured as eof) at the command prompt. On windows, it's

Re: Introducing the "for" loop

2017-10-07 Thread Terry Reedy
On 10/7/2017 5:09 AM, Steve D'Aprano wrote: On Fri, 6 Oct 2017 11:44 pm, ROGER GRAYDON CHRISTMAN wrote: Despite the documentation, I would still be tempted to say that range is a function. Taking duck-typing to the meta-level, every time I use range, I use its name followed by a pair of

Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]

2017-10-07 Thread Terry Reedy
On 10/6/2017 8:19 PM, Steve D'Aprano wrote: On Sat, 7 Oct 2017 05:33 am, Grant Edwards wrote: On 2017-10-06, Marko Rauhamaa wrote: The reason a daemon usually opens dummy file descriptors for the 0, 1 and 2 slots is to avoid accidents. Some library might assume the

Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]

2017-10-06 Thread Terry Reedy
On 10/6/2017 1:32 PM, Chris Angelico wrote: On Sat, Oct 7, 2017 at 4:05 AM, Grant Edwards wrote: On 2017-10-06, Thomas Jollans wrote: Seriously? sys.stdin can be None? That's terrifying. Why? Unix daemons usually run with no stdin, stderr, or

Re: Introducing the "for" loop

2017-10-06 Thread Terry Reedy
On 10/6/2017 8:44 AM, ROGER GRAYDON CHRISTMAN wrote: Despite the documentation, I would still be tempted to say that range is a function. It is, *according* to the documentation. Built-in classes are included in Library Reference, Ch. 2, Built-in Functions. Changing that to "Built-in

Re: The "loop and a half"

2017-10-04 Thread Terry Reedy
On 10/4/2017 1:24 PM, Grant Edwards wrote: On 2017-10-04, Steve D'Aprano wrote: It is sometimes called the loop and a half problem. The idea is that you must attempt to read a line from the file before you know whether you are at the end of file or not. Utter

Re: The "loop and a half"

2017-10-03 Thread Terry Reedy
On 10/3/2017 2:10 PM, Peter Otten wrote: Stefan Ram wrote: Is this the best way to write a "loop and a half" in Python? [snip while loop] Use iter() and a for loop: def input_int(): ... return int(input("Enter number (0 to terminate): ")) ... for x in iter(input_int, 0): ...

Re: F5 not working?

2017-10-03 Thread Terry Reedy
On 10/3/2017 2:02 PM, Breta Skinner wrote: Hello, I tried looking around the website, but didn't see a question about function keys. Somehow, I "turned off" the F5 function in the IDLE. It no longer "run module", but just does nothing. I have downloaded the newest version, 3.7, but that did not

Re: Textwrap doesn't honour NO-BREAK SPACE

2017-09-28 Thread Terry Reedy
On 9/29/2017 1:25 AM, Steve D'Aprano wrote: I don't have Python 3.6 installed, can somebody check to see whether or not it shows the same (wrong) behaviour? import textwrap text = ('Lorum ipsum dolor sit amet, consectetur adipiscing' ' elit ZZZ\xa0ZZZ sed do euismod tempor incididunt'

Re: EuroPython 2017: Videos for Monday available online

2017-09-28 Thread Terry Reedy
On 9/28/2017 12:33 PM, M.-A. Lemburg wrote: """ In the coming weeks, we will release the other videos, in batches of one conference day per week. """ It was not obvious to me that 'private video' meant 'non-existent, not yet added video'. It usually means a video that is present but not

Re: EuroPython 2017: Videos for Monday available online

2017-09-28 Thread Terry Reedy
On 9/28/2017 8:15 AM, M.-A. Lemburg wrote: We are pleased to announce the first batch of cut videos for EuroPython 2017. To see the videos, please head over to our EuroPython YouTube channel and select the “EuroPython 2017″ playlist: * EuroPython 2017 Videos *

Re: Beginners and experts (Batchelder blog post)

2017-09-23 Thread Terry Reedy
On 9/23/2017 2:52 PM, Leam Hall wrote: On 09/23/2017 02:40 PM, Terry Reedy wrote: https://nedbatchelder.com//blog/201709/beginners_and_experts.html Great post. Yup. Thanks for the link. I often have that "I bet Fred> doesn't get frustrated." thing going. Nice to know Ned bangs

Beginners and experts (Batchelder blog post)

2017-09-23 Thread Terry Reedy
https://nedbatchelder.com//blog/201709/beginners_and_experts.html Great post. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Fwd: Issues with python commands in windows powershell

2017-09-20 Thread Terry Reedy
On 9/20/2017 1:09 PM, Joey Steward wrote: -- Forwarded message -- From: Joey Steward Date: Tue, Sep 19, 2017 at 10:30 PM Subject: Issues with python commands in windows powershell To: python-list@python.org Hello, I've been having issues using basic

Re: [Tutor] beginning to code

2017-09-17 Thread Terry Reedy
On 9/17/2017 4:39 PM, Rick Johnson wrote: My point is that Python source code was meant to be "executable pseudo code" (Python devs' words not mine!), The coinage 'Executable pseudocode' was my description of Python on comp.lang.python, mirrored to this list, in April 1997, long before I

Re: Research paper "Energy Efficiency across Programming Languages: How does energy, time, and memory relate?"

2017-09-17 Thread Terry Reedy
On 9/16/2017 7:04 PM, breamore...@gmail.com wrote: I thought some might find this https://sites.google.com/view/energy-efficiency-languages/ interesting. By 'energy', they only mean electricity, not food calories. This is the email I sent to the authors. --- As a two-decade user of

Re: Standard for dict-contants with duplicate keys?

2017-09-15 Thread Terry Reedy
On 9/15/2017 3:36 PM, Tim Chase wrote: Looking through docs, I was unable to tease out whether there's a prescribed behavior for the results of defining a dictionary with the same keys multiple times d = { "a": 0, "a": 1, "a": 2, } In my limited testing, it appears

Re: "tkinter"

2017-09-13 Thread Terry Reedy
On 9/13/2017 6:46 PM, Ben Finney wrote: r...@zedat.fu-berlin.de (Stefan Ram) writes: I presume that "tkinter" is intended to be pronounced "logically": T K inter (tee kay inter /ti keI In t%/) This is how I've always pronounced it. The toolkit in question is named “tk”, which I have

Re: "tkinter"

2017-09-13 Thread Terry Reedy
On 9/13/2017 3:09 PM, Grant Edwards wrote: I tried to write a small (but non-trivial) Tcl app once[1], and would happily vote to bury Tcl and then might even dance on its grave. Tkinter, OTOH, is great for small, simple GUI apps -- with a few caveats: 1. You have to grit your teeth because

Re: The Incredible Growth of Python (stackoverflow.blog)

2017-09-13 Thread Terry Reedy
On 9/13/2017 2:44 AM, Paul Rubin wrote: Are there actually Py3 codebases? Let's think a bit. There is the Python half of the Python3 codebase, perhaps 400K. But we can discount that. Then there are all the Py compatible modules on PyPI, which is to say, most of the major one. How could

IEEE Spectrum ranks Python at top, along with C

2017-09-11 Thread Terry Reedy
https://spectrum.ieee.org/static/interactive-the-top-programming-languages-2017 -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Simple board game GUI framework

2017-09-11 Thread Terry Reedy
On 9/11/2017 10:12 AM, Paul Moore wrote: Thanks for the information. That's more or less the sort of thing I was thinking of. In fact, from a bit more browsing, I found another way of approaching the problem - rather than using pygame, it turns out to be pretty easy to do this in tkinter. I

Re: array.array()'s memory shared with multiprocessing.Process()

2017-09-10 Thread Terry Reedy
On 9/10/2017 5:05 PM, iurly wrote: Il giorno domenica 10 settembre 2017 18:53:33 UTC+2, MRAB ha scritto: I've had a quick look at the source code. When an object is put into the queue, it's actually put into an internal buffer (a deque), and then the method returns. An internal thread works

Re: Using Python 2

2017-09-08 Thread Terry Reedy
On 9/8/2017 12:27 PM, Steve D'Aprano wrote: On Sat, 9 Sep 2017 12:23 am, Leam Hall wrote: If Python 3 is not a total re-write then why break compatibility? To avoid building up excess cruft in the language. To fix design mistakes which cannot be fixed without a backwards-incompatible

Re: Run Windows commands from Python console

2017-09-05 Thread Terry Reedy
On 9/4/2017 5:50 PM, Rick Johnson wrote: Terry Reedy wrote: [...] In IDLE, trackbacks *do* include source lines. >>> def f(): return 1/0 >>> f() Traceback (most recent call last): File "<pyshell#2>", line 1, in f() File "<

Re: Run Windows commands from Python console

2017-09-03 Thread Terry Reedy
On 9/3/2017 11:17 AM, eryk sun wrote: On Sun, Sep 3, 2017 at 7:56 AM, wrote: What means line below: File "", line 1 I don't have any file. Indeed, on Windows you cannot create a file named "". Python uses this fake name for the code object it compiles when

Re: Delay a computation in another thread

2017-09-02 Thread Terry Reedy
On 9/2/2017 6:53 AM, Steve D'Aprano wrote: I want to delay a computation and then print it, in the REPL (interactive interpreter). I have something like this: import time from threading import Timer def do_work(): x = 2 + 2 print("It is", time.asctime(), "and 2+2 is", x) def

Re: Cannot find IDLE

2017-08-31 Thread Terry Reedy
On 8/31/2017 8:46 AM, Yusuf Mohammad wrote: You must provide much more information to get any help. Are you installing on a network or an individual machine? What version of Windows is running, including 32 versus 64 bit? Do you have admin access to the machine? What *exact* python installer are

Re: If you are running 32-bit 3.6 on Windows, please test this

2017-08-30 Thread Terry Reedy
On 8/30/2017 1:35 PM, Terry Reedy wrote: https://stackoverflow.com/questions/45965545/math-sqrt-domain-error-when-square-rooting-a-positive-number reports the following: - Microsoft Windows [Version 10.0.16251.1002] (c) 2017 Microsoft Corporation. All rights reserved. C:\Users\Adam

If you are running 32-bit 3.6 on Windows, please test this

2017-08-30 Thread Terry Reedy
https://stackoverflow.com/questions/45965545/math-sqrt-domain-error-when-square-rooting-a-positive-number reports the following: - Microsoft Windows [Version 10.0.16251.1002] (c) 2017 Microsoft Corporation. All rights reserved. C:\Users\Adam>python Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017,

Re: Latency for API call to a Python Function

2017-08-29 Thread Terry Reedy
On 8/29/2017 11:22 AM, shazianu...@gmail.com wrote: def getvideos(self, listitem): channelId = "" returnVideos,dictData = {},{} mode = 0 channelId = listitem[KEY_CHANNELID] if KEY_CHANNELMODE in listitem : mode = int(listitem[KEY_CHANNELMODE]) filteredVideos = [] ... Please make code readable

Re: tkinter keypress events are a mess for numpad keys

2017-08-28 Thread Terry Reedy
On 8/28/2017 7:20 PM, Irmen de Jong wrote: Hi, Using tkinter in python3, I was trying to intercept individual keypresses (and releases) of keys on the numeric keypad. I want to use this as a simple joystick simulation. While you can bind the event, actually doing something sensible with it

Re: Proposed new syntax

2017-08-21 Thread Terry Reedy
On 8/20/2017 12:28 AM, Rustom Mody wrote: Lives today in python in the fact that the russel-set gives a straightforward syntax error and nothing more grandly profound R = {x if x not in x} R = {x for x not in x} Try the actual Python syntax set builder expression and you get executable

Re: Ask for help about a tkinter problem

2017-08-21 Thread Terry Reedy
> On 2017-08-21 01:28, jf...@ms4.hinet.net wrote: >> Peter Otten at 2017/8/20 UTC+8 PM 5:52:24 wrote: > [snip] > >>> That is just a peculiarity of TCL; a "-" is added to the option by the >>> Python wrapper before passing it along >> >> This extra "-" confuses people when showing up in the

Re: The tragic tale of the deadlocking Python queue

2017-08-17 Thread Terry Reedy
On 8/17/2017 4:31 AM, breamore...@gmail.com wrote: I found it interesting, possibly some of you may feel the same way so here it is https://codewithoutrules.com/2017/08/16/concurrency-python/ The intro ends with "Weep when you read the response of Python’s maintainers!", referring to

Re: Cross-language comparison: function map and similar

2017-08-16 Thread Terry Reedy
On 8/16/2017 10:53 AM, Steve D'Aprano wrote: Over in another thread, we've been talking about comprehensions and their similarities and differences from the functional map() operation. Reminder: map(chr, [65, 66, 67, 68]) will return ['A', 'B', 'C']. The comprehension 'while' proposal is for

Re: Proposed new syntax

2017-08-14 Thread Terry Reedy
On 8/14/2017 5:59 AM, Ben Finney wrote: At what point will you accept the feedback: That the comprehension syntax *does not* necessarily connote a procedural loop, but instead can quite reasonably be interpreted as its designer intended, a single conceptual operation. In a world where

Re: Redirecting input of IDLE window

2017-08-14 Thread Terry Reedy
On 8/14/2017 6:19 AM, Joel Goldstick wrote: do you know about the utility called pydoc? Type it at a command line to learn more. This only works if a wrapper has been installed in a directory on the system path. 'python -m pydoc' should always work. It displays information like help

Re: Redirecting input of IDLE window

2017-08-14 Thread Terry Reedy
A better subject line would have been Redirecting output interactive help(ob). On 8/14/2017 4:47 AM, Friedrich Rentsch wrote: I work interactively in an IDLE window most of the time and find "help (...)" very useful to summarize things. The display comes up directly (doesn't return a

Re: Proposed new syntax

2017-08-10 Thread Terry Reedy
On 8/10/2017 10:28 AM, Steve D'Aprano wrote: Every few years, the following syntax comes up for discussion, with some people saying it isn't obvious what it would do, and others disagreeing and saying that it is obvious. So I thought I'd do an informal survey. What would you expect this syntax

Re: Question About When Objects Are Destroyed

2017-08-04 Thread Terry Reedy
On 8/4/2017 7:11 PM, Jon Forrest wrote: Consider the following Python shell session (Python 3.6.2, Win64): >>> def givemetwo(): ... x = 'two' ... print(id(x)) ... >>> givemetwo() 1578505988392 So far fine. My understanding of object existence made me think that the object

Re: Challenge: find the first value where two functions differ

2017-08-04 Thread Terry Reedy
On 8/4/2017 11:44 AM, Chris Angelico wrote: On Sat, Aug 5, 2017 at 12:51 AM, Steve D'Aprano wrote: def isqrt_float(n): """Integer square root using floating point sqrt.""" return int(math.sqrt(n)) The operations in the integer version are well-defined

Re: Get list of attributes from list of objects?

2017-08-02 Thread Terry Reedy
On 8/2/2017 1:21 PM, Ian Pilcher wrote: Given a list of objects that all have a particular attribute, is there a simple way to get a list of those attributes? In other words: class Foo(object): def __init__(self, name): self.name = name foolist = [ Foo('a'), Foo('b'),

Re: how to fast processing one million strings to remove quotes

2017-08-02 Thread Terry Reedy
On 8/2/2017 1:05 PM, MRAB wrote: On 2017-08-02 16:05, Daiyue Weng wrote: Hi, I am trying to removing extra quotes from a large set of strings (a list of strings), so for each original string, it looks like, """str_value1"",""str_value2"",""str_value3"",1,""str_value4""" I like to remove the

Re: @lru_cache on functions with no arguments

2017-08-01 Thread Terry Reedy
On 8/1/2017 7:06 AM, Matt Wheeler wrote: On Tue, 1 Aug 2017 at 02:32 Terry Reedy <tjre...@udel.edu> wrote: On 7/31/2017 7:31 PM, t...@tomforb.es wrote: As part of the Python 3 cleanup in Django there are a fair few uses of @functools.lru_cache on functions that take no arguments. This

Re: @lru_cache on functions with no arguments

2017-07-31 Thread Terry Reedy
On 7/31/2017 7:31 PM, t...@tomforb.es wrote: As part of the Python 3 cleanup in Django there are a fair few uses of @functools.lru_cache on functions that take no arguments. This makes no sense to me. If the function is being called for side-effects, then it should not be cached. If the

Re: YAML in std lib?

2017-07-30 Thread Terry Reedy
On 7/29/2017 11:27 AM, Goldstein wrote: Hello. I'm new in this mailing list and, in fact, I've registered for one simple question. Why YAML is not yet included in the standard Python library? It's the most pythonic markup language, I think, and it's pretty popular. You can get yaml package(s)

<    2   3   4   5   6   7   8   9   10   11   >