Re: for / while else doesn't make sense

2016-05-19 Thread Stephen Hansen
On Thu, May 19, 2016, at 07:02 PM, gst wrote: > Python 4.0 ? My son will thank us ! No, he won't, because while Python 4.0 will happen, likely after Python 3.9, it will not be a major backwards compatible breaking point. Some people infer that because 3.0 was, 4.0, 5.0, 6.0 are open to it. They a

Re: for / while else doesn't make sense

2016-05-19 Thread Bob Martin
in 759855 20160519 185500 Jon Ribbens wrote: >On 2016-05-19, Steven D'Aprano wrote: >> On Fri, 20 May 2016 02:31 am, Herkermer Sherwood wrote: >>> Most keywords in Python make linguistic sense, but using "else" in for and >>> while structures is kludgy

Re: Summing/combining tuples

2016-05-19 Thread Larry Hudson via Python-list
On 05/18/2016 09:53 PM, DFS wrote: On 5/18/2016 10:58 PM, Larry Hudson wrote: [snip...] Why two loops? Put both summations in a single loop. Then you're only scanning the alist once instead of twice. groups1 = defaultdict(int) groups2 = defaultdict(int) for nm, matches, words in alist: g

Re: OrderedDict

2016-05-19 Thread silver0346
On Wednesday, May 18, 2016 at 2:25:16 PM UTC+2, Peter Otten wrote: > Chris Angelico wrote: > > > On Wed, May 18, 2016 at 7:28 PM, Peter Otten <__pete...@web.de> wrote: > >> I don't see an official way to pass a custom dict type to the library, > >> but if you are not afraid to change its source co

Re: for / while else doesn't make sense

2016-05-19 Thread gst
I know this does not bring anything valuable but: Definitively agree with your mental model !! 'then' and only "then" is the best keyword in the situation which is on the table right now. it totally fix the confusing "else" actual mess (for at least 2 reasons). Python 4.0 ? My son will thank us

Re: for / while else doesn't make sense

2016-05-19 Thread Steven D'Aprano
On Fri, 20 May 2016 03:55 am, Jon Ribbens wrote: > I guess we should thank our lucky stars that you don't have a time > machine then, since that change would very much be one for the worse > in my opinion. for...else is perfectly straightforward and clearly > the right keywords to use. for...then

Re: for / while else doesn't make sense

2016-05-19 Thread Gregory Ewing
Herkermer Sherwood wrote: But there is already a reserved keyword that would work great here. "finally". Unfortunately, it wouldn't follow the semantics of try/except/else/finally. Is it better to follow the semantics used elsewhere in the language, or have the language itself make sense semant

Re: Resources/pointers for writing maintable, testable Python

2016-05-19 Thread Terry Reedy
On 5/19/2016 4:10 PM, Mike Driscoll wrote: On Thursday, May 19, 2016 at 11:23:53 AM UTC-5, Terry Reedy wrote: In my case, I learned better how to test IDLE from a user perspective. For tkinter apps, an external program such as Selenium is not needed. Tk/tkinter have the simulated event generat

Re: for / while else doesn't make sense

2016-05-19 Thread David Jardine
On Thu, May 19, 2016 at 11:47:28AM -0700, theh...@gmail.com wrote: > This is exactly what I'm referencing. We can do mental gymnastics for it > to make sense, but remove the `break` in your code and what happens? The > logic goes away. Quite. What would the code mean? Why would you use "else"

Python script reading from sys.stdin and debugger

2016-05-19 Thread Fillmore
Hello PyMasters! Long story short: cat myfile.txt | python -m pdb myscript.py doens't work (pdb hijacking stdin?). Google indicates that someone has fixed this with named pipes, but, call me stupid, I don't understand how I need to set up those pipes, how I need to modify my script and, abov

Re: Python 3.5.1

2016-05-19 Thread Terry Reedy
On 5/19/2016 12:47 PM, Bella via Python-list wrote: Thisis my first encountering with Python. I have successfully downloaded Python3.5.1 for Windows but see only a black window with command prompt. If you start Python from the Python directory on the Start menu, you should see a black window

Re: for / while else doesn't make sense

