Re: Python 3.x and bytes

2011-05-17 Thread Terry Reedy
On 5/17/2011 5:27 PM, Corey Richardson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/17/2011 04:55 PM, Ethan Furman wrote: Apparently, it's not well documented. If you check PEP 358 you'll find it. ~Ethan~ Agreed, it looks like it should be mentioned in bytes.__doc__ about the

Re: pyjamas 0.8alpha1 release

2011-05-18 Thread Terry Reedy
On 5/18/2011 5:24 AM, lkcl wrote: There seem to be two somewhat separate requirement issues: the interpreter binary and the language version. a) at the moment a http://python.org 2.N interpreter is required to actually run the translator. if you use http://python.org 2.5 or 2.6 you do not

Re: pyjamas 0.8alpha1 release

2011-05-18 Thread Terry Reedy
On 5/18/2011 9:42 AM, lkcl wrote: he's got a good point, terry. breaking backwards-compatibility was a completely mad and incomprehensible decision. I see that I should take everything you (or Harris) say with a big grain of salt;-). You just gave me a lecture about the impossibility of do

Re: checking if a list is empty

2011-05-21 Thread Terry Reedy
On 5/21/2011 10:46 AM, John J Lee wrote: In the absence of an explicit interface declaration (have any standards emerged for that in Python 3, BTW?), the use of len() does give you some information about the interface, which sometimes makes it easier to change the function. I'm sure you fully u

Re: TK program problem

2011-05-21 Thread Terry Reedy
On 5/21/2011 8:03 PM, bvdp wrote: Yes, I can confirm that both the lambda and setting the class to: class selectFav(object): One of the purposes and advantages of Python 3 is having only one class system. Best to always use new-style classes in Python 2.2+ unless you understand and nee

Re: TK program problem

2011-05-22 Thread Terry Reedy
On 5/21/2011 10:20 PM, bvdp wrote: One of the purposes and advantages of Python 3 is having only one class system. Best to always use new-style classes in Python 2.2+ unless you understand and need old-style classes (and need should be never for most people). Thanks for this. I'll keep it in

Re: Dealing with name clashes in pypi

2011-05-22 Thread Terry Reedy
On 5/22/2011 2:34 PM, Patrick Sabin wrote: I wanted to register my project (epdb) in pypi. Unfortunately there already exists a project with the same name. It is not possible for me to change the name of the project, because I used it in multiple writings. Any ideas how I can deal with the situat

Re: Why did Quora choose Python for its development?

2011-05-22 Thread Terry Reedy
On 5/22/2011 3:44 AM, Octavian Rasnita wrote: I've noticed that on many Perl mailing lists the list members talk very rarely about Python, Interesting. I learned about Python on comp.lang.perl, but that was over a decade ago. but only on this Python mailing list I read many discussions abo

Re: and becomes or and or becomes and

2011-05-22 Thread Terry Reedy
On 5/22/2011 5:57 PM, Thomas 'PointedEars' Lahn wrote: Stef Mientki wrote: must of us will not use single bits these days, but at first sight, this looks funny : a=2 b=6 a and b 6 a& b 2 a or b 2 a | b 6 Change the order of the operands and see what happens. or change a,b to 1,2

Re: Why did Quora choose Python for its development?

2011-05-22 Thread Terry Reedy
On 5/23/2011 1:31 AM, Octavian Rasnita wrote: I am talking about a simple way of creating a hash/dict from an array, which is so simple that there should be really a single way to do it, or very few. Again, Python has such: >>> dict([['one',1],['two', 2]]) {'two': 2, 'one': 1} -- Terry Jan

Re: Why did Quora choose Python for its development?

2011-05-23 Thread Terry Reedy
On 5/23/2011 4:49 AM, Octavian Rasnita wrote: But let's remember from what this discussion started. This is not a Python critique, because each language has its own ways. I just wanted to show that the fact that "there is more than one way to do it" in Perl and that "there is a single way" in Py

Re: Is there a better way to solve this?

2011-05-23 Thread Terry Reedy
On 5/23/2011 2:55 PM, kracekumar ramaraju wrote: You can use sizeof function, Appears not to be in manuals, that I could find. As a special method, it is intended to be called through sys.getsizeof. a=12234 b=23456.8 a.__sizeof__() 12 b.__sizeof__() 16 So sizeof int is 12 bytes and float

Re: Python 3.2 Idle doesn't start. No error message.

2011-05-24 Thread Terry Reedy
On 5/24/2011 8:01 AM, markrri...@aol.com wrote: Hello all. I have Python 2.71 installed on my Windows 7 laptop and it runs fine. I was having a problem with Python 3.2, 32bit, not starting with an error message saying this application has quit abnormally. That was fixed when I took the PYTHONPATH

