Re: Can math.atan2 return INF?

2016-06-26 Thread Marko Rauhamaa
Steven D'Aprano : > Naive empirical falsification can, at best, be considered as a > best-practice rule: if you have no way of falsifying something even in > principle, then it's not scientific. But it doesn't really give you > much in the way of practical guidance. What counts as falsification?

Re: Getting back into PyQt and not loving it.

2016-06-26 Thread Lawrence D’Oliveiro
On Monday, June 27, 2016 at 6:16:01 PM UTC+12, John Ladasky wrote: > Between the Py3 requirement and the need to work with all major OS's, I > decided to learn PyQt and not GTK+. GTK+ is available for Python 3. No doubt it will work on Windows as well, once Microsoft gets its Linux compatibil

Re: Getting back into PyQt and not loving it.

2016-06-26 Thread John Ladasky
On Sunday, June 26, 2016 at 7:41:17 PM UTC-7, Michael Torrie wrote: > If GTK+ had first-class support on Windows and Mac, including native > themes and seamless UI integration (file and print dialogs), I'd say > GTK+ would be the only game in town for Python programmers. > Unfortunately, unless you

Re: argparse and subparsers

2016-06-26 Thread Lawrence D’Oliveiro
On Monday, June 27, 2016 at 4:56:10 PM UTC+12, Sachin Garg wrote: > # Set verbose flag > verbose = False > if arguments['--verbose']: > verbose = True > elif arguments['-q']: > verbose = False Don’t you just love code (and commenting) like this... -- https://mail.python.org/mailman/listi

Re: argparse and subparsers

2016-06-26 Thread Sachin Garg
On Sunday 26 June 2016 02:51 PM, Joseph L. Casale wrote: > I have some code where sys.argv is sliced up and manually fed to discrete > argparse > instances each with a single subparser. The reason the discrete parsers all > having a > single subparser was to make handling the input simpler, the f

Language improvement: Get more from the `for .. else` clause

2016-06-26 Thread Victor Savu
tl;dr: 1. Add `StopAsyncIteration.value`, with the same semantic as `StopIteration.value` (documented in PEP 380). 2. Capture `StopIteration.value` and StopAsyncIteration.value in the `else` clauses of the `for` and `async for` statements respectively. Note: I already have a pr

Re: Question on compiling on linux

2016-06-26 Thread Zachary Ware
On Saturday, June 25, 2016, Steven Truppe wrote: > > i hope this email works like you expected! Not quite, but closer. You've quoted me properly, but you added your reply above the quote, so-called "top-posting". A: Because you have to read things in reverse order. Q: Why? A: Top-posting. Q: Wh

Re: Operator Precedence: One Thing Python Got Right

2016-06-26 Thread Steven D'Aprano
On Mon, 27 Jun 2016 02:20 pm, Lawrence D’Oliveiro wrote: > There is one thing Python did not slavishly copy from C. Only one? -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-lis

Operator Precedence: One Thing Python Got Right

2016-06-26 Thread Lawrence D’Oliveiro
There is one thing Python did not slavishly copy from C. While it has (mostly) the same operators, and exclusively adopted the iso646 names for the Boolean operators (which you can also use in C and C++, by the way, but not Java), it made a slight tweak to the operator precedence rules

Re: Empty List

2016-06-26 Thread Christopher Reimer
On 6/26/2016 8:13 PM, Elizabeth Weiss wrote: Hi There, What is the point of this code?: word=[] print(word) The result is [] When would I need to use something like this? Thank you! Sometimes you need to assign an empty list to a variable prior to using it in a looping structure. Here'

Re: Empty List

2016-06-26 Thread Steven D'Aprano
On Mon, 27 Jun 2016 01:13 pm, Elizabeth Weiss wrote: > Hi There, > > What is the point of this code?: > > word=[] > print(word) > > The result is [] > > When would I need to use something like this? As given, never. Nor would you need: num = 0 print(num) It's pretty boring, trivial code th

Re: argparse and subparsers

