Re: [Python-Dev] assignment expressions: an alternative proposal

2018-04-24 Thread Chris Angelico
On Wed, Apr 25, 2018 at 1:15 AM, Steven D'Aprano wrote: > By the way, the check for existing variables cannot help to be either > incomplete or incorrect if you try to do it at compile time: > > > from module import * > (x = 2) # allowed or not allowed? > > > If you don't like wild-card i

Re: [Python-Dev] assignment expressions: an alternative proposal

2018-04-24 Thread Chris Angelico
On Wed, Apr 25, 2018 at 1:49 AM, Yury Selivanov wrote: > On Tue, Apr 24, 2018 at 11:34 AM, Steven D'Aprano wrote: >> On Tue, Apr 24, 2018 at 11:05:57AM -0400, Yury Selivanov wrote: >> >>> Well, `my_func(a=(b:=foo))` or `my_func(b:=foo)` are also barely >>> readable to my eye. >> >> There's no adv

Re: [Python-Dev] assignment expressions: an alternative proposal

2018-04-24 Thread Chris Angelico
On Wed, Apr 25, 2018 at 1:56 AM, Yury Selivanov wrote: > On Tue, Apr 24, 2018 at 11:51 AM, Ethan Furman wrote: > >>> When I compare to variables from outer scopes they *usually* are on >>> the *right* side of '=='. >> >> >> You mean something like >> >> if 2 == x: >> >> ? I never write code li

Re: [Python-Dev] assignment expressions: an alternative proposal

2018-04-24 Thread Chris Angelico
On Wed, Apr 25, 2018 at 2:28 AM, Steven D'Aprano wrote: > On Tue, Apr 24, 2018 at 10:58:24AM -0400, Yury Selivanov wrote: > >> Since 'diff' and 'g' must be new names according to rule (3), those >> who read the code will notice that both were not previously bound. > > How am I supposed to notice t

Re: [Python-Dev] assignment expressions: an alternative proposal

2018-04-24 Thread Chris Angelico
On Wed, Apr 25, 2018 at 2:23 AM, Steven D'Aprano wrote: > On Tue, Apr 24, 2018 at 11:25:58AM -0400, Yury Selivanov wrote: > >> No, it doesn't. The check is performed during compile phase, and >> Python does not unroll loops. Anyways, read below. > > What does unrolling loops have to do with anythi

Re: [Python-Dev] PEP 572: Assignment Expressions

2018-04-24 Thread Chris Angelico
On Wed, Apr 25, 2018 at 2:40 AM, Tim Peters wrote: > [Antoine] >> ... >> Yes... I think most will agree that Python is generally easy to take up >> for people coming from C++ etc., so my "easier to learn and teach" was >> mostly about non-programmers. > > [Tim] >>> even for raw beginners the seman

Re: [Python-Dev] assignment expressions: an alternative proposal

