Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread Chris Angelico
On Fri, Jul 13, 2018 at 2:44 PM, wrote: > On Thursday, July 12, 2018 at 7:16:48 PM UTC-4, Chris Angelico wrote: >> Not sure, but here's a simpler implementation: >> >> except Exception as .err.0: >> print(.err.0) >> .err.0 = None >> del .err.0 >> >> In other words, exactly the same as

Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread codewizard
On Thursday, July 12, 2018 at 7:16:48 PM UTC-4, Chris Angelico wrote: > On Fri, Jul 13, 2018 at 8:10 AM Igor wrote: > > On Thursday, July 12, 2018 at 5:45:52 AM UTC-4, Ben Bacarisse wrote: > >> aleiphoenix writes: > >> > >> [snip] > >> > >> When an exception has been assigned using as target, it

Google weirdness

2018-07-12 Thread Travis McGee
I somehow managed to trigger the dialog below by typing in a certain Python phrase to Google. Anyone know what it's about? It shows up in what appears to be terminal screen. Viz: Google has a code challenge ready for you. Been here before? This invitation will expire if you close this page.

Is this a known futurize problem?

2018-07-12 Thread Skip Montanaro
I'm using futurize to update the SpamBayes codebase to Python 3. It doesn't seem to properly handle code which already has __future__ imports. When it wants to insert imports, it blindly puts them ahead of the earliest import, even if it happens to be a __future__ import. For example, here's the fi

Hey Ranting Rick, this is your moment to shine!

2018-07-12 Thread Steven D'Aprano
Hey Rick, if you're reading this, now that Guido has resigned, this is your opportunity to declare yourself as the true Heir and take over as BDFL. *runs and hides* Sorry-sometimes-I-can't-help-myself-I-would-have-deleted-this-post-but-I- already-hit-send-ly y'rs, -- Steven D'Aprano --

Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread aleiphoenix
On Thursday, July 12, 2018 at 5:45:52 PM UTC+8, Ben Bacarisse wrote: > > Yes, it's intentional, but it's not exactly a scope. In > > https://docs.python.org/3/reference/compound_stmts.html#try > > -- > Ben. Thank you for the reply. Never thought of this kind of problem in Python3. On Thurs

Re: Guido van Rossum resigns as Python leader