2016-06-26 Thread Lawrence D’Oliveiro
On Monday, June 27, 2016 at 6:56:41 AM UTC+12, Joseph L. Casale wrote: > This has become unmaintainable as the manual slicing is always subject > to a new case by where a parser has a positional, switch or optional > parameter for example. Also, since argv is grouped by subparser > specifiers, if a

Empty List

2016-06-26 Thread Elizabeth Weiss
Hi There, What is the point of this code?: word=[] print(word) The result is [] When would I need to use something like this? Thank you! -- https://mail.python.org/mailman/listinfo/python-list

Re: Can math.atan2 return INF?

2016-06-26 Thread Steven D'Aprano
On Mon, 27 Jun 2016 09:08 am, Gregory Ewing wrote: > Marko Rauhamaa wrote: >>>The singularity being talked about there is an artifact of a >>>particular coordinate system; the theory predicts that there is no >>>*physical* singularity at the event horizon. >> >> That theory can't be tested even i

Re: Getting back into PyQt and not loving it.

2016-06-26 Thread Michael Torrie
On 06/26/2016 07:05 PM, llanitedave wrote: > Not sure that wxPython is really any different in that respect, and > Tkinter doesn't feel Pythonic to me, either -- considering how it's > Tk at heart. So what's the alternative? There really is no good > Python-based GUI tool, and that's a shame. Gu

Re: Getting back into PyQt and not loving it.

2016-06-26 Thread MRAB
On 2016-06-27 02:05, llanitedave wrote: On Sunday, June 26, 2016 at 2:45:18 PM UTC-7, Michael Torrie wrote: I'm starting to question the advice I gave not long ago to for new users to consider the Qt toolkit with Python. I just did a little project porting a simple graphical user interface from

Re: Getting back into PyQt and not loving it.

2016-06-26 Thread Rustom Mody
On Monday, June 27, 2016 at 6:35:31 AM UTC+5:30, llanitedave wrote: > So what's the alternative? There really is no good Python-based GUI tool, > and that's a shame. The last time Ranting Rick made a big rant about this (saying wxpython should replace tkinter in core CPython) everyone took note

Re: Getting back into PyQt and not loving it.

2016-06-26 Thread llanitedave
On Sunday, June 26, 2016 at 2:45:18 PM UTC-7, Michael Torrie wrote: > I'm starting to question the advice I gave not long ago to for new users > to consider the Qt toolkit with Python. > > I just did a little project porting a simple graphical user interface > from GTK+ to Qt (PyQt4 for now as tha

Re: Assignment Versus Equality

2016-06-26 Thread Gregory Ewing
Christopher Reimer wrote: How can you not use chained assignments? I thought Python was the art of the clever one-liners. :) No, Python is the art of writing clever one-liners using more than one line. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Assignment Versus Equality

2016-06-26 Thread Gregory Ewing
BartC wrote: I did a year of it in the 1970s. Looks funny in lower case though. It's interesting how our perceptions of such things change. Up until my second year of university, my only experiences of computing had all been in upper case. Then we got a lecturer who wrote all his Pascal on the

Re: Assignment Versus Equality

2016-06-26 Thread BartC
On 27/06/2016 00:22, Gregory Ewing wrote: BartC wrote: On 26/06/2016 08:36, Lawrence D’Oliveiro wrote: One of Python’s few mistakes was that it copied the C convention of using “=” for assignment and “==” for equality comparison. One of C's many mistakes. Unfortunately C has been very influe

Re: Assignment Versus Equality

2016-06-26 Thread Gregory Ewing
BartC wrote: On 26/06/2016 08:36, Lawrence D’Oliveiro wrote: One of Python’s few mistakes was that it copied the C convention of using “=” for assignment and “==” for equality comparison. One of C's many mistakes. Unfortunately C has been very influential. I'm not sure it's fair to call it

Re: Can math.atan2 return INF?

2016-06-26 Thread Gregory Ewing
Marko Rauhamaa wrote: The singularity being talked about there is an artifact of a particular coordinate system; the theory predicts that there is no *physical* singularity at the event horizon. That theory can't be tested even in principle, can it? Therefore, it is not scientific. It can in

