Re: Quirk difference between classes and functions

2019-02-27 Thread Peter J. Holzer
On 2019-02-27 12:34:37 -0500, Dennis Lee Bieber wrote: > On Tue, 26 Feb 2019 19:15:16 -0800 (PST), jf...@ms4.hinet.net declaimed the > following: > > >So, may I say that the Python compiler is a multi-pass one? > > No... that is implementation dependent... True, but > The common Pyt

Re: Lifetime of a local reference

2019-02-27 Thread Alan Bawden
Gregory Ewing writes: > Alan Bawden wrote: > > the Java Language > > Specification contains the following language: > >Optimizing transformations of a program can be designed that reduce > >the number of objects that are reachable to be less than those which > >would naively be consid

Re: Lifetime of a local reference

2019-02-27 Thread Gregory Ewing
Thomas Jollans wrote: If the inspect module's stack frame inspection machinery is supported, then any function call might access any local... (though I don't think a compliant Python implementation necessarily has to support the inspect module fully). You can be devious even without using the e

Re: Lifetime of a local reference

2019-02-27 Thread Gregory Ewing
Alan Bawden wrote: the Java Language Specification contains the following language: Optimizing transformations of a program can be designed that reduce the number of objects that are reachable to be less than those which would naively be considered reachable. For example, a Java compil

Re: Quirk difference between classes and functions

2019-02-27 Thread jfong
jf...@ms4.hinet.net於 2019年2月26日星期二 UTC+8下午4時46分04秒寫道: > ast於 2019年2月26日星期二 UTC+8上午12時25分40秒寫道: > > Hello > > > > I noticed a quirk difference between classes and functions > > > > >>> x=0 > > >>> > > >>> class Test: > > x = x+1 > > print(x) > > x = x+1 > > p

Re: Lifetime of a local reference

2019-02-27 Thread Thomas Jollans
On 27/02/2019 22:39, Roel Schroeven wrote: > Aren't we overthinking this? No, it's just that nobody had found the evidence you did. > > I think it's pretty clear that a variable is never deleted before it > goes out of scope. A quick search in the documentation points me to > (https://docs.pytho

Re: Lifetime of a local reference

2019-02-27 Thread Roel Schroeven
Rhodri James schreef op 27/02/2019 om 15:18: On 27/02/2019 06:56, Marko Rauhamaa wrote: Alan Bawden : But I appreciate that that isn't the true question that you wanted to ask! You are wondering if a Python implementation is _permitted_ to treat the code you wrote _as if_ you had written:

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dietmar Schwertberger
On 27.02.2019 20:34, Dan Sommers wrote: What is a "network widget" in this context?  Application users don't usually interact with "the network" directly, and networks are usually on the opposite end of applications from the GUI.  What would your hypothetical network widget do?  What cross-platfo

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Michael Torrie
On 02/27/2019 10:59 AM, Igor Korot wrote: > Hopefully with the wxQt having more and more development we might have > a wxQt/Android port getting attention. I don't think Qt has any plans to support Android with the traditional Qt framework. They've instead focused on their next generation system,

Re: Dictionary

2019-02-27 Thread Peter Otten
Phu Sam wrote: > The condition 'if not fibs.get(n):' will not work because > n = 0 > fibs.get(0) is 0 so not 0 is 1 > > Here is the modified code that works: > > fibs={0:0,1:1} > def rfib(n): > if n == 0 or n == 1: > return fibs[n] > else: > fibs[n]=rfib(n-2

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dan Sommers
On 2/27/19 9:37 AM, Dave wrote: I have two Python 3 (3.6) apps that will get the full GUI treatment very soon. I'm in the process of choosing a GUI, and that may be where you/your book can help. Seems this is not a trivial effort (wishing that Python was like VB6 from the 90's). Anyway, here

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Michael Torrie
On 02/27/2019 11:36 AM, Karsten Hilbert wrote: > On Wed, Feb 27, 2019 at 10:38:25AM -0500, Dave wrote: > >> * GUI relatively easy to understand and implement. easyGUI is truly easy in >> all areas, but fails some of my other requirements. The QT/PyQT/PySide2 >> situation is a mess - which one to

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dietmar Schwertberger
On 27.02.2019 16:10, Dave wrote: I have two Python 3 (3.6) apps that will get the full GUI treatment very soon.  I'm in the process of choosing a GUI, and that may be where you/your book can help.  Seems this is not a trivial effort (wishing that Python was like VB6 from the 90's). IMHO what

Re: Python 3 Boto Unable to parse pagination error

2019-02-27 Thread MRAB
On 2019-02-26 20:06, Tim Dunphy wrote: Hi all, I'm trying to create a python 3 script that takes a list of AWS instance IDs. It then prints out some information about the instances and then terminates them. I am very new to python, so still working through some basic issues. This is the error

Re: Dictionary

2019-02-27 Thread Phu Sam
The condition 'if not fibs.get(n):' will not work because n = 0 fibs.get(0) is 0 so not 0 is 1 Here is the modified code that works: fibs={0:0,1:1} def rfib(n): if n == 0 or n == 1: return fibs[n] else: fibs[n]=rfib(n-2)+rfib(n-1) return fibs[n] >>>