2018-07-12 Thread MRAB
On 2018-07-12 23:20, Roel Schroeven wrote: Yes, you read that right: Guido van Rossum resigns as Python leader. See his mail: (https://mail.python.org/pipermail/python-committers/2018-July/005664.html) [snip] That's very sad news. I believe the usual practice in a dictatorship is for the eld

Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-12 Thread Peter Otten
D'Arcy Cain wrote: > $ python2.7 -c "import ctypes.util; > print(ctypes.util.find_library('cairo'))" > libcairo.so.2 > $ python3.6 -c "import ctypes.util; > print(ctypes.util.find_library('cairo'))" > None > > I have the 3.6 version of py-cairo installed. Any thoughts? > > NetBSD 7.1.2 Wild gu

Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread Chris Angelico
On Fri, Jul 13, 2018 at 8:10 AM, wrote: > On Thursday, July 12, 2018 at 5:45:52 AM UTC-4, Ben Bacarisse wrote: >> aleiphoenix writes: >> >> [snip] >> >> When an exception has been assigned using as target, it is cleared at >> the end of the except clause. This is as if >> >> except E as N:

Re: Guido van Rossum resigns as Python leader

2018-07-12 Thread Abdur-Rahmaan Janhangeer
if linux boasts commits, python boasts community in any sphere, the human aspect of things reoccurs. python has not it's parallel in languages, for it has set up the pattern for rapid and effective amelioration besides those words, the core-devs said all what i had to say leader or not, you rema

Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread Ben Bacarisse
Just word on quoting... codewiz...@gmail.com writes: > On Thursday, July 12, 2018 at 5:45:52 AM UTC-4, Ben Bacarisse wrote: >> >> [snip] You cut everything I wrote. What you left is what I quoted from the Python documentation. In fairness to the authors you should probably have cut the attrib

Guido van Rossum resigns as Python leader

2018-07-12 Thread Roel Schroeven
Yes, you read that right: Guido van Rossum resigns as Python leader. See his mail: (https://mail.python.org/pipermail/python-committers/2018-July/005664.html) Now that PEP 572 is done, I don't ever want to have to fight so hard > for a PEP and find that so many people despise my decisions.

Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread codewizard
On Thursday, July 12, 2018 at 5:45:52 AM UTC-4, Ben Bacarisse wrote: > aleiphoenix writes: > > [snip] > > When an exception has been assigned using as target, it is cleared at > the end of the except clause. This is as if > > except E as N: > foo > > was translated to > > excep

Re: Python 3.6 can find cairo libs but not Python 2.7

2018-07-12 Thread Terry Reedy
On 7/12/2018 3:52 PM, D'Arcy Cain wrote: $ python2.7 -c "import ctypes.util; print(ctypes.util.find_library('cairo'))" libcairo.so.2 $ python3.6 -c "import ctypes.util; print(ctypes.util.find_library('cairo'))" None I have the 3.6 version of py-cairo installed. Any thoughts? NetBSD 7.1.2 wha

Python 3.6 can find cairo libs but not Python 2.7

2018-07-12 Thread D'Arcy Cain
$ python2.7 -c "import ctypes.util; print(ctypes.util.find_library('cairo'))" libcairo.so.2 $ python3.6 -c "import ctypes.util; print(ctypes.util.find_library('cairo'))" None I have the 3.6 version of py-cairo installed. Any thoughts? NetBSD 7.1.2 Cheers. -- D'Arcy J.M. Cain System Administra

Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread Chris Angelico
On Thu, Jul 12, 2018 at 11:23 PM, Ed Kellett wrote: > Could we fix: > > for x in something: > blah(lambda a: a + x) > > while we're at it? What do you mean by "fix"? Make the 'x' bind eagerly? That would break basically every other use of closures. ChrisA -- https://mail.python.org/mailma

EuroPython 2018: Conference App available

2018-07-12 Thread M.-A. Lemburg
We are pleased to announce the conference app for EuroPython 2018, again hosted on the Attendify platform: * EuroPython 2018 Conference App * https://ep2018.europython.eu/en/events/conference-app/ Engage with the conference and its attendees -

EuroPython 2018: Call for On-site Volunteers

2018-07-12 Thread M.-A. Lemburg
Ever wanted to help out during Europython ? Do you want to *really* take part in EuroPython, meet new people and help them at the same time ? We have just the right thing for you: apply as EuroPython Volunteer and be part of the great team that is making EuroPython 2018 a reality this year. Euro

Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread Ed Kellett
On 2018-07-12 14:03, Chris Angelico wrote: > Dealing with reference cycles is generally done *periodically* rather > than immediately (CPython disposes of unreferenced objects immediately > upon last deref). You can avoid having a dedicated cycle detection > pass by using a mark-and-sweep GC, but t

Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread Chris Angelico
On Thu, Jul 12, 2018 at 10:31 PM, Ed Kellett wrote: > On 2018-07-12 10:59, Steven D'Aprano wrote: >> On Thu, 12 Jul 2018 01:37:24 -0700, aleiphoenix wrote: >> >>> My question is, does except ... as ... create a new scope from outer >>> block, causing 'err' be hidden from outer scope? Is this inten

Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread Ed Kellett
On 2018-07-12 10:59, Steven D'Aprano wrote: > On Thu, 12 Jul 2018 01:37:24 -0700, aleiphoenix wrote: > >> My question is, does except ... as ... create a new scope from outer >> block, causing 'err' be hidden from outer scope? Is this intentional? > > No, it is not a new scope, and yes, it is int

Re: Feasibility of console based (non-Gui) Tkinter app which can accept keypresses?

2018-07-12 Thread jkn
Hi All thanks for the comments and confirmation that this is not really possible in a Tkinter environment. I had thought of using ncurses but was shying clear of learning about another set of widgets etc. just now. The output of the simulator is simple enough that it could just accept simple

Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread Steven D'Aprano
On Thu, 12 Jul 2018 01:37:24 -0700, aleiphoenix wrote: > My question is, does except ... as ... create a new scope from outer > block, causing 'err' be hidden from outer scope? Is this intentional? No, it is not a new scope, and yes, it is intentional. It's a nasty hack, but a *necessary* nasty

Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread Ben Bacarisse
aleiphoenix writes: > suppose following code running with Python-3.4.8 and Python-3.6.5 > > > # -*- coding: utf-8 -*- > > > def hello(): > err = None > print('0: {}'.format(locals())) > try: > b = 2 > print('1: {}'.format(locals())) > raise ValueError() >

variable scope in try ... EXCEPT block.

2018-07-12 Thread aleiphoenix
suppose following code running with Python-3.4.8 and Python-3.6.5 # -*- coding: utf-8 -*- def hello(): err = None print('0: {}'.format(locals())) try: b = 2 print('1: {}'.format(locals())) raise ValueError() print('2: {}'.format(locals())) except