Getting back into PyQt and not loving it.

2016-06-26 Thread Michael Torrie
I'm starting to question the advice I gave not long ago to for new users to consider the Qt toolkit with Python. I just did a little project porting a simple graphical user interface from GTK+ to Qt (PyQt4 for now as that's what I have installed). For the most part it worked out pretty well. It'

Re: Assignment Versus Equality

2016-06-26 Thread Michael Torrie
On 06/26/2016 12:47 PM, Christopher Reimer wrote: > I started writing a BASIC interpreter in Python. The rudimentary version > for 10 PRINT "HELLO, WORLD!" and 20 GOTO 10 ran well. The next version > to read each line into a tree structure left me feeling over my head. So > I got "Writing Compil

Re: Assignment Versus Equality

2016-06-26 Thread Christopher Reimer
On 6/26/2016 8:41 AM, MRAB wrote: On 2016-06-26 11:48, BartC wrote: On 26/06/2016 08:36, Lawrence D’Oliveiro wrote: One of Python’s few mistakes was that it copied the C convention of using “=” for assignment and “==” for equality comparison. One of C's many mistakes. Unfortunately C has bee

Re: Assignment Versus Equality

2016-06-26 Thread Christopher Reimer
On 6/26/2016 6:21 AM, Steven D'Aprano wrote: On Sun, 26 Jun 2016 08:48 pm, BartC wrote: On 26/06/2016 08:36, Lawrence D’Oliveiro wrote: One of Python’s few mistakes was that it copied the C convention of using “=” for assignment and “==” for equality comparison. One of C's many mistakes. Unf

Re: Break and Continue: While Loops

2016-06-26 Thread Elizabeth Weiss
On Thursday, June 23, 2016 at 12:17:23 AM UTC-4, Elizabeth Weiss wrote: > CODE #1: > > i=0 > while 1==1: >print(i) >i=i+1 >if i>=5: > print("Breaking") > break > > -- > I understand that i=0 and i will only be printed if 1=1 > The results of this is > 0 > 1 > 2 > 3 > 4 >

Re: Break and Continue: While Loops

2016-06-26 Thread Elizabeth Weiss
On Thursday, June 23, 2016 at 1:20:37 AM UTC-4, DFS wrote: > On 6/23/2016 12:17 AM, Elizabeth Weiss wrote: > > > CODE #1: > > > > i=0 > > while 1==1: > >print(i) > >i=i+1 > >if i>=5: > > print("Breaking") > > break > > > > -- > > I understand that i=0 and i will only be p

Re: Break and Continue: While Loops

2016-06-26 Thread Elizabeth Weiss
On Thursday, June 23, 2016 at 1:06:09 AM UTC-4, Rustom Mody wrote: > On Thursday, June 23, 2016 at 9:47:23 AM UTC+5:30, Elizabeth Weiss wrote: > > CODE #1: > > > > i=0 > > while 1==1: > >print(i) > >i=i+1 > >if i>=5: > > print("Breaking") > > break > > > > -- > > I under

Re: Break and Continue: While Loops

2016-06-26 Thread Elizabeth Weiss
On Thursday, June 23, 2016 at 12:49:30 AM UTC-4, Lawrence D’Oliveiro wrote: > On Thursday, June 23, 2016 at 4:17:23 PM UTC+12, Elizabeth Weiss wrote: > > > > i=0 > > while 1==1: > >print(i) > >i=i+1 > >if i>=5: > > print("Breaking") > > break > > > > Why is Breaking going to

argparse and subparsers

2016-06-26 Thread Joseph L. Casale
I have some code where sys.argv is sliced up and manually fed to discrete argparse instances each with a single subparser. The reason the discrete parsers all having a single subparser was to make handling the input simpler, the first arg in the slice could be left in. This has become unmaintai

Re: Proposal: named return values through dict initialization and unpacking