2016-05-19 Thread Marko Rauhamaa
theh...@gmail.com: > This is exactly what I'm referencing. We can do mental gymnastics for > it to make sense, Programming languages are not English. Any resemblance is purely coincidental. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: for / while else doesn't make sense

2016-05-19 Thread Chris Angelico
On Fri, May 20, 2016 at 6:11 AM, Ian Kelly wrote: > On Thu, May 19, 2016 at 2:01 PM, Chris Angelico wrote: >> On Fri, May 20, 2016 at 3:46 AM, Steven D'Aprano wrote: >>> The idea of finally is >>> that it executes no matter what happens[1]. >>> >>> [1] Well, *almost* no matter what. If you pull

Re: for / while else doesn't make sense

2016-05-19 Thread Ian Kelly
On Thu, May 19, 2016 at 2:01 PM, Chris Angelico wrote: > On Fri, May 20, 2016 at 3:46 AM, Steven D'Aprano wrote: >> The idea of finally is >> that it executes no matter what happens[1]. >> >> [1] Well, *almost* no matter what. If you pull the power from the computer, >> the finally block never ge

Re: Resources/pointers for writing maintable, testable Python

2016-05-19 Thread Mike Driscoll
On Thursday, May 19, 2016 at 11:23:53 AM UTC-5, Terry Reedy wrote: > On 5/19/2016 11:33 AM, Mike Driscoll wrote: > > On Wednesday, May 18, 2016 at 4:48:28 PM UTC-5, Andrew Farrell wrote: > >> Hi Jacob, > >> > >> You are probably looking for the book Test-Driven Development with Python > >>

Re: Python 3.5.1

2016-05-19 Thread Mike Driscoll
On Thursday, May 19, 2016 at 12:21:52 PM UTC-5, kbell...@aol.com wrote: > Thisis my first encountering with Python. I have successfully downloaded > Python3.5.1 for Windows but see only a black window with command prompt. I do > not see IDLE under PYthon on Windows Start Menu. > > > Downloaded

Re: for / while else doesn't make sense

2016-05-19 Thread Chris Angelico
On Fri, May 20, 2016 at 3:46 AM, Steven D'Aprano wrote: > The idea of finally is > that it executes no matter what happens[1]. > > [1] Well, *almost* no matter what. If you pull the power from the computer, > the finally block never gets a chance to run. Nor if you kill -9 the process, or get int

Re: for / while else doesn't make sense

2016-05-19 Thread theherk
This is exactly what I'm referencing. We can do mental gymnastics for it to make sense, but remove the `break` in your code and what happens? The logic goes away. The code ends up executing anyway, which is what makes it more like "finally" to me. Although, as Ian pointed out that would cause br

Re: for / while else doesn't make sense

2016-05-19 Thread Steven D'Aprano
On Fri, 20 May 2016 03:22 am, Ned Batchelder wrote: > On Thursday, May 19, 2016 at 12:43:56 PM UTC-4, Herkermer Sherwood wrote: >> Most keywords in Python make linguistic sense, but using "else" in for >> and while structures is kludgy and misleading. I am under the assumption >> that this was jus

Re: for / while else doesn't make sense

2016-05-19 Thread Jon Ribbens
On 2016-05-19, Steven D'Aprano wrote: > On Fri, 20 May 2016 02:31 am, Herkermer Sherwood wrote: >> Most keywords in Python make linguistic sense, but using "else" in for and >> while structures is kludgy and misleading. I am under the assumption that >> this was just utilizing an already existing

Re: for / while else doesn't make sense

2016-05-19 Thread Steven D'Aprano
On Fri, 20 May 2016 02:31 am, Herkermer Sherwood wrote: > Most keywords in Python make linguistic sense, but using "else" in for and > while structures is kludgy and misleading. I am under the assumption that > this was just utilizing an already existing keyword. Adding another like > "andthen" wo

Re: for / while else doesn't make sense

2016-05-19 Thread Ned Batchelder
On Thursday, May 19, 2016 at 12:43:56 PM UTC-4, Herkermer Sherwood wrote: > Most keywords in Python make linguistic sense, but using "else" in for and > while structures is kludgy and misleading. I am under the assumption that > this was just utilizing an already existing keyword. Adding another li

