[Python-Dev] Re: Problems with dict subclassing performance

2021-08-15 Thread Chris Angelico
On Mon, Aug 16, 2021 at 6:36 AM Marco Sulla wrote: > > As Chris implied, the second 'sentence' is not grammatical English > > Oh, this is enough. The sense of the phrase was very clear and you all > have understood it. Remarking grammatical errors is a gross violation > of the Netiquette. I ask __

[Python-Dev] Re: Problems with dict subclassing performance

2021-08-15 Thread Chris Angelico
On Mon, Aug 16, 2021 at 7:56 AM Marco Sulla wrote: > > On Sun, 15 Aug 2021 at 23:33, Tim Peters > wrote:ople have said now, including me, they had no idea what > > you meant.by "I pretend your immediate excuses". It's not a complaint > > that it's expressed inelegantly, but that they can't make _

[Python-Dev] Re: Problems with dict subclassing performance

2021-08-16 Thread Chris Angelico
On Mon, Aug 16, 2021 at 5:44 PM Federico Salerno wrote: > > "Pretendere" in Italian means "to demand", it's a false friend with the > English "pretend". I don't know whether Marco is Italian (the false > friend might also be there between Spanish or whatever other romance > language he speaks and

[Python-Dev] Re: Dropping out of this list

2021-08-18 Thread Chris Angelico
On Thu, Aug 19, 2021 at 12:42 PM Jonathan Goble wrote: > > On Wed, Aug 18, 2021 at 10:22 PM Terry Reedy wrote: >> >> On 8/18/2021 9:37 PM, Edwin Zimmerman wrote: >> > On 8/18/21 9:18 PM, Jonathan Goble wrote: >> >> I am mostly a lurker, but I am also considering unsubscribing if someone >> >> do

[Python-Dev] Re: Notes on PEP 8

2021-08-26 Thread Chris Angelico
On Fri, Aug 27, 2021 at 3:02 AM Skip Montanaro wrote: >> >> However, it has become a de facto standard for all Python code, and in the >> document itself, there is frequent wording akin to "Identifiers used in the >> standard library must be ASCII compatible ...", and even advice for third >> p

[Python-Dev] Re: PEP 467 feedback from the Steering Council

2021-09-08 Thread Chris Angelico
On Wed, Sep 8, 2021 at 10:42 PM Victor Stinner wrote: > > On Wed, Sep 8, 2021 at 7:46 AM Steven D'Aprano wrote: > > >>> bytes.from_int(121404708502361365413651784, 'little') > > # should return b'Hello world' > > Really? I don't know anyone serializing strings as a "bigint" number. > Did

[Python-Dev] Re: The Default for python -X frozen_modules.

2021-09-27 Thread Chris Angelico
On Tue, Sep 28, 2021 at 2:58 AM Eric Snow wrote: > > We've frozen most of the stdlib modules imported during "python -c > pass" [1][2], to make startup a bit faster. Import of those modules > is controlled by "-X frozen_modules=[on|off]". Currently it defaults > to "off" but we'd like to default

[Python-Dev] Re: The Default for python -X frozen_modules.

2021-09-27 Thread Chris Angelico
On Tue, Sep 28, 2021 at 3:21 AM Eric Snow wrote: > > On Mon, Sep 27, 2021 at 11:09 AM Chris Angelico wrote: > > When exactly does the freezing happen? > > When you build the executable (e.g. "make -j8", > ".\PCbuild\build.bat"). So your changes to thos

[Python-Dev] Re: RFC on Callable Type Syntax

2021-10-07 Thread Chris Angelico
On Fri, Oct 8, 2021 at 1:45 PM S Pradeep Kumar wrote: > The Callable type is also usable as an expression, like in type aliases > `IntOperator = (int, int) -> int` and `cast((int) -> int, f)` calls. > > **Question 1**: Are there concerns we should keep in mind about such a syntax > proposal? >

[Python-Dev] Re: Python multithreading without the GIL

2021-10-07 Thread Chris Angelico
On Fri, Oct 8, 2021 at 1:51 PM Sam Gross wrote: > > Hi, > > I've been working on changes to CPython to allow it to run without the global > interpreter lock. I'd like to share a working proof-of-concept that can run > without the GIL. The proof-of-concept involves substantial changes to CPython

Re: [Python-Dev] VC++ 2008 Express Edition now locked away?

2013-03-06 Thread Chris Angelico
On Thu, Mar 7, 2013 at 1:40 AM, Ezio Melotti wrote: > I did try a few weeks ago, when I had to download a copy of Windows > for a project. Long story short, after 30+ minutes and a number of > confirmation emails I reached a point where I had a couple of new > accounts on MSDN/Dreamspark, a "purc

Re: [Python-Dev] VC++ 2008 Express Edition now locked away?

2013-03-06 Thread Chris Angelico
On Thu, Mar 7, 2013 at 3:46 AM, Stefan Behnel wrote: > Chris Angelico, 06.03.2013 17:30: >> On Thu, Mar 7, 2013 at 1:40 AM, Ezio Melotti wrote: >>> I did try a few weeks ago, when I had to download a copy of Windows >>> for a project. Long story short, after

Re: [Python-Dev] VC++ 2008 Express Edition now locked away?

2013-03-06 Thread Chris Angelico
On Thu, Mar 7, 2013 at 9:52 AM, Terry Reedy wrote: > On 3/6/2013 11:55 AM, Chris Angelico wrote: > >> Someone would have to check, but in most cases, software licenses >> govern the use, more than the distribution. If you're allowed to >> download it free of charge f

Re: [Python-Dev] can't assign to function call

2013-03-18 Thread Chris Angelico
On Tue, Mar 19, 2013 at 12:50 AM, Neal Becker wrote: > def F(x): > return x > > x = 2 > F(x) = 3 > > F(x) = 3 > SyntaxError: can't assign to function call > > Do we really need this restriction? There do exist other languages without > it. The languages that permit you to assign to a fu

Re: [Python-Dev] IDLE in the stdlib

2013-03-21 Thread Chris Angelico
On Fri, Mar 22, 2013 at 12:18 AM, Stephen J. Turnbull wrote: > Paul Moore writes: > > > I have no figures one way or the other on that. You may well be > > right. Are we aiming at "all Windows users" here? > > We need to be careful about this. ISTM that IDLE is aiming at the > subset of users

Re: [Python-Dev] Semantics of __int__(), __index__()

2013-04-04 Thread Chris Angelico
On Fri, Apr 5, 2013 at 1:23 AM, Oscar Benjamin wrote: > The reason for calling int(obj) is to get an object that is precisely > of type int. When I call this I do not want any modified or additional > methods or data attached to the resulting object. There's something I'm fundamentally not unders

Re: [Python-Dev] Semantics of __int__(), __index__()

2013-04-04 Thread Chris Angelico
On Fri, Apr 5, 2013 at 1:59 AM, Guido van Rossum wrote: > On Thu, Apr 4, 2013 at 7:47 AM, Chris Angelico wrote: >> Is there any argument that I can pass to Foo() to get back a Bar()? >> Would anyone expect there to be one? Sure, I could override __new__ to >> do stupid th

Re: [Python-Dev] Ordering keyword dicts

2013-05-20 Thread Chris Angelico
On Mon, May 20, 2013 at 11:35 AM, Greg Ewing wrote: > Joao S. O. Bueno wrote: >> >> Actually, when I was thinking on the subject I came to the same idea, of >> having >> some functions marked differently so they would use a different call >> mechanism - >> but them I wondered around having a diffe

Re: [Python-Dev] Validating SSL By Default (aka Including a Cert Bundle in CPython)

2013-06-03 Thread Chris Angelico
On Tue, Jun 4, 2013 at 4:56 AM, Ethan Furman wrote: > On 06/03/2013 11:34 AM, Antoine Pitrou wrote: >> >> On Mon, 3 Jun 2013 14:12:34 -0400 >> Donald Stufft wrote: >>> >>> >>> I worry with the current situation people will just use TLS connections >>> without realizing it's not being verified and

Re: [Python-Dev] Validating SSL By Default (aka Including a Cert Bundle in CPython)

2013-06-03 Thread Chris Angelico
On Tue, Jun 4, 2013 at 7:31 AM, Paul Moore wrote: > > On 3 June 2013 21:05, Chris Angelico wrote: >> Some legit sites with proper >> certificates still manage to muck something up administratively >> (developer.quicksales.com.au has a cert from RapidSSL but doesn'

Re: [Python-Dev] Validating SSL By Default (aka Including a Cert Bundle in CPython)

2013-06-04 Thread Chris Angelico
On Tue, Jun 4, 2013 at 9:15 AM, Donald Stufft wrote: > Generally any of these will be completely valid options, even disabling the > checks. The idea behind my proposal is that people generally only use TLS > for a reason and that reason is they want to protect against the kinds of > attacks that

Re: [Python-Dev] Do you consider Python a 4GL? Why (not)?

2013-06-04 Thread Chris Angelico
On Wed, Jun 5, 2013 at 11:17 AM, Dan Stromberg wrote: > > On Tue, Jun 4, 2013 at 4:53 PM, Carlos Nepomuceno > wrote: >> >> Do you consider Python a 4GL? Why (not)? > > > By the wikipedia definition of 4GL and 5GL, I'd say Python is neither. And > it's not a VHLL either, again according to the wi

Re: [Python-Dev] Compiling Python with Python

2013-06-05 Thread Chris Angelico
On Thu, Jun 6, 2013 at 5:21 AM, Jussi Pakkanen wrote: > - implementation of Meson is 100% Python 3, it does not have a dependency on > the shell and in fact already works on Windows Since you're talking about a bootstrap requirement here, the obvious question is: What version of Python 3 does it

Re: [Python-Dev] Compiling Python with Python

2013-06-05 Thread Chris Angelico
On Thu, Jun 6, 2013 at 6:00 AM, Jussi Pakkanen wrote: > > On Wed, Jun 5, 2013 at 10:37 PM, Chris Angelico wrote: > >> >> Since you're talking about a bootstrap requirement here, the obvious >> question is: What version of Python 3 does it require? Will it be a

Re: [Python-Dev] stat module in C -- what to do with stat.py?

2013-06-21 Thread Chris Angelico
On Fri, Jun 21, 2013 at 11:06 AM, Nick Coghlan wrote: > On 21 June 2013 01:04, Thomas Wouters wrote: >> If the .py file is going to be wrong or incomplete, why would we want to >> keep it -- or use it as fallback -- at all? If we're dead set on having a >> .py file instead of requiring it to be p

Re: [Python-Dev] Python 3 as a Default in Linux Distros

2013-07-24 Thread Chris Angelico
On Wed, Jul 24, 2013 at 7:12 PM, Bohuslav Kabrda wrote: > - What should user get after using "yum install python"? > There are basically few ways of coping with this: > 1) Just keep doing what we do, eventually far in the future drop "python" > package and never provide it again (= go on only wit

Re: [Python-Dev] Python 3 as a Default in Linux Distros

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 2:21 AM, Laurent Gautier wrote: > - errors that are typical of "Python 2 script running with Python > 3"-specific are probably limited (e.g., use of unicode, use of xrange, > etc...) > The most common, in interactive scripts at least, is likely to be: >>> print "Hello, wo

Re: [Python-Dev] Official github mirror for CPython?

2013-07-25 Thread Chris Angelico
On Fri, Jul 26, 2013 at 12:29 AM, Eli Bendersky wrote: > Hi all, > > I've been looking for a Github mirror for Python, and found two: > > * https://github.com/python-git/python has a lot of forks/watches/starts but > seems to be very out of date (last updated 4 years ago) > * https://github.com/py

Re: [Python-Dev] Lambda [was Re: PEP 8 modernisation]

2013-08-01 Thread Chris Angelico
On Thu, Aug 1, 2013 at 5:58 PM, Alexander Shorin wrote: > fun = lambda i: i[1] > for key, items in groupby(sorted(items, key=fun), key=fun): > print(key, ':', list(items)) I'd do a direct translation to def here: def fun(i): return i[1] for key, items in groupby(sorted(items, key=fun), key=fun

Re: [Python-Dev] Deprecating the formatter module

2013-08-14 Thread Chris Angelico
On Wed, Aug 14, 2013 at 6:42 PM, Nick Coghlan wrote: > That would be PEP 4 :) What's the normal way to update a PEP? ... proposals for deprecating modules MUST be made by providing a change to the text of this PEP, which SHOULD be a patch posted to SourceForge...""" Would that now b

Re: [Python-Dev] When to remove deprecated stuff

2013-08-22 Thread Chris Angelico
On Thu, Aug 22, 2013 at 11:45 PM, Michael Foord wrote: > On 22 Aug 2013, at 14:00, Petri Lehtinen wrote: >> Django's deprecation policy works like this: They deprecate something >> in version A.B. It still works normally in A.B+1, generates a >> (silenced) DeprecationWarning in A.B+2, and is fina

Re: [Python-Dev] summing integer and class

2013-10-03 Thread Chris Angelico
On Thu, Oct 3, 2013 at 11:09 PM, Игорь Васильев wrote: > When we adding class to integer we have both slotv and slotw. x = slotv(v, > w); -> returns Py_NotImplemented. > But in this case we should execute x = slotw(v, w); and function should be > completed in the same way as when we adding integer

Re: [Python-Dev] Breaking up the stdlib (Was: release cadence)

2016-07-05 Thread Chris Angelico
On Tue, Jul 5, 2016 at 5:53 PM, Petr Viktorin wrote: > If packages had a way to opt-out of needing the whole standard library, > and instead specify the stdlib subset they need, answering questions > like "will this run on my phone?" and "what piece of the stdlib do we > want to port next?" would

Re: [Python-Dev] Breaking up the stdlib (Was: release cadence)

2016-07-06 Thread Chris Angelico
On Wed, Jul 6, 2016 at 7:01 PM, Petr Viktorin wrote: > Maybe a good short-term solution would be to make "import tkinter" raise > ImportError("Run `dnf install tkinter` to install the tkinter module") > if not found. This would prevent confusion while keeping the status quo. > I'll look into that.

Re: [Python-Dev] Proposal: explicitly disallow function/class mismatches in accelerator modules

2016-07-10 Thread Chris Angelico
On Mon, Jul 11, 2016 at 1:26 PM, Steven D'Aprano wrote: > (1) How much extra effort are we going to *mandate* that core devs put > in to hide the differences between C and Python code, for the benefit of > a small minority that will notice them? > The subject line is raising one specific differen

Re: [Python-Dev] Proposal: explicitly disallow function/class mismatches in accelerator modules

2016-07-10 Thread Chris Angelico
On Mon, Jul 11, 2016 at 4:25 PM, Ethan Furman wrote: > On 07/10/2016 08:32 PM, Chris Angelico wrote: >> >> On Mon, Jul 11, 2016 at 1:26 PM, Steven D'Aprano >> wrote: >>> >>> (1) How much extra effort are we going to *mandate* that core devs put >>

Re: [Python-Dev] Status of Python 3.6 PEPs?

2016-07-12 Thread Chris Angelico
On Tue, Jul 12, 2016 at 7:26 PM, Victor Stinner wrote: > "PEP 499 -- python -m foo should bind sys.modules['foo'] in addition > to sys.modules['__main__']" > https://www.python.org/dev/peps/pep-0499/ > => draft > I have a vague recollection that this ran into some trickinesses with certain forms

Re: [Python-Dev] Should we fix these errors?

2016-07-22 Thread Chris Angelico
On Sat, Jul 23, 2016 at 12:36 AM, Guido van Rossum wrote: > Somebody did some research and found some bugs in CPython (IIUC). The > published some questionable fragments. If there's a volunteer we could > probably easily fix these. (I know we already have occasional Coverity > scans and there are

Re: [Python-Dev] Rewrite @contextlib.contextmanager in C

2016-08-08 Thread Chris Angelico
On Tue, Aug 9, 2016 at 7:14 AM, Wolfgang Maier wrote: > Right, I think a fairer comparison would be to: > > class ctx2: > def __enter__(self): > self.it = iter(self) > return next(self.it) > > def __exit__(self, *args): > try: > next(self.it) > e

Re: [Python-Dev] Rewrite @contextlib.contextmanager in C

2016-08-09 Thread Chris Angelico
On Wed, Aug 10, 2016 at 4:43 AM, Giampaolo Rodola' wrote: > -return self.__class__(self.func, self.args, self.kwds) > +func, args, kwds = self.funcak > +return self.__class__(func, args, kwds) return self.__class__(*self.funcak) > @wraps(func) > def helper(*args

Re: [Python-Dev] Rewrite @contextlib.contextmanager in C

2016-08-10 Thread Chris Angelico
On Wed, Aug 10, 2016 at 4:43 AM, Giampaolo Rodola' wrote: > Chris' SimplerContextManager solution is faster because it avoids the > factory function but that is necessary for supporting the decoration of > methods. Hooking a tangent onto this: I have no idea, based on the current source code, whi

Re: [Python-Dev] Adding PEP 515's '_' formatting

2016-08-19 Thread Chris Angelico
On Fri, Aug 19, 2016 at 6:35 PM, Eric V. Smith wrote: > PEP 515 adds underscores to numeric literals. As part of that, it adds > optional underscores to numeric formatters (similar to PEP 378 for ','). See > https://www.python.org/dev/peps/pep-0515/#further-changes > > I had assigned myself http:/

[Python-Dev] Failures in test_site.py - how to debug?

2016-08-19 Thread Chris Angelico
On my main dev system (Debian Stretch), I've had a single long-standing test failure - test_site.py, StartupImportTests.test_startup_imports. It's annoying (partly because it's such a noisy failure), and doesn't appear to be happening on the buildbots, nor presumably on core devs' computers, so it'

Re: [Python-Dev] Failures in test_site.py - how to debug?

2016-08-19 Thread Chris Angelico
On Sat, Aug 20, 2016 at 12:31 AM, Random832 wrote: > the -v output might be helpful in determining what is causing these > modules to be imported. It would at least show what order they're > imported in. Here it is in all its spammy glory. rosuav@sikorsky:~/cpython$ ./python -I -v -c 'import sys

Re: [Python-Dev] Failures in test_site.py - how to debug?

2016-08-19 Thread Chris Angelico
On Sat, Aug 20, 2016 at 1:26 AM, Steve Dower wrote: > Check any .pth files you can find. I suspect mpl_toolkits has some magic in > it to make the namespace package work on 2.7. >>> sys.path ['/usr/local/lib/python36.zip', '/home/rosuav/cpython/Lib', '/home/rosuav/cpython/Lib/plat-x86_64-linux-gn

Re: [Python-Dev] Failures in test_site.py - how to debug?

2016-08-19 Thread Chris Angelico
On Sat, Aug 20, 2016 at 2:25 AM, Steve Dower wrote: > On 19Aug2016 0910, Chris Angelico wrote: >> >> On Sat, Aug 20, 2016 at 1:26 AM, Steve Dower >> wrote: >>> >>> Check any .pth files you can find. I suspect mpl_toolkits has some magic >>> in

Re: [Python-Dev] Failures in test_site.py - how to debug?

2016-08-19 Thread Chris Angelico
On Sat, Aug 20, 2016 at 5:33 AM, Brett Cannon wrote: >> Hmmm. So the question is, what is this test testing? > > > It's making sure people who work on the modules that are imported during > startup don't accidentally add another module dependency to the startup > sequence. Since module imports

Re: [Python-Dev] Failures in test_site.py - how to debug?

2016-08-19 Thread Chris Angelico
On Sat, Aug 20, 2016 at 7:34 AM, Brett Cannon wrote: >> 1) Demand that .pth files restrict themselves to what's already >> imported. This means startup is still fast even if you have a bunch of >> pths. Downside: Third-party code can break Python's rules. Upside: >> When they do, it can be reporte

Re: [Python-Dev] Failures in test_site.py - how to debug?

2016-08-19 Thread Chris Angelico
On Sat, Aug 20, 2016 at 7:55 AM, Chris Angelico wrote: > If I make a patch to do that, would it have a good chance of being accepted? > Shortcut. I've made the patch and put it on the tracker. http://bugs.python.org/issue27807 Either it's accepted or it's not :)

Re: [Python-Dev] Failures in test_site.py - how to debug?

2016-08-19 Thread Chris Angelico
On Sat, Aug 20, 2016 at 8:07 AM, Sjoerd Job Postmus wrote: > I'd like to re-iterate my suggestion in case it was missed: split the > current test in 2 tests: > > * Running with `-S` which is for checking that by default the collections > are not imported. (Which is what is currently tested) > * Ru

Re: [Python-Dev] Failures in test_site.py - how to debug?

2016-08-19 Thread Chris Angelico
On Sat, Aug 20, 2016 at 12:55 PM, Random832 wrote: > > What about -S and putting "import site" explicitly in the test code? Or > would that go back to importing everything on people who have packages > installed? I think so, yes. > Really, there should be a "source-isolated" mode, which removes

Re: [Python-Dev] Supported versions of OpenSSL

2016-08-29 Thread Chris Angelico
On Mon, Aug 29, 2016 at 6:24 PM, Christian Heimes wrote: > No, LTS support should not be our concern. If you need a brand new > version of Python on an old LTS or Enterprise version of your OS, please > contact your vendor and buy support. You don't get to run old metal and > play with shiny new t

Re: [Python-Dev] Supported versions of OpenSSL

2016-08-29 Thread Chris Angelico
On Mon, Aug 29, 2016 at 8:52 PM, Nick Coghlan wrote: > On 29 August 2016 at 19:14, Chris Angelico wrote: >> On Mon, Aug 29, 2016 at 6:24 PM, Christian Heimes >> wrote: >>> No, LTS support should not be our concern. If you need a brand new >>> version of P

Re: [Python-Dev] Supported versions of OpenSSL

2016-08-29 Thread Chris Angelico
On Mon, Aug 29, 2016 at 9:16 PM, Nick Coghlan wrote: > On 29 August 2016 at 21:05, Chris Angelico wrote: >> On Mon, Aug 29, 2016 at 8:52 PM, Nick Coghlan wrote: >>> For upcoming 3.6 I would like to limit support to 1.0.2+ and require >>> 1.0.2 features for 3.7. >

Re: [Python-Dev] Update on PEP 523 and adding a co_extra field to code objects

2016-08-30 Thread Chris Angelico
On Wed, Aug 31, 2016 at 4:55 AM, Serhiy Storchaka wrote: > On 30.08.16 21:20, Antoine Pitrou wrote: >> >> On Tue, 30 Aug 2016 18:12:01 + >> Brett Cannon wrote: Why not make it always a list? List objects are reasonably cheap in memory and access time... (unlike dicts) >>> >>>

Re: [Python-Dev] Update on PEP 523 and adding a co_extra field to code objects

2016-09-02 Thread Chris Angelico
On Sat, Sep 3, 2016 at 7:56 AM, Brett Cannon wrote: > On Fri, 2 Sep 2016 at 13:31 Dino Viehland via Python-Dev > wrote: >> >> So it looks like both list and tuple are about within 5% of using co_extra >> directly. Using a tuple instead of a list is about a wash except for >> make_v2 where list i

Re: [Python-Dev] Update on PEP 523 and adding a co_extra field to code objects

2016-09-02 Thread Chris Angelico
On Sat, Sep 3, 2016 at 8:45 AM, Brett Cannon wrote: >> I'm not following how this solves the collision problem. If you have a >> tuple, how do the two (or more) users of it know which index they're >> using? They'd need to keep track separately for each object, or else >> inefficiently search the

Re: [Python-Dev] What should a good type checker do? (was: Please reject or postpone PEP 526)

2016-09-02 Thread Chris Angelico
On Sat, Sep 3, 2016 at 8:49 AM, Koos Zevenhoven wrote: > On Fri, Sep 2, 2016 at 9:04 PM, Steven D'Aprano wrote: >> On Fri, Sep 02, 2016 at 08:10:24PM +0300, Koos Zevenhoven wrote: >> >>> A good checker should be able to infer that x is a union type at the >>> point that it's passed to spam, even

Re: [Python-Dev] Update on PEP 523 and adding a co_extra field to code objects

2016-09-03 Thread Chris Angelico
On Sun, Sep 4, 2016 at 2:09 AM, Nick Coghlan wrote: > On 3 September 2016 at 08:50, Chris Angelico wrote: >> Got it, thanks. I hope the vagaries of linear search don't mess with >> profilers - a debugger isn't going to be bothered by whether it gets >> first sl

Re: [Python-Dev] Tweak to PEP 523 for storing a tuple in co_extra

2016-09-03 Thread Chris Angelico
On Sun, Sep 4, 2016 at 8:03 AM, Yury Selivanov wrote: > On 2016-09-03 12:27 PM, Brett Cannon wrote: >> >> Below is the `co_extra` section of PEP 523 with the update saying that >> users are expected to put a tuple in the field for easier simultaneous use >> of the field. >> >> Since the `co_extra`

Re: [Python-Dev] Tweak to PEP 523 for storing a tuple in co_extra

2016-09-03 Thread Chris Angelico
On Sun, Sep 4, 2016 at 9:49 AM, Yury Selivanov wrote: > > > On 2016-09-03 4:13 PM, Chris Angelico wrote: >> Replace it, but only as they register themselves with a particular >> function. Imagine a profiler doing something vaguely like this: > > > "Replacing

Re: [Python-Dev] Please reject or postpone PEP 526

2016-09-04 Thread Chris Angelico
On Sun, Sep 4, 2016 at 8:52 PM, Mark Shannon wrote: > The key difference is in placement. > PEP 484 style > variable = value # annotation > > Which reads to me as if the annotation refers to the value. > PEP 526 > variable: annotation = value > > Which reads very much as if the annotation refers t

Re: [Python-Dev] Please reject or postpone PEP 526

2016-09-05 Thread Chris Angelico
On Tue, Sep 6, 2016 at 2:17 AM, Steven D'Aprano wrote: >> > The type comment systax is required for Python 2 and backwards- >> > compatibility. That's a given. >> >> Sure, but all type checkers will not have to care about Python 2. > > They will have to care about type comments until such time as

Re: [Python-Dev] Do PEP 526 type declarations define the types of variables or not?

2016-09-06 Thread Chris Angelico
On Wed, Sep 7, 2016 at 4:11 AM, Stephen J. Turnbull wrote: > Finally, the notion of annotating expressions is incoherent: > > # Annotating (sub)expressions: the more the merrier! > (x) : bool = (((y): int + (z): float) / (w): complex): quarternion > # Ooh, an expression with no past an

Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-08 Thread Chris Angelico
On Fri, Sep 9, 2016 at 2:39 AM, Random832 wrote: > On Thu, Sep 8, 2016, at 12:30, Chris Barker wrote: >> That's why I said "based on" -- under the hood, a C type is used, and >> IIUC, that type has been "long" for ages. And a long on Windows 64 >> (with the MS compiler anyway) is 32 bit, and a lon

Re: [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered

2016-09-08 Thread Chris Angelico
On Fri, Sep 9, 2016 at 6:22 AM, Victor Stinner wrote: > A nice "side effect" of compact dict is that the dictionary now > preserves the insertion order. It means that keyword arguments can now > be iterated by their creation order: > This is pretty sweet! Of course, there are going to be 1172 com

Re: [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered

2016-09-11 Thread Chris Angelico
On Sun, Sep 11, 2016 at 6:42 PM, Victor Stinner wrote: > 2016-09-10 23:24 GMT-04:00 Nick Coghlan : >> To conform with the updated language spec, implementations just need >> to use collections.OrderedDict in 3 places: >> >> (...) >> - storage type for passing kwargs to functions > > I'm not sure a

Re: [Python-Dev] Drastically improving list.sort() for lists of strings/ints

2016-09-11 Thread Chris Angelico
On Sun, Sep 11, 2016 at 5:45 PM, Elliot Gorokhovsky wrote: > I am interested in making a non-trivial improvement to list.sort(), but > before I put in the work, I want to test the waters and see if this is > something the community would accept. Basically, I want to implement radix > sort for list

Re: [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered

2016-09-12 Thread Chris Angelico
On Tue, Sep 13, 2016 at 2:27 AM, Gregory P. Smith wrote: > Disorder for this purpose need not be a random shuffle (overkill). It just > needs to be regularly inconsistent. A simple thing to do on top of 3.6's new > dict implementation would be to pick a random starting point within the > order arr

Re: [Python-Dev] cpython (3.6): replace usage of Py_VA_COPY with the (C99) standard va_copy

2016-09-23 Thread Chris Angelico
On Fri, Sep 23, 2016 at 4:47 PM, Benjamin Peterson wrote: > On Thu, Sep 22, 2016, at 04:44, Victor Stinner wrote: >> 2016-09-22 8:02 GMT+02:00 Benjamin Peterson : >> > Just dump the compat macros in Python 4.0 I think. >> >> Please don't. Python 3 was so painful because we decided to make >> milli

Re: [Python-Dev] __future__ and eval()

2016-10-01 Thread Chris Angelico
On Sat, Oct 1, 2016 at 9:39 PM, Christian Tismer wrote: > The exec() script inherited the __future__ statement! > It behaved like the future statement were implicitly there. > > Is that a bug or a feature? It's documented, but not very noisily. https://docs.python.org/2/reference/simple_stmts.ht

Re: [Python-Dev] __future__ and eval()

2016-10-01 Thread Chris Angelico
On Sat, Oct 1, 2016 at 10:17 PM, Chris Angelico wrote: > So I'd call it a feature, but possibly one that warrants a mention in > the exec and eval docs. To clarify: This *is* documented under __future__, but not under exec/eval. I'm just suggesting adding another cross-re

Re: [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?

2016-10-10 Thread Chris Angelico
On Mon, Oct 10, 2016 at 8:35 PM, Larry Hastings wrote: > Huh? In all other circumstances, a "borrowed" reference is exactly that: X > has a reference, and you are relying on X's reference to keep the object > alive. Borrowing from a borrowed reference is simply a chain of these; Z > borrows from

Re: [Python-Dev] Optimizing list.sort() by checking type in advance

2016-10-10 Thread Chris Angelico
On Mon, Oct 10, 2016 at 5:18 PM, Elliot Gorokhovsky wrote: > First, some simple benchmark results (numbers are seconds, check out the > extension module at https://github.com/embg/python-fast-listsort.git): > > *** 1e3 ints *** > F.fastsort(): 0.00018930435180664062 > F.sort(): 0.00028300285339355

Re: [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?

2016-10-10 Thread Chris Angelico
On Tue, Oct 11, 2016 at 3:49 AM, MRAB wrote: > On 2016-10-10 10:45, Chris Angelico wrote: >> >> On Mon, Oct 10, 2016 at 8:35 PM, Larry Hastings >> wrote: >>> >>> Huh? In all other circumstances, a "borrowed" reference is exactly that: >

Re: [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?

2016-10-10 Thread Chris Angelico
On Tue, Oct 11, 2016 at 4:03 AM, Paul Moore wrote: > On 10 October 2016 at 17:49, MRAB wrote: >> If you lookup something in a dict, it'll be a borrowed reference. >> >> If the dict is globals() and there's no GIL, another thread could delete the >> item while your code had the borrowed reference.

Re: [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?

2016-10-10 Thread Chris Angelico
On Tue, Oct 11, 2016 at 5:24 AM, Random832 wrote: > On Mon, Oct 10, 2016, at 14:04, MRAB wrote: >> Instead of locking the object, could we keep the GIL, but have it >> normally released? >> >> A thread could then still call a function such as PyWeakref_GetObject() >> that returns a borrowed refere

Re: [Python-Dev] Optimizing list.sort() by checking type in advance

2016-10-10 Thread Chris Angelico
On Tue, Oct 11, 2016 at 7:42 AM, Elliot Gorokhovsky wrote: > ChrisA suggested I also try "make test" or something to get a more realistic > benchmark. I will do that once I implement this as a patch, right now it's > an extension module that subclasses list, so I can't just drop it into > existing

Re: [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?

2016-10-10 Thread Chris Angelico
On Tue, Oct 11, 2016 at 8:14 AM, Larry Hastings wrote: > But I don't think this fixes the problem. Consider: > > Thread A calls Q = PyList_GetItem(L, 0), which returns a borrowed reference. > Thread A then gets suspended, before it has a chance to Py_INCREF(Q). > Thread B does L.clear(), the refe

Re: [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?

2016-10-10 Thread Chris Angelico
On Tue, Oct 11, 2016 at 9:52 AM, MRAB wrote: >> Also, I don't know when it would ever be safe to release the "memory >> deallocation lock". Just because it's safe for your thread doesn't mean >> it's safe for another thread. And if you do it on a thread-by-thread >> basis, in the above example i

Re: [Python-Dev] Optimizing list.sort() by checking type in advance

2016-10-11 Thread Chris Angelico
On Wed, Oct 12, 2016 at 12:51 AM, Paul Moore wrote: > On 11 October 2016 at 14:04, Elliot Gorokhovsky > wrote: >> Right, that sounds good, but there's just one thing I don't understand >> that's keeping me from using it. Namely, I would define a benchmark list L >> in my setup, and then I would h

Re: [Python-Dev] Optimizing list.sort() by checking type in advance

2016-10-11 Thread Chris Angelico
On Wed, Oct 12, 2016 at 1:24 AM, Paul Moore wrote: > On 11 October 2016 at 15:00, Chris Angelico wrote: >> On Wed, Oct 12, 2016 at 12:51 AM, Paul Moore wrote: >>> On 11 October 2016 at 14:04, Elliot Gorokhovsky >>> wrote: >>>> Right, that sounds g

[Python-Dev] Python ROCKS! Thanks guys! [anecdote]

2016-10-12 Thread Chris Angelico
I work with a full-stack web development bootcamp. Most of the course focuses on JavaScript (Node.js, React, jQuery, etc), but there's a one-week period in which each student gets to pick some technology to learn, and at the end of the week, demos to the group some project s/he has mastered. Two ch

Re: [Python-Dev] Python ROCKS! Thanks guys! [anecdote]

2016-10-12 Thread Chris Angelico
On Thu, Oct 13, 2016 at 12:01 PM, Ryan Gonzalez wrote: > On Wed, Oct 12, 2016 at 7:05 PM, Chris Angelico wrote: >> >> I work with a full-stack web development bootcamp. Most of the course >> focuses on JavaScript (Node.js, React, jQuery, etc), > > > Poor students.

Re: [Python-Dev] Update to PEP 1 re: content type

2016-10-13 Thread Chris Angelico
On Fri, Oct 14, 2016 at 5:09 AM, Mariatta Wijaya wrote: > PEP 1 states that plain/text is an acceptable value for a PEP's content > type, and it is the default value if no content type is specified. > > May I propose adding something along the line of: "new PEPs should use > restructured Text form

Re: [Python-Dev] O(1) deletes from the front of bytearray (was: Re: Adding bytes.frombuffer() constructor to PEP 467 (was: [Python-ideas] Adding bytes.frombuffer() constructor)

2016-10-18 Thread Chris Angelico
On Wed, Oct 19, 2016 at 2:57 AM, Chris Barker - NOAA Federal wrote: >> The proposal is that it should be documented as being part of the >> language spec starting in 3.4 (or whatever). > > Is the performance characteristics of any object part of the language spec? > > I.e if someone wrote an imple

Re: [Python-Dev] Bus error in Python 3.6.0beta

2016-11-22 Thread Chris Angelico
On Wed, Nov 23, 2016 at 6:20 AM, Victor Stinner wrote: > It's not bug but a feature :-) Python doesn't protect yourself against > mistakes :-) AIUI the normal way to protect yourself is to unlink (remove) the file and create it from scratch, rather than truncate it. ChrisA __

Re: [Python-Dev] Someons's put a "Python 2.8" on GitHub

2016-12-12 Thread Chris Angelico
On Tue, Dec 13, 2016 at 12:18 AM, Nick Coghlan wrote: > It absolutely *is* relevant, as is how diligent the redistributors are > in differentiating between the unmodified upstream project and the > patches we have applied post-release (rather than just posting the end > result without a clear audi

Re: [Python-Dev] Making sure dictionary adds/deletes during iteration always raise exception

2016-12-13 Thread Chris Angelico
On Wed, Dec 14, 2016 at 4:48 AM, Guido van Rossum wrote: > IIUC the private version gets updated every time the dict gets modified -- > but what we need here should only trigger when a key is added or removed, > not when a value is updated. Is it possible to add a key, triggering a resize of the

Re: [Python-Dev] Making sure dictionary adds/deletes during iteration always raise exception

2016-12-13 Thread Chris Angelico
On Wed, Dec 14, 2016 at 5:13 AM, Joe Jevnik wrote: >> Is it possible to add a key, triggering a resize of the dict, then > remove one, and continue iterating through the old (deallocated) > memory? > > You can add and remove keys between calling next which would resize the > dictionary; however, i

Re: [Python-Dev] Deprecate `from __future__ import unicode_literals`?

2016-12-16 Thread Chris Angelico
On Sat, Dec 17, 2016 at 8:07 AM, Ethan Furman wrote: > On 12/16/2016 11:24 AM, Guido van Rossum wrote: > >> I am beginning to think that `from __future__ import unicode_literals` >> does >> more harm than good. I don't recall exactly why we introduced it, but >> with >> the restoration of u"" li

Re: [Python-Dev] Generator objects and list comprehensions?

2017-01-24 Thread Chris Angelico
On Wed, Jan 25, 2017 at 4:38 PM, Craig Rodrigues wrote: > > Glyph pointed this out to me here: > http://twistedmatrix.com/pipermail/twisted-python/2017-January/031106.html > > If I do this on Python 3.6: > >>> [(yield 1) for x in range(10)] > at 0x10cd210f8> > > If I understand this: > https://d

Re: [Python-Dev] Is this a bug or a feature?

2017-02-16 Thread Chris Angelico
On Fri, Feb 17, 2017 at 7:33 AM, Patrick Wallinger wrote: > zipimport.ZipImportError: can't decompress data; zlib not available > There may very well be a bug here of the form of "zlib dependency is considered soft, but then something else breaks". However, in your current situation, my recommend

[Python-Dev] A big THANK YOU to the maintainers of What's New

2017-03-14 Thread Chris Angelico
A bit of a thankless job, updating What's New for a bugfix release, but can be so important. Today I was trying to figure out why a Python script behaved differently on my dev system and my server, even when I used Python 3.4 on both ends - but it was 3.4.4 on one and 3.4.2 on the other. My first p

Re: [Python-Dev] Guarantee the success of some object creation C API functions

2017-05-01 Thread Chris Angelico
On Tue, May 2, 2017 at 6:52 AM, Terry Reedy wrote: > The promise makes it clear that breaking the property is a bug to be fixed. > It only decreases the probability for someone who has read the promise. > Unfortunately, 'never fail' is hard to test ;-). > Aside from straight-up bugs, how can one

Re: [Python-Dev] python docs

2017-05-10 Thread Chris Angelico
On Thu, May 11, 2017 at 12:53 AM, Ethan Furman wrote: > Why is python-list the place to send behavioral bugs to? It's been my > experience that folks there will (rightly) ask the individual to file a bug > on the tracker. > How many bug tracker entries do you want to see about mutable default ar

Re: [Python-Dev] RFC: Backport ssl.MemoryBIO and ssl.SSLObject to Python 2.7

2017-06-01 Thread Chris Angelico
On Thu, Jun 1, 2017 at 7:23 PM, Antoine Pitrou wrote: >> Do you also disagree on the need of the need of the PEP 546 >> (backport) to make the PEP 543 (new TLS API) feasible in practice? > > Yes, I disagree. We needn't backport that new API to Python 2.7. > Perhaps it's time to be reasonable: Pyt

Re: [Python-Dev] RFC: Backport ssl.MemoryBIO and ssl.SSLObject to Python 2.7

2017-06-01 Thread Chris Angelico
On Thu, Jun 1, 2017 at 8:01 PM, Antoine Pitrou wrote: > On Thu, 1 Jun 2017 19:50:22 +1000 > Chris Angelico wrote: >> On Thu, Jun 1, 2017 at 7:23 PM, Antoine Pitrou wrote: >> >> Do you also disagree on the need of the need of the PEP 546 >> >> (backpo

Re: [Python-Dev] RFC: Backport ssl.MemoryBIO and ssl.SSLObject to Python 2.7

2017-06-01 Thread Chris Angelico
On Fri, Jun 2, 2017 at 1:01 AM, Cory Benfield wrote: > The answer to that is honestly not clear to me. I chatted with the pip > developers, and they have 90%+ of their users currently on Python 2, but more > than half of those are on 2.7.9 or later. This shows some interest in > upgrading to ne

Re: [Python-Dev] RFC: Backport ssl.MemoryBIO and ssl.SSLObject to Python 2.7

2017-06-01 Thread Chris Angelico
On Fri, Jun 2, 2017 at 2:35 AM, Cory Benfield wrote: > I have figures for the download numbers, which are an awkward proxy because > most people don’t CI on Windows and macOS, but they’re the best we have. > Linux has approximately 20x the download numbers of either Windows or macOS, > and both

<    3   4   5   6   7   8   9   10   11   >