2016-06-26 Thread Michael Selik
On Tue, Jun 21, 2016 at 9:41 PM Steven D'Aprano wrote: > On Tue, 21 Jun 2016 05:34 pm, Ari Freund wrote: > > var3, var1, var2 = **d > > But I don't want to use the key names your function uses. I want to > use names which makes sense for my application > Note that my dict unpacking synt

Re: Python Access logging of another program ran in subprocess

2016-06-26 Thread p . infante413
On Monday, June 27, 2016 at 1:36:24 AM UTC+8, MRAB wrote: > > > The output you're seeing might be going to stderr, not stdout. Wow, huhuhu. Thank you. I did not know that. Thanks man! -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Access logging of another program ran in subprocess

2016-06-26 Thread MRAB
On 2016-06-26 17:38, p.infante...@gmail.com wrote: Hello, I'm currently running another Python program (prog2.py) in my program via subprocess. input_args = ['python', '/path/to/prog2.py'] + self.chosen_args file = open("logfile.txt",'w') self.process = Popen((input_args), stdout=file) However

Python Access logging of another program ran in subprocess

2016-06-26 Thread p . infante413
Hello, I'm currently running another Python program (prog2.py) in my program via subprocess. input_args = ['python', '/path/to/prog2.py'] + self.chosen_args file = open("logfile.txt",'w') self.process = Popen((input_args), stdout=file) However, the logs that prog2.py contains still show at the

Re: How to reset IPython notebook file association

2016-06-26 Thread eryk sun
On Sat, Jun 25, 2016 at 11:00 AM, David Shi via Python-list wrote: > I use IPython Notebook to do Python programming. > I used "Open with" and set it with Google Chrome. Then, my IPython notebook > does not load properly. > How can I reset IPython notebook file association, so that I can use it

Re: Assignment Versus Equality

2016-06-26 Thread Marko Rauhamaa
Dennis Lee Bieber : > It did... but I'm sure we'd have a revolt if Python comparison > operators looked like: > > a .eq. b > a .ne. b > a .gt. b .or. c .lt. d > a .le. b .and. c .ge. d Yuck, who'd ever want to look at an eyesore like that. In Python, we will always s

Re: Assignment Versus Equality

2016-06-26 Thread BartC
On 26/06/2016 16:41, MRAB wrote: On 2016-06-26 11:48, BartC wrote: However, why couldn't Python have used "=" both for assignment, and for equality? Since I understand assignment ops can't appear in expressions. [snip] Python supports chained assignments. For example, "a = b = 0" assigns 0

Re: Assignment Versus Equality

2016-06-26 Thread BartC
On 26/06/2016 16:47, Cousin Stanley wrote: Dennis Lee Bieber wrote: but I'm sure we'd have a revolt if Python comparison operators looked like: a .eq. b a .ne. b a .gt. b .or. c .lt. d a .le. b .and. c .ge. d As someone who learned fortran in the mid 1960s and pounded a lot o

Re: Proposal: named return values through dict initialization and unpacking

2016-06-26 Thread Joonas Liik
On 26 June 2016 at 18:28, Ari Freund via Python-list wrote: > Thanks everybody. There seems to be a lot of resistance to dict unpacking, > in addition to the problem with my proposed shorthand dict() initialization > syntax pointed out by Steven D'Aprano, so I won't be pursuing this. > -- > htt

Re: Assignment Versus Equality

2016-06-26 Thread Cousin Stanley
Dennis Lee Bieber wrote: > > but I'm sure we'd have a revolt > if Python comparison operators looked like: > > a .eq. b > a .ne. b > a .gt. b .or. c .lt. d > a .le. b .and. c .ge. d > As someone who learned fortran in the mid 1960s and pounded a lot of fortran code in the 1970s

Re: Assignment Versus Equality

2016-06-26 Thread MRAB
On 2016-06-26 11:48, BartC wrote: On 26/06/2016 08:36, Lawrence D’Oliveiro wrote: One of Python’s few mistakes was that it copied the C convention of using “=” for assignment and “==” for equality comparison. One of C's many mistakes. Unfortunately C has been very influential. However, why c