2018-04-24 Thread Chris Angelico
On Wed, Apr 25, 2018 at 2:57 AM, Steven D'Aprano wrote: > On Wed, Apr 25, 2018 at 02:42:08AM +1000, Chris Angelico wrote: > >> > from math import * >> > process(arg, (pi = 1), pi+1) # allowed > > >> That's not allowed at local scope (at lea

Re: [Python-Dev] PEP 572: Assignment Expressions

2018-04-24 Thread Chris Angelico
On Wed, Apr 25, 2018 at 5:54 AM, Mike Miller wrote: > Also, these "binding expressions" are not exactly plain assignment, as it > has been known. Aside from the restriction to binding only to a simple name, and the fact that they're also an expression with the same value, how are they not the sam

Re: [Python-Dev] assignment expressions: an alternative proposal

2018-04-24 Thread Chris Angelico
On Wed, Apr 25, 2018 at 7:29 AM, Anthony Flury via Python-Dev wrote: > On 24/04/18 17:11, Yury Selivanov wrote: >> >> On Tue, Apr 24, 2018 at 12:03 PM, Ethan Furman wrote: >> [..] >>> >>> But I do write this: >>> >>>def wrapper(func, some_value): >>> value_I_want = process(some_value) >>

Re: [Python-Dev] PEP 572: Write vs Read, Understand and Control Flow

2018-04-24 Thread Chris Angelico
On Wed, Apr 25, 2018 at 1:43 PM, Steven D'Aprano wrote: > On Tue, Apr 24, 2018 at 08:10:49PM -0500, Tim Peters wrote: > >> Binding expressions are debugger-friendly in that they _don't_ just >> vanish without a trace. It's their purpose to _capture_ the values of >> the expressions they name. In

Re: [Python-Dev] The new and improved PEP 572, same great taste with 75% less complexity!

2018-04-25 Thread Chris Angelico
On Wed, Apr 25, 2018 at 4:55 PM, Nathaniel Smith wrote: > On Tue, Apr 24, 2018 at 8:31 AM, Chris Angelico wrote: >> The most notable change since last posting is that the assignment >> target is no longer as flexible as with the statement form of >> assignment, but is restri

Re: [Python-Dev] assignment expressions: an alternative alternative proposal

2018-04-25 Thread Chris Angelico
On Thu, Apr 26, 2018 at 1:46 AM, Guido van Rossum wrote: > On Wed, Apr 25, 2018 at 2:27 AM, Steve Holden wrote: >> >> On Wed, Apr 25, 2018 at 6:16 AM, Steven D'Aprano >> wrote: >>> >>> On Tue, Apr 24, 2018 at 03:54:30PM -0700, Guido van Rossum wrote: >>> >>> > We should really take this back to

Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-25 Thread Chris Angelico
On Thu, Apr 26, 2018 at 6:21 AM, Łukasz Langa wrote: > := also goes against having one obvious way to do it. Since it's an > expression, > it can also be placed on its own line or in otherwise weird places like > function call arguments. I anticipate PEP 8 would have to be extended to > explicitl

Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-25 Thread Chris Angelico
On Thu, Apr 26, 2018 at 8:08 AM, Antoine Pitrou wrote: > On Wed, 25 Apr 2018 16:55:43 -0500 > Tim Peters wrote: >> >> To my eyes, this is genuinely harder to follow, despite its relative brevity: >> >> while total != (total := total + term): > > Does it even work? Perhaps if the goal is

Re: [Python-Dev] The new and improved PEP 572, same great taste with 75% less complexity!

2018-04-25 Thread Chris Angelico
On Thu, Apr 26, 2018 at 9:05 AM, Victor Stinner wrote: >> # Handle a matched regex >> if (match := pattern.search(data)) is not None: >> ... >> >> # A more explicit alternative to the 2-arg form of iter() invocation >> while (value := read_next_item()) is not None: >>

Re: [Python-Dev] Visual similarity of "=" and "==" (in context of PEP 572)

2018-04-25 Thread Chris Angelico
On Thu, Apr 26, 2018 at 9:54 AM, Mikhail V wrote: > Since the discussion about operator choice has completely migrated > here, I'll put my note also here. > From the very beginning of PEP 572 discussion I have noticed > a strange fact - there is told a lot about visual similarity > of "=" and "=="

Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-25 Thread Chris Angelico
On Thu, Apr 26, 2018 at 10:11 AM, Yury Selivanov wrote: > Just yesterday this snippet was used on python-dev to show how great the > new syntax is: > > my_func(arg, buffer=(buf := [None]*get_size()), size=len(buf)) > > To my eye this is an anti-pattern. One line of code was saved, but t

Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-25 Thread Chris Angelico
On Thu, Apr 26, 2018 at 3:34 PM, Steven D'Aprano wrote: > On Thu, Apr 26, 2018 at 05:22:58PM +1200, Greg Ewing wrote: >> Łukasz Langa wrote: >> >What was its own assignment before >> >now is part of the logic test. This saves on vertical whitespace but makes >> >parsing and understanding logic tes

Re: [Python-Dev] PEP 572: Write vs Read, Understand and Control Flow

2018-04-25 Thread Chris Angelico
On Thu, Apr 26, 2018 at 3:54 PM, Stephen J. Turnbull wrote: > Chris Angelico writes: > > > Additionally, naming sub-parts of a large expression can assist an > > interactive debugger, providing useful display hooks and partial > > results. Without a way to capture sub-

Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-26 Thread Chris Angelico
On Thu, Apr 26, 2018 at 6:30 PM, Antoine Pitrou wrote: > On Thu, 26 Apr 2018 17:29:17 +1000 > Steven D'Aprano wrote: >> On Thu, Apr 26, 2018 at 07:16:28PM +1200, Greg Ewing wrote: >> > Tim Peters wrote: >> > >As a statement in a program (as opposed to typed at a shell), >> > >"a := 3" has the unn

Re: [Python-Dev] PEP 572: Write vs Read, Understand and Control Flow

2018-04-26 Thread Chris Angelico
On Thu, Apr 26, 2018 at 9:23 PM, Stephen J. Turnbull wrote: > Chris Angelico writes: > > > Well, true. The point isn't WHO you're dictating to, > > By "period here preferred," I meant I think it's mostly a waste of > space to mention dictation at al

Re: [Python-Dev] PEP 572: Why not := as standard assignment operator?

2018-04-26 Thread Chris Angelico
On Thu, Apr 26, 2018 at 11:13 PM, Martin Teichmann wrote: > Hi list, > > when reading PEP 572 I actually liked it a lot - I think it's actually > a cool idea. I think it's actually that cool an idea that it should be > made the default way of doing an assignment, over time phasing out the > good o

Re: [Python-Dev] The new and improved PEP 572, same great taste with 75% less complexity!

2018-04-26 Thread Chris Angelico
Nick Coghlan wrote: >> >> On 25 April 2018 at 18:23, Chris Angelico wrote: >> >>>> x={print(2): print(1) for _ in [1]} >> > 1 >> > 2 >> > >> > Hm. One of these is not like the others... >> >> Huh, it looks like

Re: [Python-Dev] PEP 572: Why not := as standard assignment operator?

2018-04-26 Thread Chris Angelico
On Fri, Apr 27, 2018 at 1:38 AM, Gustavo Carneiro wrote: > > > On 26 April 2018 at 16:18, Chris Angelico wrote: >> >> On Thu, Apr 26, 2018 at 11:13 PM, Martin Teichmann >> wrote: >> > Hi list, >> > >> > when reading PEP 572 I actually like

Re: [Python-Dev] The new and improved PEP 572, same great taste with 75% less complexity!

2018-04-26 Thread Chris Angelico
On Fri, Apr 27, 2018 at 2:02 AM, Guido van Rossum wrote: > Maybe the order for d[k] = v should also be reconsidered? If so, it would be something like: 1) Evaluate d 2) Evaluate k 3) Evaluate v 4) Call d.__setitem__(k, v), via slots etc In a vacuum, I don't have a problem with that. But I suspe