Re: Python 3.2 Idle doesn't start. No error message.

2011-05-24 Thread Terry Reedy
On 5/24/2011 4:12 PM, markrri...@aol.com wrote: On Tue, 24 May 2011 12:50:47 -0400, Terry Reedy How do you try to start it? From start|programs|python and clicking on the idle icon. OK. Works fine for me on winxp desktop and win7 laptop. 3.2.1 will be out soon. Whether or not you find a

Re: File access denied after subprocess completion on Windows platform

2011-05-24 Thread Terry Reedy
On 5/24/2011 4:18 PM, Claudiu Nicolaie CISMARU wrote: Seems that close_fds did the trick. Anyway, I read that description on the documentation last night but I think I was so tired that I understood that in Windows has no effect... :) Now. There is one more issue. Seems that on faster computers

Re: Why did Quora choose Python for its development?

2011-05-25 Thread Terry Reedy
On 5/25/2011 8:01 AM, John Bokma wrote: to. Like I already stated before: if Python is really so much better than Python readability wise, why do I have such a hard time dropping Perl and moving on? [you meant 'than Perl'] You are one of the people whose brain fits Perl (or vice versa) better

Re: Puzzled by list-appending behavior

2011-05-26 Thread Terry Reedy
On 5/26/2011 3:18 AM, Algis Kabaila wrote: And why do you insist on calling an instance of list, "list"? Even a human reader will confuse which is which. What you are showing is an example how confusing things become when a keyword (list) is over-written (with list instance). (Minor note: 'lis

Re: Why did Quora choose Python for its development?

2011-05-26 Thread Terry Reedy
On 5/26/2011 11:36 AM, John Bokma wrote: Ben Finney writes: [impolite comment not quoted] Get a life. Or better, just fuck off and die. It will improve both the world and the Python community, of which you are nothing but a little, smelly shitstain. That abuse is entirely unwelcome in

Re: Python's super() considered super!

2011-05-26 Thread Terry Reedy
On 5/26/2011 2:13 PM, Dotan Cohen wrote: On Thu, May 26, 2011 at 19:39, Raymond Hettinger wrote: It would also be great if some of you would upvote it on HackerNews. Here's a link to the super() how-to-guide and commentary: bit.ly/ iFm8g3 Is that the same link as in the OP? I don't click

Re: Puzzled by list-appending behavior

2011-05-26 Thread Terry Reedy
On 5/26/2011 11:58 AM, MRAB wrote: On 26/05/2011 06:17, Chris Rebert wrote: list.remove(), list.sort(), and list.extend() similarly return None rather than the now-modified list. I'd just like to point out that it's a convention, not a rigid rule. Sometimes it's not followed, for example, dic

Re: bug in str.startswith() and str.endswith()

2011-05-26 Thread Terry Reedy
On 5/26/2011 7:27 PM, Ethan Furman wrote: I've tried this in 2.5 - 3.2: --> 'this is a test'.startswith('this') True --> 'this is a test'.startswith('this', None, None) Traceback (most recent call last): File "", line 1, in TypeError: slice indices must be integers or None or have an __index__

Re: Beginner needs advice

2011-05-28 Thread Terry Reedy
On 5/28/2011 2:57 PM, Uncle Ben wrote: Just this past Tuesday, I blindly downloaded 3.1 and found that at the level I am workloing, all it took to get my 2.7 code to run was to put parens around the print arguments and double the slashes in integer division. I didn't even use the 2to3 automation

Re: scope of function parameters

2011-05-29 Thread Terry Reedy
On 5/29/2011 7:59 AM, Mel wrote: Henry Olders wrote: I just spent a considerable amount of time and effort debugging a program. The made-up code snippet below illustrates the problem I encountered: def main(): a = ['a list','with','three elements'] print a print fnc1(a) print a def fnc1(b): r

Re: scope of function parameters

2011-05-29 Thread Terry Reedy
On 5/29/2011 4:19 PM, Henry Olders wrote: From my perspective, a function parameter should be considered as having been assigned (although the exact assignment will not be known until runtime), and as an assigned variable, it should be considered local. That is exactly the case for Python func

Re: scope of function parameters

2011-05-30 Thread Terry Reedy
On 5/30/2011 3:38 AM, Laurent wrote: Cool. I was thinking that "5" was the name, but >>> 5.__add__(6) File "", line 1 5.__add__(6) Try 5 .__add__(6) Modules, classes, and functions have a .__name__ attribute (I call it their 'definition name') used to print a representation. As best I can

Re: scope of function parameters

2011-05-30 Thread Terry Reedy
On 5/30/2011 5:08 AM, Laurent Claessens wrote: Le 30/05/2011 11:02, Terry Reedy a écrit : On 5/30/2011 3:38 AM, Laurent wrote: Cool. I was thinking that "5" was the name, but >>> 5.__add__(6) File "", line 1 5.__add__(6) Try 5 .__add__(6) What is the ratio

Re: python in school notebooks/laptops

2011-05-30 Thread Terry Reedy
On 5/30/2011 6:15 PM, Irmen de Jong wrote: Do you mean one of these os's, where Python (2) is not working properly because the *defaultencoding* is set to utf-8? Huh? On all of my machines, including windows and Ubuntu 11.04, sys.getdefaultencoding() returns 'ascii'. For me, WINXP, 2.7 >>>

Re: scope of function parameters (take two)

2011-05-30 Thread Terry Reedy
On 5/30/2011 8:28 PM, Henry Olders wrote: Sadly, I feel that the main issue that I was trying to address, has not been dealt with. False. Please go back and read what I and others wrote before. ... What I would like is that the variables which are included in the function definition's param

Re: Beginner needs advice

2011-05-30 Thread Terry Reedy
On 5/30/2011 8:32 PM, harrismh777 wrote: Ever tried to read Beowulf in the original? Ever tried to write Ænglisc ? I have, and it is a lot further from modern American than Python 2 and 3 are from each other. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner needs advice

2011-05-30 Thread Terry Reedy
On 5/30/2011 8:32 PM, harrismh777 wrote: However, I guarantee that if I'm dumped unaided in Piccadilly I'll be able to hail a cab, pay my £12.00 and get myself to Liverpool Street Station, find the bathroom, and be on the correct train just in time for dinner, all without looking into the Engli

Re: scope of function parameters (take two)

2011-05-31 Thread Terry Reedy
On 5/31/2011 2:37 AM, Henry Olders wrote: what I want is a function that is free of side effects back through the parameters passed in the function call. You can get that by refraining from mutating parameter objects. Simple as that. Just do not expect Python to enforce that discipline on ever

Re: scope of function parameters (take two)

2011-05-31 Thread Terry Reedy
On 5/31/2011 3:17 AM, Henry Olders wrote: Clearly, making a copy within the function eliminates the possibility of the side effects caused by passing in mutable objects. Mutable objects and mutating methods and functions are a *feature* of Python. If you do not like them, do not use them. >

Re: Something is rotten in Denmark...

2011-05-31 Thread Terry Reedy
On 5/31/2011 2:48 AM, harrismh777 wrote: fs=[] Irrelevant here since you immediately rebind 'fs'. fs = [(lambda n: i + n) for i in range(10)] [fs[i](1) for i in range(10)] Same as [f(1) for f in fs] [10, 10, 10, 10, 10, 10, 10, 10, 10, 10] <=== not good ( that was a big surprise! . . . )

Re: Something is rotten in Denmark...

2011-05-31 Thread Terry Reedy
On 5/31/2011 4:18 PM, harrismh777 wrote: Terry Reedy wrote: You have been hypnotizeed by lambda. (lambda n: i+n) is a *constant expression*, so you get 10 'equal' functions. 'hypnotized' indeed! I say 'hypnotized' ;-) because people have posted examples almost