Re: Proposal: named return values through dict initialization and unpacking

2016-06-26 Thread Ari Freund via Python-list
Thanks everybody. There seems to be a lot of resistance to dict unpacking, in addition to the problem with my proposed shorthand dict() initialization syntax pointed out by Steven D'Aprano, so I won't be pursuing this. -- https://mail.python.org/mailman/listinfo/python-list

Re: Assignment Versus Equality

2016-06-26 Thread Rustom Mody
On Sunday, June 26, 2016 at 6:51:58 PM UTC+5:30, Steven D'Aprano wrote: > On Sun, 26 Jun 2016 08:48 pm, BartC wrote: > > > On 26/06/2016 08:36, Lawrence D’Oliveiro wrote: > >> One of Python’s few mistakes was that it copied the C convention of using > >> “=” for assignment and “==” for equality co

Re: Assignment Versus Equality

2016-06-26 Thread Steven D'Aprano
On Sun, 26 Jun 2016 08:48 pm, BartC wrote: > On 26/06/2016 08:36, Lawrence D’Oliveiro wrote: >> One of Python’s few mistakes was that it copied the C convention of using >> “=” for assignment and “==” for equality comparison. > > One of C's many mistakes. Unfortunately C has been very influential

Re: how to python to use virtual memory?

2016-06-26 Thread Joonas Liik
On 26 June 2016 at 04:47, Ho Yeung Lee wrote: > what is the command or code to write to use virtual memory if i use extra > 20 GB from hard disk as memory, means from 70GB memory to 90GB memory > and left 10GB for file? > > Michael Torrie於 2016年6月25日星期六 UTC+8上午11時00分36秒寫道: >> On 06/24/2016 08:44 P

Re: Break and Continue: While Loops

2016-06-26 Thread Steven D'Aprano
On Sun, 26 Jun 2016 05:32 pm, Lawrence D’Oliveiro wrote: > On Thursday, June 23, 2016 at 11:58:01 PM UTC+12, Jon Ribbens wrote: >> I seem to recall that Java originally insisted that only booleans >> (excluding even Booleans, which are a different thing because of >> course they are) could be chec

Re: Assignment Versus Equality

2016-06-26 Thread BartC
On 26/06/2016 08:36, Lawrence D’Oliveiro wrote: One of Python’s few mistakes was that it copied the C convention of using “=” for assignment and “==” for equality comparison. One of C's many mistakes. Unfortunately C has been very influential. However, why couldn't Python have used "=" both f

Assignment Versus Equality

2016-06-26 Thread Lawrence D’Oliveiro
One of Python’s few mistakes was that it copied the C convention of using “=” for assignment and “==” for equality comparison. It should have copied the old convention from Algol-like languages (including Pascal), where “:=” was assignment, so “=” could keep a meaning closer to its mathematical

Re: Break and Continue: While Loops

2016-06-26 Thread Lawrence D’Oliveiro
On Thursday, June 23, 2016 at 11:58:01 PM UTC+12, Jon Ribbens wrote: > I seem to recall that Java originally insisted that only booleans > (excluding even Booleans, which are a different thing because of > course they are) could be checked for truth and it was one of > Java's significant warts. Ja

Re: How to reset IPython notebook file association

2016-06-26 Thread Lawrence D’Oliveiro
On Saturday, June 25, 2016 at 11:03:17 PM UTC+12, David Shi wrote: > I use IPython Notebook to do Python programming. > I used "Open with" and set it with Google Chrome. Why did you do that? You open notebooks from within your web browser, not your system’s file browser. -- https://mail.python.o

Re: Can math.atan2 return INF?

2016-06-26 Thread Marko Rauhamaa
Gregory Ewing : > Marko Rauhamaa wrote: >> Which phenomenon prevents a black hole from ever forming. Yet >> astronomers keep telling us they are all over the place. > Astronomers have observed objects whose behaviour is entirely > consistent with the existence of black holes as predicted by genera