Re: [Python-Dev] PEP 572: Assignment Expressions

2018-04-26 Thread Chris Angelico
On Fri, Apr 27, 2018 at 3:33 AM, Sven R. Kunze wrote: > On 25.04.2018 01:19, Steven D'Aprano wrote: >> >> Sorry, gcd(diff, n) is not the "perfect name", and I will tell you that >> sometimes g is better. [...] > > > We were talking about the real-world code snippet of Tim (as a justification > of

Re: [Python-Dev] The new and improved PEP 572, same great taste with 75% less complexity!

2018-04-26 Thread Chris Angelico
On Fri, Apr 27, 2018 at 4:07 AM, Larry Hastings wrote: > * I assume that--if we don't already have one--we'll add a new > DUP_AND_STORE_FAST opcode for binding expressions. On the other hand, > "STORE_FAST n" followed by "LOAD_FAST n" is a common enough bytecode idiom > that the peephole optimize

Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-27 Thread Chris Angelico
On Fri, Apr 27, 2018 at 8:18 PM, Wes Turner wrote: > IDK, I could just be resistant to change, but this seems like something that > will decrease readability -- and slow down code review -- without any real > performance gain. So, while this would be useful for golfed-down (!) > one-liners with py

Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-27 Thread Chris Angelico
On Sat, Apr 28, 2018 at 6:06 AM, Wes Turner wrote: > > > On Friday, April 27, 2018, Chris Angelico wrote: >> >> On Fri, Apr 27, 2018 at 8:18 PM, Wes Turner wrote: >> > IDK, I could just be resistant to change, but this seems like something >> > that >

Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-27 Thread Chris Angelico
On Sat, Apr 28, 2018 at 6:24 AM, Wes Turner wrote: > > > On Friday, April 27, 2018, Chris Angelico wrote: >> >> On Sat, Apr 28, 2018 at 6:06 AM, Wes Turner wrote: >> > >> > >> > On Friday, April 27, 2018, Chris Angelico wrote: >>

Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-27 Thread Chris Angelico
On Sat, Apr 28, 2018 at 7:11 AM, Tim Peters wrote: > [Chris Angelico ] >> ... >> I don't understand why people bring up all these arguments that have >> absolutely nothing to do with the proposal at hand. None of this has >> in any way changed. > > That'

Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-28 Thread Chris Angelico
On Sat, Apr 28, 2018 at 9:18 PM, Ned Batchelder wrote: > It's entirely true that binding expressions don't change this situation at > all, EXCEPT that the entire point of binding expressions is to be able to > express in one statement what used to take more than one. With binding > expressions, a

Re: [Python-Dev] PEP 572 contradicts PEP 3099

2018-04-28 Thread Chris Angelico
On Sun, Apr 29, 2018 at 1:11 PM, Alex Walters wrote: > > >> -Original Message- >> From: Python-Dev > list=sdamon@python.org> On Behalf Of Greg Ewing >> Sent: Saturday, April 28, 2018 10:53 PM >> To: 'Python-Dev' >> Subject: Re: [Python-Dev] PEP 572 contradicts PEP 3099 >> >> Alex Walt

Re: [Python-Dev] PEP 572: Assignment Expressions