Re: Scraping multiple web pages help

2019-02-27 Thread Phu Sam
You need to obtain a key for API first - from https://regulationsgov.github.io/developers/ The Regulations.gov API is taking action to conserve system resources. Beginning immediately, we will limit access to one account per organization, and require approval for enabling accounts.* Please contact

Python 3 Boto Unable to parse pagination error

2019-02-27 Thread Tim Dunphy
Hi all, I'm trying to create a python 3 script that takes a list of AWS instance IDs. It then prints out some information about the instances and then terminates them. I am very new to python, so still working through some basic issues. This is the error I get when I run the script: python

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Karsten Hilbert
On Wed, Feb 27, 2019 at 10:38:25AM -0500, Dave wrote: > * GUI relatively easy to understand and implement. easyGUI is truly easy in > all areas, but fails some of my other requirements. The QT/PyQT/PySide2 > situation is a mess - which one to use, why, any implementation differences, > etc. Pyt

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Igor Korot
Hi, On Wed, Feb 27, 2019 at 10:53 AM Dave wrote: > > On 2/27/19 11:38 AM, Rhodri James wrote: > > On 27/02/2019 15:37, Dave wrote: > >> * GUI must support all desktops with a native look and feel. Kivy > >> fails this one. Will have mobile apps later in the year, so it would > >> be nice if one

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dave
On 2/27/19 11:38 AM, Rhodri James wrote: On 27/02/2019 15:37, Dave wrote: * GUI must support all desktops with a native look and feel.  Kivy fails this one.  Will have mobile apps later in the year, so it would be nice if one GUI fits all, but am ok with 2 gui's if needed. This requirement wi

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Rhodri James
On 27/02/2019 15:37, Dave wrote: * GUI must support all desktops with a native look and feel.  Kivy fails this one.  Will have mobile apps later in the year, so it would be nice if one GUI fits all, but am ok with 2 gui's if needed. This requirement will cause you endless pain, particularly wh

argparse namespace clashes

2019-02-27 Thread Robin Becker
After converting a previously working optparse I found that I should not be using 'args' as a destination as it seemed to break django 1.11 management command execution. I changed both the flag name '--args' to '--task-args' and the destination 'args' to 'task-args' and that seemed to fix thing

Re: Lifetime of a local reference

2019-02-27 Thread Thomas Jollans
On 27/02/2019 16.41, Marko Rauhamaa wrote: > Rhodri James : >> The description of the with statement does explicitly say that the >> context manager's __exit__() method won't be called until the suite >> has been executed, so the reference to the open file must exist for at >> least that long. > >

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dave
Sorry about the duplicate messages - bad hair day! Dave, On 2/27/19 10:38 AM, Dave wrote: On 1/14/19 2:08 PM, Mike Driscoll wrote: Hi, I just thought I would let you all know that I am working on my 2nd wxPython book, "Creating GUI Applications with wxPython". This one will be about actuall

Re: Lifetime of a local reference

2019-02-27 Thread Marko Rauhamaa
Rhodri James : > On 27/02/2019 06:56, Marko Rauhamaa wrote: >> Then there's the question of a sufficient way to prevent premature >> garbage collection: >> >> def fun(): >> f = open("lock") >> flock.flock(f, fcntl.LOCK_EX) >> do_stuff() >> f.close() >>

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dave
On 1/14/19 2:08 PM, Mike Driscoll wrote: Hi, I just thought I would let you all know that I am working on my 2nd wxPython book, "Creating GUI Applications with wxPython". This one will be about actually creating small runnable applications instead of just recipes like my Cookbook did. I hope

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dave
On 1/14/19 2:08 PM, Mike Driscoll wrote: Hi, I just thought I would let you all know that I am working on my 2nd wxPython book, "Creating GUI Applications with wxPython". This one will be about actually creating small runnable applications instead of just recipes like my Cookbook did. I hope

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dave
On 1/14/19 2:08 PM, Mike Driscoll wrote: Hi, I just thought I would let you all know that I am working on my 2nd wxPython book, "Creating GUI Applications with wxPython". This one will be about actually creating small runnable applications instead of just recipes like my Cookbook did. I hope

Re: Lifetime of a local reference

2019-02-27 Thread Rhodri James
On 27/02/2019 06:56, Marko Rauhamaa wrote: Alan Bawden : But I appreciate that that isn't the true question that you wanted to ask! You are wondering if a Python implementation is _permitted_ to treat the code you wrote _as if_ you had written: def fun(): f = open("lock") fl

Re: Lifetime of a local reference

2019-02-27 Thread Thomas Jollans
On 27/02/2019 04.14, Alan Bawden wrote: > Marko Rauhamaa writes: >> I couldn't find an immediate answer in the documentation. > > I suspect that given the history of Python, pretty much everybody has > always assumed that a Python implementation will not delete local variables > early. But I agr

Re: Lifetime of a local reference

2019-02-27 Thread Test Bot
Just to add on regarding file I/O. It would be more pythonic to use. with open(path): do_stuff() On Wed, Feb 27, 2019, 3:31 AM Marko Rauhamaa wrote: > > Consider this function: > > def fun(): > f = open("lock") > flock.flock(f, fcntl.LOCK_EX) > do_stuff() >