Python 3.5.1

2016-05-19 Thread Bella via Python-list
Thisis my first encountering with Python. I have successfully downloaded Python3.5.1 for Windows but see only a black window with command prompt. I do not see IDLE under PYthon on Windows Start Menu. Downloaded version of Python is based on 32-bit and my PC is 64-bit. Couldyo please help an

Re: for / while else doesn't make sense

2016-05-19 Thread Ian Kelly
On Thu, May 19, 2016 at 10:31 AM, Herkermer Sherwood wrote: > Most keywords in Python make linguistic sense, but using "else" in for and > while structures is kludgy and misleading. I am under the assumption that > this was just utilizing an already existing keyword. Adding another like > "andthen

for / while else doesn't make sense

2016-05-19 Thread Herkermer Sherwood
Most keywords in Python make linguistic sense, but using "else" in for and while structures is kludgy and misleading. I am under the assumption that this was just utilizing an already existing keyword. Adding another like "andthen" would not be good. But there is already a reserved keyword that wo

Re: Resources/pointers for writing maintable, testable Python

2016-05-19 Thread Terry Reedy
On 5/19/2016 11:33 AM, Mike Driscoll wrote: On Wednesday, May 18, 2016 at 4:48:28 PM UTC-5, Andrew Farrell wrote: Hi Jacob, You are probably looking for the book Test-Driven Development with Python . Electronic version is free on

Re: Resources/pointers for writing maintable, testable Python

2016-05-19 Thread Jacob Scott
Indeed, I skimmed the TOC for Test-Driven Development with Python and it does look to be rather Django-centric (which makes it a bit less helpful to me). I will take a look at "Testing Python: Applying Unit Testing, TDD, BDD and Acceptance Testing"! Thanks, Jacob On Thu, May 19, 2016 at 8:33 AM,

Re: Resources/pointers for writing maintable, testable Python

2016-05-19 Thread Mike Driscoll
On Wednesday, May 18, 2016 at 4:48:28 PM UTC-5, Andrew Farrell wrote: > Hi Jacob, > > You are probably looking for the book Test-Driven Development with Python > . > You'll also want to look at py.test > >

Re: setrecursionlimit

2016-05-19 Thread Nobody
On Wed, 18 May 2016 09:19:25 -0700, Ned Batchelder wrote: > Is there a way to know how large the C stack can grow, Yes. For the main thread, getrlimit(RLIMIT_STACK). For other threads, pthread_attr_getstacksize(). > and how much it will grow for each Python function call? No. Depending upon th

Re: setrecursionlimit

2016-05-19 Thread Oscar Benjamin
On 18 May 2016 at 17:11, Steven D'Aprano wrote: > The documentation for setrecursion limit warns against setting the limit too > high: > > [quote] > The highest possible limit is platform-dependent. A user may need to > set the limit higher when they have a program that requires deep >

Re: Resources/pointers for writing maintable, testable Python

2016-05-19 Thread Chris Angelico
On Thu, May 19, 2016 at 7:13 PM, Gregory Ewing wrote: > Chris Angelico wrote: >> >> [1] Some people's names can't be represented in Unicode. > > > Like this fellow's, for instance: > > https://www.youtube.com/watch?v=hNoS2BU6bbQ His name actually CAN be represented in Unicode. It's his address th

Re: Resources/pointers for writing maintable, testable Python

2016-05-19 Thread Gregory Ewing
Chris Angelico wrote: [1] Some people's names can't be represented in Unicode. Like this fellow's, for instance: https://www.youtube.com/watch?v=hNoS2BU6bbQ -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: setrecursionlimit

2016-05-19 Thread Gregory Ewing
Rustom Mody wrote: Both the mess in catching numeric overflow as well as stackoverflow looks like its C's fault. I consider it as the fault of currently fashionable stock hardware The sad thing about C is that it doesn't even help you detect integer overflow in *software*. Every machine I've

Re: setrecursionlimit

2016-05-19 Thread Gregory Ewing
Steven D'Aprano wrote: I don't really understand why the system can't track the current top of the stack and bottom of the heap, and if they're going to collide, halt the process. That effectively *is* what it does. The reason it manifests as a segfault is because of the way it goes about dete