2018-04-30 Thread Chris Angelico
On Tue, May 1, 2018 at 12:30 AM, Mark Shannon wrote: > List comprehensions > --- > The PEP uses the term "simplifying" when it really means "shortening". > One example is > stuff = [[y := f(x), x/y] for x in range(5)] > as a simplification of > stuff = [(lambda y: [y,x/y])(f(x)) fo

Re: [Python-Dev] PEP 572: Assignment Expressions

2018-04-30 Thread Chris Angelico
On Tue, May 1, 2018 at 2:53 AM, Yury Selivanov wrote: > On Mon, Apr 30, 2018 at 11:32 AM Chris Angelico wrote: > >> On Tue, May 1, 2018 at 12:30 AM, Mark Shannon wrote: >> > List comprehensions >> > --- >> > The PEP uses the term "s

Re: [Python-Dev] Python startup time

2018-05-03 Thread Chris Angelico
On Fri, May 4, 2018 at 10:43 AM, Gregory P. Smith wrote: > I'd also like to see this concept somehow extended to decorators so that the > results of the decoration can be captured in the compiled pyc rather than > requiring execution at import time. I realize that limits what decorators > can do,

Re: [Python-Dev] Dealing with tone in an email

2018-05-05 Thread Chris Angelico
On Sun, May 6, 2018 at 10:22 AM, Ivan Pozdeev via Python-Dev wrote: > Well, this _is_ a big deal. As in, "with 15+ years of experience, 5+ with > Python, I failed to produce a working GUI in a week; no-one on the Net, > regardless of experience, (including Terry) is ever sure how to do things > ri

Re: [Python-Dev] Dealing with tone in an email

2018-05-05 Thread Chris Angelico
On Sun, May 6, 2018 at 11:39 AM, Steven D'Aprano wrote: > On Sun, May 06, 2018 at 11:09:21AM +1000, Chris Angelico wrote: > >> What exactly didn't work? I don't understand. > > https://bugs.python.org/issue33412 > I've read it and I still don't full

Re: [Python-Dev] Dealing with tone in an email

2018-05-06 Thread Chris Angelico
On Sun, May 6, 2018 at 6:54 PM, Terry Reedy wrote: >> Is it ALL of Tkinter that fails in threaded mode? > > No. It is non-threaded tcl that fails in threaded mode, along with > tkinter's attempt to make non-thread tcl work anyway. There are at least > two different cases. > > Ivan has clarified

Re: [Python-Dev] Dealing with tone in an email

2018-05-06 Thread Chris Angelico
On Mon, May 7, 2018 at 6:04 AM, Terry Reedy wrote: > On 5/6/2018 10:03 AM, Chris Angelico wrote: >> If it were up to me, I would deprecate non-threaded mode immediately, > > > Given that 99% of tkinter users do not need threaded tcl, why cut some of > them off? "Non-t

Re: [Python-Dev] Process to remove a Python feature

2018-05-08 Thread Chris Angelico
On Wed, May 9, 2018 at 2:53 AM, Serhiy Storchaka wrote: > 08.05.18 19:10, Ethan Furman пише: >>> >>> X.Y+1: added a deprecation warning. Many users need to support only two >>> recent versions and can move to using the >>> replacement now. >> >> >> I'm curious how you arrived at this conclusion?

[Python-Dev] Associated images in PEPs broken?

2018-05-11 Thread Chris Angelico
https://www.python.org/dev/peps/pep-0495/ All the images seem to be missing - showing up 404. They're in the peps repository, but aren't showing up in the page. Who's in charge of the HTML rendering there? Infrastructure? ChrisA ___ Python-Dev mailing l

Re: [Python-Dev] Associated images in PEPs broken?

2018-05-11 Thread Chris Angelico
On Fri, May 11, 2018 at 9:33 PM, Chris Angelico wrote: > https://www.python.org/dev/peps/pep-0495/ > > All the images seem to be missing - showing up 404. They're in the > peps repository, but aren't showing up in the page. Who's in charge of > the HTML rendering the

Re: [Python-Dev] PEP 572 and f-strings

2018-05-12 Thread Chris Angelico
On Sat, May 12, 2018 at 9:11 PM, Eric V. Smith wrote: > I don't think it matters to its acceptance, but PEP 572 should at least > mention that the := syntax means that you cannot use assignment expressions > in f-strings. > > As I wrote in a python-ideas email, f'{x:=4}' already has a defined mean

[Python-Dev] Looking for examples: proof that a list comp is a function

2018-05-14 Thread Chris Angelico
Guido has stated that this parallel is desired and important: result = [f(x) for x in iter if g(x)] result = list(f(x) for x in iter if g(x)) Obviously the genexp has to be implemented with a nested function, since there's no guarantee that it'll be iterated over in this way. With current semanti

Re: [Python-Dev] What is the rationale behind source only releases?

2018-05-15 Thread Chris Angelico
On Wed, May 16, 2018 at 3:06 PM, Ben Finney wrote: > "Alex Walters" writes: > >> I'd like to know the rationale behind source only releases of cpython. > > Software freedom entails the freedom to modify and build the software. > For that, one needs the source form of the software. > > Portable so

Re: [Python-Dev] Hashes in Python3.5 for tuples and frozensets

2018-05-17 Thread Chris Angelico
On Thu, May 17, 2018 at 5:21 PM, Anthony Flury via Python-Dev wrote: > Victor, > Thanks for the link, but to be honest it will just confuse people - neither > the link or the related bpo entries state that the fix is only limited to > strings. They simply talk about hash randomization - which in m

Re: [Python-Dev] Hashes in Python3.5 for tuples and frozensets

2018-05-17 Thread Chris Angelico
optimization, without profiling > their application. It seems every choice is made based on the speed of that > operation; without consideration of how often that operation is used. Sounds like we're on the same page here. > On 17/05/18 09:16, Chris Angelico wrote: >> The h

Re: [Python-Dev] My fork lacks a 3.7 branch - can I create it somehow?

2018-05-21 Thread Chris Angelico
On Tue, May 22, 2018 at 10:07 AM, Skip Montanaro wrote: > My GitHub fork of the cpython repo was made awhile ago, before a 3.7 branch > was created. I have no remotes/origin/3.7. Is there some way to create it > from remotes/upstream/3.7? I asked on GitHub's help forums. The only > recommendation

Re: [Python-Dev] My fork lacks a 3.7 branch - can I create it somehow?

2018-05-21 Thread Chris Angelico
On Tue, May 22, 2018 at 10:45 AM, Skip Montanaro wrote: >> Create it from upstream? Yep! Try this: > >> git checkout -b 3.7 upstream/3.7 >> git push -u origin 3.7 > > Thanks, Chris! Didn't have to chug for too long either, just a few seconds. > > S Perfect! I'm used to doing this sort of thing wi

Re: [Python-Dev] Why not using "except: (...) raise" to cleanup on error?

2018-06-04 Thread Chris Angelico
On Tue, Jun 5, 2018 at 2:11 AM, Victor Stinner wrote: > Hi, > > I just read a recent bugfix in asyncio: > > https://github.com/python/cpython/commit/9602643120a509858d0bee4215d7f150e6125468 > > + try: > + await waiter > + except Exception: > + transport.close() > + raise > > Why only c

Re: [Python-Dev] Why not using "except: (...) raise" to cleanup on error?

2018-06-04 Thread Chris Angelico
On Tue, Jun 5, 2018 at 2:57 AM, Yury Selivanov wrote: > On Mon, Jun 4, 2018 at 12:50 PM Chris Angelico wrote: >> >> On Tue, Jun 5, 2018 at 2:11 AM, Victor Stinner wrote: > [..] >> > For me, it's fine to catch any exception using "except:" if the block

Re: [Python-Dev] Microsoft to acquire GitHub for $7.5 b

2018-06-07 Thread Chris Angelico
On Fri, Jun 8, 2018 at 3:33 AM, Chris Barker - NOAA Federal via Python-Dev wrote: > Any service could change or fail. Period. > > So we shouldn’t want valuable information about Python development > only in gitHub. > > I don’t know how hard it is to backup / mirror an entire repo — but it > sure s

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-22 Thread Chris Angelico
On Sat, Jun 23, 2018 at 3:02 AM, Michael Selik wrote: > On Fri, Jun 22, 2018 at 8:09 AM Antoine Pitrou wrote: >> >> Thank you. Personally, I'd like to see feedback from >> educators/teachers after they take the time to read the PEP and take >> some time to think about its consequences. > > > I'v

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-22 Thread Chris Angelico
On Sat, Jun 23, 2018 at 1:48 PM, Steven D'Aprano wrote: > I can't say I've done a broad survey, but the third-party documentation > I've read on comprehensions typically glosses over the scoping issues > without mentioning them. To the extent that scoping is even hinted at, > comprehensions are tr

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-23 Thread Chris Angelico
On Sun, Jun 24, 2018 at 4:33 PM, Nick Coghlan wrote: > On 24 June 2018 at 15:56, Steven D'Aprano wrote: >> On Sun, Jun 24, 2018 at 02:33:59PM +1000, Nick Coghlan wrote: >> >>> Given that PEP 572 *is* proposing implicit comprehension state export, >> >> "Implicit" and "explicit" are two terms whic

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-24 Thread Chris Angelico
On Mon, Jun 25, 2018 at 4:06 AM, Steven D'Aprano wrote: > > Remember, the driving use-case which started this (ever-so-long) > discussion was the ability to push data into a comprehension and then > update it on each iteration, something like this: > > x = initial_value() > results = [x :=

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-25 Thread Chris Angelico
On Tue, Jun 26, 2018 at 5:37 AM, Terry Reedy wrote: > How loop variables might be isolated without a nested scope: After a > comprehension is parsed, so that names become strings, rename the loop > variables to something otherwise illegal. For instance, i could become > '', just as lambda becomes

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-27 Thread Chris Angelico
On Wed, Jun 27, 2018 at 5:30 PM, Paul Moore wrote: > But test() returns [1, 2]. So does that say (as you claim above) that > "the comprehension ran in the enclosing scope"? Doesn't it just say > that the outermost iterable runs in the enclosing scope? Yes - because the *outermost iterable* runs i

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-27 Thread Chris Angelico
On Wed, Jun 27, 2018 at 7:19 PM, Steven D'Aprano wrote: > On Wed, Jun 27, 2018 at 05:52:16PM +1000, Chris Angelico wrote: > >> def test(): >> a = 1 >> b = 2 >> vars = {key: locals()[key] for key in locals()} >> return vars >> &

Re: [Python-Dev] Reminder: 3.5 now has its own branch! "default" branch is now 3.6!

2015-05-24 Thread Chris Angelico
On Mon, May 25, 2015 at 9:49 AM, Larry Hastings wrote: > I've now pushed the 3.5.0 beta 1 release-engineering checkins to > hg.python.org. At the same time I did this, I also created the 3.5 branch. > > Quick FAQ: Additional Q. What does this mean for buildbots? Will they immediately pick up the

Re: [Python-Dev] Single-file Python executables (was: Computed Goto dispatch for Python 2)

2015-05-28 Thread Chris Angelico
On Fri, May 29, 2015 at 2:28 AM, Chris Barker wrote: > oops, sorry -- I see this was addressed in another thread. Though I guess I > still don't see why "single file" is critical, over "single thing to > install" -- like a OS-X app bundle that can just be dragged into the > Applications folder. T

Re: [Python-Dev] Single-file Python executables (was: Computed Goto dispatch for Python 2)

2015-05-28 Thread Chris Angelico
On Fri, May 29, 2015 at 3:04 AM, Brian Curtin wrote: > Donald mentioned one earlier: command line utilities. I want a single > CLI I can deploy to my customers that doesn't make them have to > install Python or even know it's Python at all. My users write code in > all types of languages on all OS

Re: [Python-Dev] Single-file Python executables (was: Computed Goto dispatch for Python 2)

2015-05-28 Thread Chris Angelico
On Fri, May 29, 2015 at 3:20 AM, Donald Stufft wrote: > On May 28, 2015 at 12:54:34 PM, Chris Angelico (ros...@gmail.com) wrote: >> Is this a Windows-specific issue, or is it also intended for Linux and >> Mac OS, where there'll already be a system Python (so a >> singl

Re: [Python-Dev] Single-file Python executables (was: Computed Goto dispatch for Python 2)

2015-05-28 Thread Chris Angelico
On Fri, May 29, 2015 at 3:52 AM, Paul Moore wrote: > On 28 May 2015 at 18:15, Chris Angelico wrote: >> Unix-like systems have this courtesy of the shebang, so as long as >> there's some sort of Python installed, people don't need to know or >> care that /usr/local

Re: [Python-Dev] 2.7 is here until 2020, please don't call it a waste.

2015-05-30 Thread Chris Angelico
On Sat, May 30, 2015 at 8:35 PM, Antoine Pitrou wrote: > On Sat, 30 May 2015 10:34:15 +1000 > Nick Coghlan wrote: >> On 30 May 2015 09:57, "Antoine Pitrou" wrote: >> > >> > On Sat, 30 May 2015 01:49:10 +0200 >> > Christian Heimes wrote: >> > > For performance patches we have to consider our res

Re: [Python-Dev] 2.7 is here until 2020, please don't call it a waste.

2015-05-30 Thread Chris Angelico
On Sat, May 30, 2015 at 9:00 PM, Antoine Pitrou wrote: > On Sat, 30 May 2015 20:52:21 +1000 > Chris Angelico wrote: >> >> Suppose someone came up with a magic patch that makes the CPython core >> run 25% faster. No downsides, just 25% faster across the board. I >>

Re: [Python-Dev] RM for 3.6?

2015-06-01 Thread Chris Angelico
On Tue, Jun 2, 2015 at 5:05 AM, Skip Montanaro wrote: > > > On Mon, Jun 1, 2015 at 1:35 PM, Ned Deily wrote: >> >> I thought I was volunteering to get a pony. I was misinformed. > > > Ned, > > Not to worry. I'm sure that by the time 3.6a0 is due, the PSF will be able to > scrape together the fu

[Python-Dev] Checklist for changing Python's grammar

2015-06-10 Thread Chris Angelico
As part of a bit of hacking on CPython, I'm looking at playing with the grammar. In the source tree, Grammar/Grammar, there's a note advising me to follow the steps in PEP 306, but PEP 306 says it's been moved to the dev guide. Should the source comment be changed to point to https://docs.python.or

Re: [Python-Dev] Checklist for changing Python's grammar

2015-06-11 Thread Chris Angelico
On Thu, Jun 11, 2015 at 11:42 PM, Brett Cannon wrote: > On Wed, Jun 10, 2015 at 11:46 PM Chris Angelico wrote: >> >> As part of a bit of hacking on CPython, I'm looking at playing with >> the grammar. In the source tree, Grammar/Grammar, there's a note >> a

Re: [Python-Dev] Importance of "async" keyword

2015-06-26 Thread Chris Angelico
On Sat, Jun 27, 2015 at 12:20 AM, Ethan Furman wrote: > As Nick said earlier: the caller always blocks; by extension (to my mind, at > least) putting an `await` in front of something is saying, "it's okay if > other tasks run while I'm blocking on this call." Apologies if this is a really REALLY

Re: [Python-Dev] Importance of "async" keyword

2015-06-26 Thread Chris Angelico
On Sat, Jun 27, 2015 at 12:51 AM, Paul Sokolovsky wrote: > Some say "convenient", others say "dangerous". > > Consider: > > buf = bytearray(MULTIMEGABYTE) > > In one function you do: > > socket.write(buf), > > in another function (coroutine), you keep mutating buf. > > So, currently in Python you

Re: [Python-Dev] Importance of "async" keyword

2015-06-26 Thread Chris Angelico
On Sat, Jun 27, 2015 at 2:07 AM, R. David Murray wrote: > On Sat, 27 Jun 2015 01:10:33 +1000, Chris Angelico wrote: >> The way I'm seeing it, coroutines are like cooperatively-switched >> threads; you don't have to worry about certain operations being >> interrupt

Re: [Python-Dev] Importance of "async" keyword

2015-07-05 Thread Chris Angelico
On Mon, Jul 6, 2015 at 7:50 AM, Sven R. Kunze wrote: > Seems like we stick to this example once again. So, let me get this > straight: > > 1) I can add, subtract, multiply and divide real numbers. > 2) I can add, subtract, multiply and divide complex numbers. > 3) I can even add, subtract, multipl