Re: Something is rotten in Denmark...

2011-06-01 Thread Terry Reedy
On 5/31/2011 8:09 PM, harrismh777 wrote: At the moment I'm only speaking about my OP and that particular list comprehension... the thing that happened (at least for me) is that the intuitive sense that each 'i' somehow becomes a part of the anonymous function (I know, not so) is built-in. There

Re: Something is rotten in Denmark...

2011-06-01 Thread Terry Reedy
On 6/1/2011 8:40 PM, harrismh777 wrote: The part that I don't see much about in the docs (some books, that is) is that the lambda lookups occur late (the lambda is evaluated at the time it is called). The Python docs on-line *do say* this (I found too late) but its one quick phrase that can be m

Re: Comparison operators in Python

2011-06-01 Thread Terry Reedy
On 6/1/2011 8:44 PM, harrismh777 wrote: Ian Kelly wrote: >> ?? wrote integer. However comparison between a string and an integer seems to be permitted. Is there any rationale behind this ? It allows things like sorting of heterogeneous lists. It's generally viewed as a wart, though, and it

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 reading from stdin (i.e. the f

Re: Run Windows commands from Python console

2017-09-04 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 "", line 1, in f() File "", line 2, i

Re: Python console's workspace path

2017-09-05 Thread Terry Reedy
On 9/5/2017 10:26 AM, Andrej Viktorovich wrote: Hello, I run Python 3.6 console under windows 10. Where is default console directory? It depends on how and where you start it. I run script: tf = open ("aaa.txt", "w") tf.write(" %s" % 123) tf.close() Where file aaa.txt will be created?

Re: No importlib in Python 3 64 bit ?

2017-09-06 Thread Terry Reedy
On 9/6/2017 12:30 PM, Chris Angelico wrote: On Thu, Sep 7, 2017 at 2:17 AM, MRAB wrote: On 2017-09-06 14:00, Chris Angelico wrote: I'm not 100% sure, but I think that having two different versions of CPython X.Y isn't supported on Windows. I have both 64-bit and 32-bit Python 3.6 installed

Re: Using Python 2

2017-09-08 Thread Terry Reedy
On 9/8/2017 6:12 AM, Leam Hall wrote: I've read comments about Python 3 moving from the Zen of Python. Comments about Python 3 range from factual to opinionated to fake. I'm a "plain and simple" person myself. Many of the changes in Python3 were simplifications -- removing a semi-deprecat

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 change

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

2017-09-09 Thread Terry Reedy
On 9/9/2017 6:31 AM, Pavol Lisy wrote: Interesting reading: https://stackoverflow.blog/2017/09/06/incredible-growth-python/?cb=1 So much for Python 3 having killed python ;-) -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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: 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 wa

Re: Simple board game GUI framework

2017-09-11 Thread Terry Reedy
On 9/11/2017 12:56 PM, Paul Moore wrote: I'm not looking at actually implementing chess. The idea was prompted by a programming exercise my son was given, that was about programming a series of classes modelling robots that know their position on a grid, and when told to move, can do so accordin

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: version of Python to install Windows 7 professional 64 bit, intel core i5

2017-09-11 Thread Terry Reedy
On 9/11/2017 10:49 PM, Zubair Shaikh wrote: What version of Python to install Windows 7 professional 64 bit, intel core i5 Whatever version you want. If you have no idea, goto https://www.python.org/downloads/release/python-362/ and click Windows-x86-64 executable installer. -- Terry Jan R

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

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 yo

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 o

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 t

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

2017-09-16 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: Research paper "Energy Efficiency across Programming Languages: How does energy, time, and memory relate?"

2017-09-16 Thread Terry Reedy
On 9/17/2017 2:04 AM, Chris Angelico wrote: On Sun, Sep 17, 2017 at 4:00 PM, Terry Reedy wrote: The numerical extensions have been quasi-official in the sense that at least 3 language enhancements have been make for their use. I know about the matrix multiplication operator. What are the

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 beca

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

2017-09-18 Thread Terry Reedy
On 9/18/2017 5:21 PM, John Ladasky wrote: On Saturday, September 16, 2017 at 11:01:03 PM UTC-7, Terry Reedy wrote: On 9/16/2017 7:04 PM, b...@g...com wrote: The particular crippler for CLBG problems is the non-use of numpy in numerical calculations, such as the n-body problem. Numerical

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 python commands in windows

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: 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 b

Re: TypeError with map with no len()

2017-09-25 Thread Terry Reedy
On 9/25/2017 12:44 PM, john polo wrote: Python List, I am trying to make practice data for plotting purposes. I am using Python 3.6. The instructions I have are import matplotlib.pyplot as plt import math import numpy as np t = np.arange(0, 2.5, 0.1) y1 = map(math.sin, math.pi*t) Change to

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: 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 publ

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: Textwrap doesn't honour NO-BREAK SPACE

2017-09-29 Thread Terry Reedy
On 9/29/2017 2:35 AM, Steve D'Aprano wrote: On Fri, 29 Sep 2017 03:55 pm, Terry Reedy wrote: Expected result: Lorum ipsum dolor sit amet, consectetur adipiscing elit ZZZ ZZZ sed do euismod tempor incididunt ut labore et dolore magna aliqua. On Windows 10, I get this on 2.7, 3.5, 3.6

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 s

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: 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 nonsense. There's no "must" here.

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 Funct

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 stdout. And yes, people do write Unix daemons

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 existence of those file de

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 parenth

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 Ctrl-Z . IDLE's she

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: 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: 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: 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 see

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: 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 see

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: 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 intentiona

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 security

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 .5006.5071252

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-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: IDLE doesn't recognise installed packages

2017-10-23 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 ri

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 ever)

Re: IDLE doesn't recognise installed packages

2017-10-26 Thread Terry Reedy
path-to-binary -m pip 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 hat am 24. Oktober 2017 um 08:3

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 t

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: 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 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='

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 b"some".de

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: 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 scroll down until I hit it by accident

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 reques

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: 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 you

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 for

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

<    7   8   9   10   11   12   13   14   15   16   >