Re: [Python-Dev] How far to go with user-friendliness

2015-07-14 Thread Chris Angelico
On Tue, Jul 14, 2015 at 11:51 PM, Florian Bruhin wrote: > However, it also has some special methods to see if it has been > called: > > >>> m.assert_called_with() > [...] > AssertionError: Expected call: mock() > Not called I suppose it's too late to change this so these aren't me

Re: [Python-Dev] GetFinalPathNameByHandleW - what is the minimum windows version python-3.5 will support ?

2015-07-19 Thread Chris Angelico
On Mon, Jul 20, 2015 at 4:31 AM, Terry Reedy wrote: > I think this line in the PEP, "Because of this policy, no further Windows > releases need to be listed in this PEP. " is false economy. Your research on > server 2003 should be recorded. (The presence of a 3.5 Server 2003 buildbot, > even thoug

Re: [Python-Dev] Status on PEP-431 Timezones

2015-07-27 Thread Chris Angelico
On Tue, Jul 28, 2015 at 12:13 AM, Steven D'Aprano wrote: > On Mon, Jul 27, 2015 at 10:54:02AM +0200, Lennart Regebro wrote: >> On Mon, Jul 27, 2015 at 10:47 AM, Paul Moore wrote: >> > I'm confused by your position. If it's 7am on the clock behind me, >> > right now, then how (under the model prop

Re: [Python-Dev] Status on PEP-431 Timezones

2015-07-27 Thread Chris Angelico
On Tue, Jul 28, 2015 at 12:57 AM, Ronald Oussoren wrote: > IMHO “+ 1 days” and “+ 24 hours” are two different things. Date > arithmetic is full of messy things like that. “+ 1 month” is another > example of that (which the datetime module punts completely > and can be a source of endless bikeshi

Re: [Python-Dev] Status on PEP-431 Timezones

2015-07-27 Thread Chris Angelico
On Tue, Jul 28, 2015 at 4:49 AM, Tim Peters wrote: > But it's a fact that they _are_ the same in naive time, which Python's > datetime single-timezone arithmetic implements: > > - A minute is exactly 60 seconds. No leap second support, presumably. Also feature? ChrisA ___

Re: [Python-Dev] Status on PEP-431 Timezones

2015-07-28 Thread Chris Angelico
On Tue, Jul 28, 2015 at 10:06 PM, Mark Lawrence wrote: > On 28/07/2015 06:21, Lennart Regebro wrote: >> >> On Tue, Jul 28, 2015 at 3:22 AM, Mark Lawrence >> wrote: >>> >>> To me a day is precisely 24 hours, no more, no less. >>> In my mission critical code, which I use to predict my cashflow, I u

Re: [Python-Dev] Status on PEP-431 Timezones

2015-07-28 Thread Chris Angelico
> On Tue, Jul 28, 2015 at 3:22 AM, Mark Lawrence > wrote: > To me a day is precisely 24 hours, no more, no less. Start with this line. Then proceed: On Wed, Jul 29, 2015 at 3:01 AM, Mark Lawrence wrote: > My cashflow forecast doesn't give two hoots how many hours there are in two > weeks, whic

Re: [Python-Dev] who must makes FOR loop quicker

2015-08-05 Thread Chris Angelico
On Thu, Aug 6, 2015 at 1:25 AM, John Doe wrote: > To pass by reference or by copy of - that is the question from hamlet. > ("hamlet" - a community of people smaller than a village python3.4-linux64) > > xlist = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > i = 0 > for x in xlist: > print(xlist) > p

Re: [Python-Dev] PEP 498 f-string: please remove the special case for spaces

2015-08-11 Thread Chris Angelico
On Tue, Aug 11, 2015 at 5:08 PM, Cameron Simpson wrote: > On 11Aug2015 18:07, Greg Ewing wrote: >> >> Cameron Simpson wrote: >>> >>> To illustrate, there's a consumer rights TV snow here with a segment >>> called "F.U. Tube", where members of the public describe ripoffs and other >>> product fail

Re: [Python-Dev] PEP needed for http://bugs.python.org/issue9232 ?

2015-08-11 Thread Chris Angelico
On Wed, Aug 12, 2015 at 12:46 AM, R. David Murray wrote: > (If you wanted to fix an 'oops' trailing comma syntax issue, I'd vote for > disallowing trailing commas outside of (). The number of times I've > ended up with an unintentional tuple after converting a dictionary to a > series of assignme

Re: [Python-Dev] trailing commas on statements

2015-08-11 Thread Chris Angelico
On Wed, Aug 12, 2015 at 3:01 AM, R. David Murray wrote: > Sorry, "trailing comma outside ()" was a shorthand for 'trailing comma > on a complete statement'. That is, what trips me up is going from > something like: > > dict(abc=1, > foo=2, > bar=3, > ) > > to: > >

Re: [Python-Dev] PEP-498: Literal String Formatting

2015-08-17 Thread Chris Angelico
On Tue, Aug 18, 2015 at 12:50 AM, Barry Warsaw wrote: > On Aug 17, 2015, at 11:02 AM, Paul Moore wrote: > >>print(f"Iteration {n}: Took {end-start) seconds") > > This illustrates (more) problems I have with arbitrary expressions. > > First, you've actually made a typo there; it should be "{end

Re: [Python-Dev] Testing tkinter on Linux

2015-08-26 Thread Chris Angelico
On Thu, Aug 27, 2015 at 2:20 PM, Terry Reedy wrote: > None of the linux buildbots run with X enabled. Consequently none of the > tkinter (or tkinter user) gui tests are run on Linux. It was thus pointed > out to me, during discussion of using ttk widgets in Idle, that we do not > really know if

Re: [Python-Dev] Testing tkinter on Linux

2015-08-27 Thread Chris Angelico
On Fri, Aug 28, 2015 at 5:00 AM, R. David Murray wrote: > I believe gui depends on the existence of the DISPLAY environment > variable on unix/linux (that is, TK will fail to start if DISPLAY is not > set, so _is_gui_available will return False). You should be able to > confirm this by looking at

Re: [Python-Dev] python programmer

2015-09-02 Thread Chris Angelico
On Thu, Sep 3, 2015 at 6:57 AM, Linda Ryan wrote: > I am an IT/Project Management recruiter looking to increase the available > pool of talent for available job placements. > Currently I have an opening for a python programmer/developer. Could I post > opportunities to your member list? Hi! Not

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Chris Angelico
On Sat, Sep 5, 2015 at 7:10 PM, haypo s wrote: > 2015-09-05 5:01 GMT+02:00 Guido van Rossum : >> And I'm ready to accept it. I'll wait until Tuesday night (Monday's a >> holiday in the US) in case anything unforeseen comes up, but this is really >> the Last Call for this PEP. > > Would it be possi

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Chris Angelico
On Sat, Sep 5, 2015 at 8:57 PM, Chris Angelico wrote: >> IMHO the main advantage of allowing expressions inside f-string is >> that it adds something really new compared to the current str.format() >> method. Without it, f-string are less interesting. > > I agree with y

Re: [Python-Dev] What's New editing

2015-09-08 Thread Chris Angelico
On Wed, Sep 9, 2015 at 3:08 AM, Laxmikant Chitare wrote: > > It is really nice, motivating and encouraging to see people contribute to > community in spite of the work load. "Thank you" is just not enough to > appreciate your efforts. I have been programming in Python for quite some > time and I a

Re: [Python-Dev] PEP 495 Was: PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-13 Thread Chris Angelico
On Sun, Sep 13, 2015 at 7:03 PM, Laura Creighton wrote: > In a message of Sat, 12 Sep 2015 20:49:12 -0400, Terry Reedy writes: >>and, if we are stuck with <-intransitivity, what do we do? If >>back-compatibility allowed, I might suggest defining 'lt' or 'less' >>rather than '__lt__' so that sort a

Re: [Python-Dev] PEP 495 Was: PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-13 Thread Chris Angelico
On Mon, Sep 14, 2015 at 1:44 AM, Tim Peters wrote: > That's a sane & easy sufficient condition. It's a waste of time to > worry about minimal necessary conditions. "Convert to UTC' is the > obvious way to do darned near everything. Converting to any other > fixed-offset zone would do just as we

Re: [Python-Dev] PEP: Collecting information about git

2015-09-15 Thread Chris Angelico
On Wed, Sep 16, 2015 at 5:44 AM, Augie Fackler wrote: >> but git is still better at it: ``git add -p`` >> allows me to review and edit patches before commit while ``hg record`` >> commits immediately. > > FWIW, I totally *get* wanting a staging area. That said, other than the > staging area, recor

Re: [Python-Dev] PEP: Collecting information about git

2015-09-16 Thread Chris Angelico
On Wed, Sep 16, 2015 at 7:20 PM, Oleg Broytman wrote: >Thanks. I think upstream remote-tracking branches in git are rather > similar. If one's afraid of rewriting published history she should never > rebase before @{u}. Just always using ``git rebase -i @{u}`` should be > good enough. >The

Re: [Python-Dev] PEP: Collecting information about git

2015-09-16 Thread Chris Angelico
On Wed, Sep 16, 2015 at 7:46 PM, Oleg Broytman wrote: > For example, I develop > SQLObject using two private clones (clean backup repo and dirty working > repo) and three public clones at Gitlab, GutHub and SourceForge. They > are all equal, none of them is the upstream. I don't even have > ``orig

Re: [Python-Dev] PEP 498 (interpolated f-string) tweak

2015-09-19 Thread Chris Angelico
On Sun, Sep 20, 2015 at 5:36 AM, Eric V. Smith wrote: > As the PEP says, the expression with '+' is illustrative, not how it's > actually implemented. The implementation currently uses ''.join, > although I reserve the right to change it. > >> or even to >> >> 'abc{:spec1}{!r:spec2}def{!s}ghi'

Re: [Python-Dev] Rationale behind lazy map/filter

2015-10-13 Thread Chris Angelico
On Wed, Oct 14, 2015 at 3:08 AM, Random832 wrote: > If you are writing code that tries > to resume iterating after the iterator has been exhausted, I have to > ask: why? A well-behaved iterator is supposed to continue raising StopIteration forever once it's been exhausted. I don't know how much c

Re: [Python-Dev] Rationale behind lazy map/filter

2015-10-13 Thread Chris Angelico
On Wed, Oct 14, 2015 at 3:49 AM, Random832 wrote: > My theory is that most circumstances under which this would cause a > RuntimeError are indicative of a bug in the algorithm consuming the > iterator (for example, an algorithm that hasn't considered iterators and > expects to be passed an iterabl

<    1   2   3   4   5   6   7   8   9   10   >