[Python-Dev] Re: New __main__.rst

2021-08-10 Thread MRAB
On 2021-08-10 03:14, Jack DeVries wrote: There have been a series of requests to enhance the current __main__.rst document : bpo-17359 bpo-24632 bpo-39452

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

2021-08-15 Thread MRAB
On 2021-08-15 22:50, 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 _any_ sense of it. By my

[Python-Dev] Re: PEP 667: Consistent views of namespaces

2021-08-24 Thread MRAB
On 2021-08-24 17:55, Patrick Reader wrote: On 24/08/2021 06:27, Steven D'Aprano wrote: Wouldn't that attempt to resolve global y, rather than local y? Unless there is a change to the current behaviour of the compiler, I think you need to fool the compiler: if False: y = 0 # anywhere i

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

2021-09-08 Thread MRAB
On 2021-09-08 13:37, 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 you already see such code

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

2021-09-08 Thread MRAB
On 2021-09-09 00:29, Rob Cliffe via Python-Dev wrote: On 08/09/2021 21:21, Christopher Barker wrote: [snip] NOTE: my objection to “bchr”, whether as a builtin or not is not the functionality, it’s the name. [snip] Why not byte() ? I happened to need to convert an integer to a byte recen

[Python-Dev] Re: Worried about Python release schedule and lack of stable C-API

2021-09-25 Thread MRAB
On 2021-09-26 00:14, jack.jan...@cwi.nl wrote: I’m getting increasingly worried about the future of Python, and those worries have been exacerbated by the new yearly release rhythm, and the lack of a stable C-API that is full enough to entice extension writers to use it. PyPI packages and whe

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread MRAB
On 2021-10-03 18:50, Brandt Bucher wrote: Łukasz Langa wrote: My idea is this: try: ... except group E as e: ... except group E1, T2 as e: ... Should be doable given the magical match-case contextual keywords precedent. This looks nice and is explicit, since you will always get an E

[Python-Dev] Re: PEP 654 except* formatting

2021-10-04 Thread MRAB
On 2021-10-04 07:12, Greg Ewing wrote: On 4/10/21 6:23 pm, Guido van Rossum wrote: On Sun, Oct 3, 2021 at 9:20 PM Jonathan Goble > wrote: Therefore my vote is for requiring `except* E` and keeping `except *E` as a SyntaxError. You can't do that with our curre

[Python-Dev] Re: PEP 654 except* formatting

2021-10-04 Thread MRAB
On 2021-10-04 16:02, Jonathan Goble wrote: On Mon, Oct 4, 2021 at 1:24 AM Guido van Rossum > wrote: On Sun, Oct 3, 2021 at 9:20 PM Jonathan Goble mailto:jcgob...@gmail.com>> wrote: Therefore my vote is for requiring `except* E` and keeping `except *E

[Python-Dev] Re: PEP 654 except* formatting

2021-10-05 Thread MRAB
On 2021-10-06 02:12, Barry Warsaw wrote: What do the PEP authors think about `except group`? Bikeshedding aside, that’s still the best alternative I’ve seen. It’s unambiguous, self-descriptive, and can’t be confused with unpacking syntax. +1 ___ P

[Python-Dev] Can't upload to PyPI

2013-02-21 Thread MRAB
Since the PyPI security notice of 2013-02-15 I've been unable to upload to PyPI via "setup.py upload". I changed my password during the grace period, and have reset it, but it's still rejected: Upload failed (401): Incorrect password I can login to PyPI with the password. Can anyone suggest wh

Re: [Python-Dev] Can't upload to PyPI

2013-02-21 Thread MRAB
On 2013-02-22 02:09, Ian Cordasco wrote: On Thu, Feb 21, 2013 at 9:02 PM, MRAB wrote: Since the PyPI security notice of 2013-02-15 I've been unable to upload to PyPI via "setup.py upload". I changed my password during the grace period, and have reset it, but it's sti

Re: [Python-Dev] Can't upload to PyPI

2013-02-21 Thread MRAB
On 2013-02-22 02:37, Ian Cordasco wrote: On Thu, Feb 21, 2013 at 9:27 PM, MRAB wrote: On 2013-02-22 02:09, Ian Cordasco wrote: On Thu, Feb 21, 2013 at 9:02 PM, MRAB wrote: Since the PyPI security notice of 2013-02-15 I've been unable to upload to PyPI via "setup.py upload"

Re: [Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as

2013-02-25 Thread MRAB
On 2013-02-25 16:37, Barry Warsaw wrote: On Feb 25, 2013, at 07:12 AM, Ethan Furman wrote: And if, in those places, the enums were based on ints (or strings), would it hurt you? Because in the places where I, as well as many others, use enums we *need* the int portion; and having to wrap the e

Re: [Python-Dev] Difference in RE between 3.2 and 3.3 (or Aaron Swartz memorial)

2013-03-06 Thread MRAB
On 2013-03-06 14:18, Amaury Forgeot d'Arc wrote: Hi, 2013/3/6 Matěj Cepl mailto:mc...@redhat.com>> On 2013-02-26, 16:25 GMT, Terry Reedy wrote: > On 2/21/2013 4:22 PM, Matej Cepl wrote: >> as my method to commemorate Aaron Swartz, I have decided to port his >> html2text to w

Re: [Python-Dev] Why can't I encode/decode base64 without importing a module?

2013-04-25 Thread MRAB
On 25/04/2013 14:34, Lennart Regebro wrote: On Thu, Apr 25, 2013 at 2:57 PM, Antoine Pitrou wrote: I can think of many usecases where I want to *embed* base64-encoded data in a larger text *before* encoding that text and transmitting it over a 8-bit channel. That still doesn't mean that this

Re: [Python-Dev] Why can't I encode/decode base64 without importing a module?

2013-04-25 Thread MRAB
On 25/04/2013 15:22, MRAB wrote: On 25/04/2013 14:34, Lennart Regebro wrote: On Thu, Apr 25, 2013 at 2:57 PM, Antoine Pitrou wrote: I can think of many usecases where I want to *embed* base64-encoded data in a larger text *before* encoding that text and transmitting it over a 8-bit channel

Re: [Python-Dev] NoneType(None) raises exception

2013-04-25 Thread MRAB
On 26/04/2013 00:09, Ethan Furman wrote: We just fixed NoneType() to return None instead of raising an exception. Another use-case for calling NoneType is working with ORMs: result = [] for field in row: type = get_type(field) # returns int, bool, str, NoneType, ... result.ap

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-25 Thread MRAB
On 26/04/2013 00:59, Glenn Linderman wrote: On 4/25/2013 3:23 PM, Barry Warsaw wrote: My point is, "days of the week" has a natural ordering, so why wouldn't you use IntEnum for that? Problem solved. While the ordering is natural, some implementations start from 0, some start from 1, and on t

Re: [Python-Dev] NoneType(None) raises exception

2013-04-25 Thread MRAB
On 26/04/2013 01:27, Steven D'Aprano wrote: On 26/04/13 09:56, MRAB wrote: On the one hand, NoneType(None) seems a strange thing to do. Only when you write it out like that as constants. It's no more, or less, strange than str('spam') or int(1) or list([]). Why would you

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-26 Thread MRAB
On 26/04/2013 06:21, Ethan Furman wrote: On 04/25/2013 08:14 PM, Greg wrote: On 26/04/2013 1:28 p.m., Ethan Furman wrote: Interesting idea, but why does Day(3) have to be disallowed to make it work? Because it's ambiguous. Which day of the week is number 3? It depends on where you start. Ah

Re: [Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

2013-04-29 Thread MRAB
On 29/04/2013 19:24, Steven D'Aprano wrote: On 30/04/13 03:01, Guido van Rossum wrote: Oh dear, this is actually a mess. I don't want MoreColor.red and Color.red to be distinct objects, but then the isinstance() checks will become confusing. If we don't override isinstance(), we'll get not isi

Re: [Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

2013-04-29 Thread MRAB
On 29/04/2013 21:00, Steven D'Aprano wrote: On 30/04/13 05:02, MRAB wrote: Why is that backwards? MoreColor is a subclass of Color, so instances of MoreColor are instances of Color, but instances of Color are not instances of MoreColor. That's normal behaviour for subclasses. (Al

Re: [Python-Dev] Difference in RE between 3.2 and 3.3 (or Aaron Swartz memorial)

2013-05-05 Thread MRAB
On 05/05/2013 23:01, Matej Cepl wrote: - Original Message - From: "Armin Rigo" To: "Matej Cepl" Cc: python-dev@python.org Sent: Saturday, May 4, 2013 11:59:42 AM Subject: Re: [Python-Dev] Difference in RE between 3.2 and 3.3 (or Aaron Swartz memorial) Hi Matej, On Thu, Mar 7, 2013 a

Re: [Python-Dev] Issue 11406: adding os.scandir(), a directory iterator returning stat-like info

2013-05-10 Thread MRAB
On 10/05/2013 11:55, Ben Hoyt wrote: A few of us were having a discussion at http://bugs.python.org/issue11406 about adding os.scandir(): a generator version of os.listdir() to make iterating over very large directories more memory efficient. This also reflects how the OS gives things to you -- i

Re: [Python-Dev] cpython (merge 3.3 -> default): Merge with 3.3

2013-05-28 Thread MRAB
On 29/05/2013 00:29, Terry Jan Reedy wrote: On 5/28/2013 3:39 PM, Antoine Pitrou wrote: On Tue, 28 May 2013 15:06:39 -0400 Terry Reedy wrote: Yes, Nick suggested README instead of what I had. I want a prefix to keep it near the top of a directory listing even when other non 'test_xxx' files

[Python-Dev] PyPI upload error

2013-06-04 Thread MRAB
I've just tried to upload to PyPI using setup.py and got this error: Upload failed (503): backend write error Can anyone tell me what it means? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Uns

Re: [Python-Dev] PyPI upload error

2013-06-04 Thread MRAB
On 05/06/2013 03:07, Donald Stufft wrote: On Jun 4, 2013, at 9:47 PM, MRAB mailto:pyt...@mrabarnett.plus.com>> wrote: I've just tried to upload to PyPI using setup.py and got this error: Upload failed (503): backend write error Can anyone tell me what it means? This is pr

Re: [Python-Dev] Unicode minus sign in numeric conversions

2013-06-08 Thread MRAB
On 08/06/2013 23:30, Guido van Rossum wrote: [Diverting to python-ideas, since this isn't as clear-cut as you think.] Why exactly is that expected behavior? What's the use case? (Surely you don't have a keyboard that generates \u2212 when you hit the minus key? :-) Is there a Unicode standard f

Re: [Python-Dev] Misc re.match() complaint

2013-07-15 Thread MRAB
On 16/07/2013 00:30, Gregory P. Smith wrote: On Mon, Jul 15, 2013 at 4:14 PM, Guido van Rossum mailto:gu...@python.org>> wrote: In a discussion about mypy I discovered that the Python 3 version of the re module's Match object behaves subtly different from the Python 2 version when t

Re: [Python-Dev] Misc re.match() complaint

2013-07-15 Thread MRAB
On 16/07/2013 01:25, Guido van Rossum wrote: On Mon, Jul 15, 2013 at 5:10 PM, MRAB wrote: On 16/07/2013 00:30, Gregory P. Smith wrote: On Mon, Jul 15, 2013 at 4:14 PM, Guido van Rossum mailto:gu...@python.org>> wrote: In a discussion about mypy I discovered that the Python 3 vers

Re: [Python-Dev] Misc re.match() complaint

2013-07-17 Thread MRAB
On 17/07/2013 05:15, Stephen J. Turnbull wrote: Terry Reedy writes: > On 7/15/2013 10:20 PM, Guido van Rossum wrote: > > >> Or is this something deeper, that a group *is* a new object in > >> principle? > > > > No, I just think of it as returning "a string" > > That is exactly wha

Re: [Python-Dev] Deprecating the formatter module

2013-08-14 Thread MRAB
On 14/08/2013 17:17, Eli Bendersky wrote: On Wed, Aug 14, 2013 at 9:09 AM, Nick Coghlan mailto:ncogh...@gmail.com>> wrote: On 14 August 2013 11:55, Brett Cannon mailto:br...@python.org>> wrote: > On Wed, Aug 14, 2013 at 11:47 AM, Nick Coghlan mailto:ncogh...@gmail.com>> wrote:

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

2013-08-15 Thread MRAB
On 15/08/2013 13:29, R. David Murray wrote: On Thu, 15 Aug 2013 11:22:14 +0200, Antoine Pitrou wrote: On Thu, 15 Aug 2013 11:16:20 +0200 Victor Stinner wrote: > 2013/8/15 Antoine Pitrou : > > We don't have any substantial change in store for an eventual "Python > > 4", so it's quite a remote h

Re: [Python-Dev] Accepted: PEP 446 -- Make newly created file descriptors non-inheritable

2013-08-28 Thread MRAB
On 28/08/2013 07:29, Paul Moore wrote: On 27 August 2013 23:17, Guido van Rossum mailto:gu...@python.org>> wrote: Thanks for your tiresome work I'm guessing you meant "tireless" here :-) That depends. It might have been tiresome for the one doing it! _

Re: [Python-Dev] unicodedata module is out of date

2013-09-06 Thread MRAB
On 06/09/2013 10:54, Andrew Miller wrote: The unicodedata module only contains data up to Unicode 5.2 (October 2009), so attempting to reference any character from a later version e.g: unicodedata.lookup("TURKISH LIRA SIGN") results in a KeyError. Also, it seems to be limited to properties in

Re: [Python-Dev] Add a "transformdict" to collections

2013-09-10 Thread MRAB
On 10/09/2013 20:08, Paul Moore wrote: On 10 September 2013 19:31, Antoine Pitrou wrote: I think it would be a flaw to have this detail implementation-defined. This would be like saying that it is implementation-defined which of A,B,C is returned from "A and B and C" if all are true. Ok, it s

Re: [Python-Dev] Add a "transformdict" to collections

2013-09-10 Thread MRAB
On 10/09/2013 22:46, Antoine Pitrou wrote: On Tue, 10 Sep 2013 18:44:20 -0300 "Joao S. O. Bueno" wrote: On 10 September 2013 18:06, Antoine Pitrou wrote: > On Tue, 10 Sep 2013 17:38:26 -0300 > "Joao S. O. Bueno" wrote: >> On 10 September 2013 16:08, Paul Moore wrote: >> > If you provide "ret

Re: [Python-Dev] PEP 455: TransformDict

2013-09-13 Thread MRAB
On 14/09/2013 01:49, Steven D'Aprano wrote: On Fri, Sep 13, 2013 at 11:45:16PM +0200, Antoine Pitrou wrote: Ok, I have a better (IMO) proposal: >>> d = TransformDict(str.casefold, {'Foo': 1}) >>> d.getitem('foo') ('Foo', 1) >>> d.getitem('bar') Traceback (most recent call l

Re: [Python-Dev] PEP 455: TransformDict

2013-09-13 Thread MRAB
On 14/09/2013 02:40, Ethan Furman wrote: On 09/13/2013 06:25 PM, MRAB wrote: On 14/09/2013 01:49, Steven D'Aprano wrote: Is it more common to want both the canonical key and value at the same time, or to just want the canonical key? My gut feeling is that I'm likely to have code

Re: [Python-Dev] PEP 455: TransformDict

2013-09-14 Thread MRAB
On 14/09/2013 05:47, Ethan Furman wrote: On 09/13/2013 08:18 PM, Steven D'Aprano wrote: You're missing that I'm not iterating over the entire dict, just some subset ("data") that I got from elsewhere. Ah, okay. Between you and Antoine I am convinced that .getitem() is a good thing. So have

Re: [Python-Dev] License() release list is imcomplete; intentional?

2013-09-17 Thread MRAB
On 17/09/2013 16:37, Terry Reedy wrote: On 2.7, >>> license() return a text that includes a complete list of releases from 1.6 to 2.7 and stops there Release Derived YearOwner GPL- fromcompatible? (1) 0.9

Re: [Python-Dev] Best practice for documentation for std lib

2013-09-23 Thread MRAB
On 23/09/2013 20:01, Terry Reedy wrote: On 9/22/2013 10:44 PM, Guido van Rossum wrote: Glad you like it. I still do, too, but I've given up hope to convince all core developers to stick to this style. :-( >[me] ('Return' rather than 'Returns' is the current convention.) That's actually a

Re: [Python-Dev] Revert #12085 fix for __del__ attribute error message

2013-09-23 Thread MRAB
On 23/09/2013 22:19, Nick Coghlan wrote: On 24 Sep 2013 01:24, "Antoine Pitrou" mailto:solip...@pitrou.net>> wrote: > > On Mon, 23 Sep 2013 18:51:04 +1000 > Nick Coghlan mailto:ncogh...@gmail.com>> wrote: > > On 23 September 2013 18:45, Antoine Pitrou mailto:solip...@pitrou.net>> wrote: > >

Re: [Python-Dev] Revert #12085 fix for __del__ attribute error message

2013-09-24 Thread MRAB
On 24/09/2013 09:06, Nick Coghlan wrote: On 24 September 2013 17:34, Antoine Pitrou wrote: On Tue, 24 Sep 2013 17:25:10 +1000 Nick Coghlan wrote: You are setting the bar unreasonably high for an error message that has to convey a complex concept in as few words as possible. There is *NO* wor

Re: [Python-Dev] Revert #12085 fix for __del__ attribute error message

2013-09-25 Thread MRAB
eption in __del__ | > method ignored"? It explains fairly clearly what has | > happened, and also indicates what do do about it -- | > catch it in the __del__ method. | | "Exception in __del__ caught and not propagated:" | Georg On 24Sep2013 09:33, Glenn Linderman wrote: |

Re: [Python-Dev] toolbar

2013-09-28 Thread MRAB
On 28/09/2013 12:28, Kevin Ngugi wrote: Hi, I just downloaded Python 3.3 top teach myself how to program, I am new to programming, but the guide I am using requires me to access the toolbar, which I cannot seem to find. How do I find it and have it displayed on the interface? I tried v 3.1 but it

Re: [Python-Dev] PEP 455: TransformDict

2013-10-08 Thread MRAB
On 08/10/2013 19:02, Yuriy Taraday wrote: On Fri, Sep 13, 2013 at 10:40 PM, Antoine Pitrou mailto:solip...@pitrou.net>> wrote: Hello, Following the python-dev discussion, I've written a PEP to recap the proposal and the various arguments. It's inlined below, and it will probabl

Re: [Python-Dev] On the dangers of giving developers the best resources

2013-10-08 Thread MRAB
On 08/10/2013 23:21, Tim Delaney wrote: On 9 October 2013 09:10, Guido van Rossum mailto:gu...@python.org>> wrote: It's not actually so much the extreme waste that I'm looking to expose, but rather the day-to-day annoyances of stuff you use regularly that slows you down by just a sec

Re: [Python-Dev] cpython: Rename contextlib.ignored() to contextlib.ignore().

2013-10-11 Thread MRAB
On 11/10/2013 18:39, Ethan Furman wrote: On 10/11/2013 09:43 AM, Barry Warsaw wrote: On Oct 11, 2013, at 06:27 PM, Georg Brandl wrote: Maybe to fit in with other verb-like APIs used as context managers: it's open() not opened(). open() predates context managers, but maybe we need a new conve

Re: [Python-Dev] cpython: Rename contextlib.ignored() to contextlib.ignore().

2013-10-11 Thread MRAB
On 11/10/2013 19:41, Glenn Linderman wrote: On 10/11/2013 10:19 AM, Eric V. Smith wrote: On 10/11/2013 12:43 PM, Barry Warsaw wrote: On Oct 11, 2013, at 06:27 PM, Georg Brandl wrote: Maybe to fit in with other verb-like APIs used as context managers: it's open() not opened(). open() predates

Re: [Python-Dev] cpython: Rename contextlib.ignored() to contextlib.ignore().

2013-10-12 Thread MRAB
On 12/10/2013 05:05, Ethan Furman wrote: On 10/11/2013 07:47 PM, Stephen J. Turnbull wrote: Nick Coghlan writes: > (RDM is also right that the exception still has the effect of > terminating the block early, but I view names as mnemonics rather > than necessarily 100% accurate description

Re: [Python-Dev] PEP 468

2016-06-13 Thread MRAB
On 2016-06-13 17:34, Ethan Furman wrote: On 06/10/2016 02:13 PM, Franklin? Lee wrote: P.S.: If anyone is missing the relevance, Raymond Hettinger's compact dicts are inherently ordered until a delitem happens.[1] That could be "good enough" for many purposes, including kwargs and class definiti

Re: [Python-Dev] PEP 468

2016-06-13 Thread MRAB
On 2016-06-14 01:47, Larry Hastings wrote: On 06/13/2016 05:05 PM, MRAB wrote: This could be avoided by expanding the items to include the index of the 'previous' and 'next' item, so that they could be handled like a doubly-linked list. The disadvantage would be that it w

Re: [Python-Dev] frame evaluation API PEP

2016-06-19 Thread MRAB
On 2016-06-20 02:29, Brett Cannon wrote: On Sat, 18 Jun 2016 at 21:49 Guido van Rossum mailto:gu...@python.org>> wrote: [snip] Could you figure out some other way to store per-code-object data? It seems you considered this but decided that the co_extra field was simpler and faste

Re: [Python-Dev] Convert from unsigned long long to PyLong

2016-07-23 Thread MRAB
On 2016-07-23 05:23, Tian JiaLin wrote: Hey Guys, I found the mistake I made, basically I'm using a tool called Sentry to capture the exceptions. The value returned from the Python is 2^64-1, which is -1 from mysql_affected_rows. Sentry is using JSON format as the a kind of storage, apparently t

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

2016-09-02 Thread MRAB
On 2016-09-02 23:45, Brett Cannon wrote: On Fri, 2 Sep 2016 at 15:11 Chris Angelico mailto:ros...@gmail.com>> wrote: On Sat, Sep 3, 2016 at 7:56 AM, Brett Cannon mailto:br...@python.org>> wrote: > On Fri, 2 Sep 2016 at 13:31 Dino Viehland via Python-Dev > mailto:python-dev@python.o

Re: [Python-Dev] Installation Error

2016-09-10 Thread MRAB
On 2016-09-11 00:44, Trevon Bizzle wrote: Good evening! I tried downloading Python yesterday and was met with some success. I have been searching for solutions but can not seem to find one. Each time I try to run python an error occurs saying; python.exe - System Error The program can't start bec

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

2016-09-13 Thread MRAB
On 2016-09-13 07:57, Mark Lawrence via Python-Dev wrote: On 12/09/2016 23:25, Gregory P. Smith wrote: [snip] The problem is... I don't know how to express this as an API. Which sinks my whole though process and tables the idea. "tables the idea" has the US meaning of close it down, not the

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

2016-09-13 Thread MRAB
On 2016-09-13 11:44, Nick Coghlan wrote: On 13 September 2016 at 08:25, Gregory P. Smith wrote: At this point I think coding up an example patch against beta1 offering a choice of disordered iteration capability that does not increase memory or iteration overhead in any significant way is neede

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

2016-09-13 Thread MRAB
On 2016-09-14 00:42, Greg Ewing wrote: MRAB wrote: On 2016-09-13 07:57, Mark Lawrence via Python-Dev wrote: "tables the idea" has the US meaning of close it down, not the UK meaning of open it up? :) A better phrase would've been "shelves the idea". There's

Re: [Python-Dev] TextIO seek and tell cookies

2016-09-25 Thread MRAB
On 2016-09-26 00:21, Ben Leslie wrote: Hi all, I recently shot myself in the foot by assuming that TextIO.tell returned integers rather than opaque cookies. Specifically I was adding an offset to the value returned by TextIO.tell. In retrospect this doesn't make sense/ Now, I don't want to driv

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

2016-10-10 Thread MRAB
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: X has a reference, and you are relying on X's reference to keep the object alive. Borrowing from a borrowed reference is s

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

2016-10-10 Thread MRAB
On 2016-10-10 18:50, Nathaniel Smith wrote: On Mon, Oct 10, 2016 at 10: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,

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

2016-10-10 Thread MRAB
On 2016-10-10 20:36, Chris Angelico wrote: 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

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

2016-10-10 Thread MRAB
On 2016-10-10 22:14, Larry Hastings wrote: On 10/10/2016 09:36 PM, Chris Angelico wrote: Hmm. Here's a naughty, and maybe dangerous, theory. Obtain a "memory deallocation lock". While it is held (by any thread - it's a guard, more than a lock), Py_DECREF will not actually deallocate memory - ob

Re: [Python-Dev] Implementation difference of audioop.lin2lin in Python2 and Python3

2016-12-13 Thread MRAB
On 2016-12-13 11:31, KH Luke Kim wrote: Hello, recently there had been some issues in audioread and librosa that 3-byte samples can be loaded in Python 3 but 2. The documentation says that the audioop.lin2lin function in Python 3 support 1-, 2-, 3-, 4-byte samples but only 1-, 2-, 4-byte samples

Re: [Python-Dev] re performance

2017-01-26 Thread MRAB
On 2017-01-26 21:13, Sven R. Kunze wrote: Hi folks, I recently refreshed regular expressions theoretical basics *indulging in reminiscences* So, I read https://swtch.com/~rsc/regexp/regexp1.html However, reaching the chart in the lower third of the article, I saw Python 2.4 measured against a n

Re: [Python-Dev] re performance

2017-01-26 Thread MRAB
On 2017-01-26 21:46, Sven R. Kunze wrote: On 26.01.2017 22:33, Vlastimil Brom wrote: Hi, I can't speak about the details of mrab's implementation, but using regex, I get the resulting match instantly: [...] Nice! I focused on the stdlib re module as this is mainly used by other frameworks (lik

Re: [Python-Dev] re performance

2017-01-27 Thread MRAB
On 2017-01-27 17:03, Łukasz Langa wrote: On Jan 26, 2017, at 5:16 PM, MRAB <mailto:pyt...@mrabarnett.plus.com>> wrote: So, it seems as if regex already uses a better algorithm although I couldn't find any reference to any regex theoretical framework like dfa, nfa, thompson

Re: [Python-Dev] re performance

2017-01-27 Thread MRAB
On 2017-01-27 22:15, Michael Felt wrote: On 27/01/2017 22:24, MRAB wrote: > I'm not bothered about it. It's quite a bit bigger than the re module, > and, anyway, keeping it as a third-party module gives me more freedom > to make updates, which are available for a range of

Re: [Python-Dev] re performance

2017-02-02 Thread MRAB
On 2017-02-02 04:37, Franklin? Lee wrote: On Thu, Jan 26, 2017 at 4:13 PM, Sven R. Kunze wrote: Hi folks, I recently refreshed regular expressions theoretical basics *indulging in reminiscences* So, I read https://swtch.com/~rsc/regexp/regexp1.html However, reaching the chart in the lower thi

Re: [Python-Dev] Update on labels to be used on GitHub

2017-02-14 Thread MRAB
On 2017-02-14 17:58, Victor Stinner wrote: 2017-02-14 18:43 GMT+01:00 Zachary Ware : To propose another color for the bikeshed, what about having labels for each branch along with "needs backport" and "cherry-pick" labels? Oh right, labels have colors. I propose pink for "needs backport" and y

Re: [Python-Dev] Translated Python documentation

2017-02-24 Thread MRAB
On 2017-02-24 15:10, Steven D'Aprano wrote: On Fri, Feb 24, 2017 at 06:01:59AM -0500, tritium-l...@sdamon.com wrote: My gut splits the difference on this issue; I suggest an approach to meet in the middle – a version of the docs written in simplified English (Not quite Up Goer Five simplified,

Re: [Python-Dev] __del__ is not called after creating a new reference

2017-03-20 Thread MRAB
On 2017-03-20 20:23, Antoine Pitrou wrote: Hello Oleg, On Mon, 20 Mar 2017 18:28:29 +0100 Oleg Nesterov wrote: I started to learn python a few days ago and I am trying to understand what __del__() actually does. https://docs.python.org/3/reference/datamodel.html says: object.__del__(

Re: [Python-Dev] Exact date of Python 2 EOL?

2017-03-23 Thread MRAB
On 2017-03-23 16:37, Brian Curtin wrote: On Thu, Mar 23, 2017 at 12:19 PM, Barry Warsaw wrote: On Mar 23, 2017, at 09:41 AM, Victor Stinner wrote: Can we pick an official date? Benjamin should pick the date and update PEP 373. Not to start a bikeshed (calendarshed?), but how about 8 Febru

Re: [Python-Dev] 2017 Python Language Summit coverage

2017-05-25 Thread MRAB
On 2017-05-25 22:16, Gregory P. Smith wrote: Thanks Jake! I'm laughing at not being in the photo. That must've happened soon after I left the room as I disappeared a tad early. I'll pretend I'm hiding behind Brett or Thomas. ;) > -gps > Or someone could Photoshop you in. :-) On Thu, May

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-05 Thread MRAB
On 2017-06-05 13:00, Skip Montanaro wrote: On Mon, Jun 5, 2017 at 12:41 AM, Serhiy Storchaka wrote: Barry and Victor prefer moving a brace on a new line in all multiline conditional cases. I think that it should be done only when the condition continuation lines and the following block of the c

Re: [Python-Dev] Pure pickle bechmark.

2017-07-09 Thread MRAB
On 2017-07-09 15:08, Bhavishya wrote: Hello, 1).I was going through the code of *python pickle* to search any optimization possibility.But the only thing that I found very alarming was again the import time(I tried with lazy-import but it didn't helped much.) I found py3 to be ~45 times slo

Re: [Python-Dev] Impact of Namedtuple on startup time

2017-07-17 Thread MRAB
On 2017-07-17 21:31, Giampaolo Rodola' wrote: I completely agree. I love namedtuples but I've never been too happy about the additional overhead vs. plain tuples (both for creation and attribute access times), to the point that I explicitly avoid to use them in certain circumstances (e.g. a bus

Re: [Python-Dev] Impact of Namedtuple on startup time

2017-07-17 Thread MRAB
On 2017-07-17 21:46, MRAB wrote: On 2017-07-17 21:31, Giampaolo Rodola' wrote: I completely agree. I love namedtuples but I've never been too happy about the additional overhead vs. plain tuples (both for creation and attribute access times), to the point that I explicitly avoid to

Re: [Python-Dev] for...else

2017-07-26 Thread MRAB
On 2017-07-26 23:55, Koos Zevenhoven wrote: On Mon, Jul 24, 2017 at 7:14 PM, Steven D'Aprano >wrote: Hello Kiuhnm, and welcome. On Mon, Jul 24, 2017 at 05:35:03PM +0200, Kiuhnm via Python-Dev wrote: > Hello, > > I think that the expression "for...

Re: [Python-Dev] for...else

2017-07-26 Thread MRAB
On 2017-07-27 01:07, Koos Zevenhoven wrote: On Jul 27, 2017 02:38, "MRAB" <mailto:pyt...@mrabarnett.plus.com>> wrote: On 2017-07-26 23:55, Koos Zevenhoven wrote: ​IMO, for item in sequence: # block nobreak: # or pe

Re: [Python-Dev] for...else

2017-07-27 Thread MRAB
On 2017-07-27 03:34, Mike Miller wrote: On 2017-07-26 16:36, MRAB wrote: "nobreak" would introduce a new keyword, but "not break" wouldn't. Whenever I've used the for-else, I've put a # no-break right next to it, to remind myself as much as anyone el

Re: [Python-Dev] for...else

2017-07-28 Thread MRAB
not break"? Le 27/07/2017 à 21:19, MRAB a écrit : On 2017-07-27 03:34, Mike Miller wrote: On 2017-07-26 16:36, MRAB wrote: "nobreak" would introduce a new keyword, but "not break" wouldn't. Whenever I've used the for-else, I've put a # no-break right

Re: [Python-Dev] bugs.python.org - outage 08/09/17 until 8:00pm PST

2017-08-09 Thread MRAB
On 2017-08-09 23:18, Mark Mangoba wrote: Dear Colleagues, I was just informed from our hosting provider for bugs.python.org , Hetzner Online - that the server is currently being migrated to a new data center. Unfortunately I was not informed ahead of time and working

Re: [Python-Dev] PEP 550 v3 naming

2017-08-22 Thread MRAB
On 2017-08-23 00:12, Greg Ewing wrote: Guido van Rossum wrote: Perhaps the latter can be shortened to just ContextStack (since the Foo part can probably be guessed from context. :-) -0.9, if I saw something called ContextStack turn up in a traceback I wouldn't necessarily jump to the conclusi

[Python-Dev] Re: Packing a long list of numbers into memory

2021-10-10 Thread MRAB
On 2021-10-10 19:20, Gregory P. Smith wrote: On Sun, Oct 10, 2021 at 7:25 AM Facundo Batista mailto:facundobati...@gmail.com>> wrote: Hello everyone! I need to pack a long list of numbers into shared memory, so I thought about using `struct.pack_into`. Its signature is

[Python-Dev] Re: Documenting Python versioning and stability expectations

2021-10-16 Thread MRAB
On 2021-10-16 22:39, Oscar Benjamin wrote: On Fri, 15 Oct 2021 at 14:12, Petr Viktorin wrote: Most of this is, hopefully, just capturing existing tribal knowledge, but: [snip] Micro Versions -- A new micro version marks *bugfix* and *security* releases. These releases are manag

[Python-Dev] Re: containment and the empty container

2021-11-08 Thread MRAB
On 2021-11-08 22:10, Cameron Simpson wrote: Note: I know you understand all this, I'm not "explaining" how things work below, I'm explaining how/why I think about how these work. On 08Nov2021 13:43, Ethan Furman wrote: When is an empty container contained by a non-empty container? [...] For

[Python-Dev] Re: containment and the empty container

2021-11-08 Thread MRAB
On 2021-11-09 00:27, Cameron Simpson wrote: On 08Nov2021 23:32, MRAB wrote: >On 2021-11-08 22:10, Cameron Simpson wrote: >>>{} in {1:'a', 'b':2] <-- TypeError because of hashability >>>set() in {1, 2, 'a', 'b'} <-- ditto >

[Python-Dev] Re: Preventing Unicode-related gotchas (Was: pre-PEP: Unicode Security Considerations for Python)

2021-11-14 Thread MRAB
On 2021-11-14 17:17, Christopher Barker wrote: On Sat, Nov 13, 2021 at 2:03 PM > wrote: def 𝚑𝓮𝖑𝒍𝑜(): __     try: 𝔥e𝗅𝕝𝚘︴ = "Hello" 𝕨𝔬r𝓵ᵈ﹎ = "World"     ᵖ𝖗𝐢𝘯𝓽(f"{𝗵e𝓵𝔩º_}, {𝖜ₒ𝒓lⅆ︴}!")     except 𝓣𝕪ᵖe𝖤𝗿ᵣ𝖔𝚛 as ⅇ𝗑c:__

[Python-Dev] Re: Optimizing literal comparisons and contains

2021-11-28 Thread MRAB
On 2021-11-29 00:52, Christopher Barker wrote: I will frequently do simple computation with literals to make my code more clear: t = 2 * 3600  # 2 hours in seconds But I see no need to optimize this kind of thing -- it would never be in a tight loop. The suggestion was specifically about op

[Python-Dev] Re: Python 3.10 vs 3.8 performance degradation

2021-12-19 Thread MRAB
On 2021-12-19 20:06, Tigran Aivazian wrote: So far I have narrowed it down to a block of code in solve.py doing a lot of multi-threaded FFT (i.e. with fft(..., threads=6) of pyFFTW), as well as numpy exp() and other functions and pure Python heavy list manipulation (yes, lists, not numpy arrays

[Python-Dev] Re: Function Prototypes

2021-12-23 Thread MRAB
On 2021-12-23 19:04, asleep.c...@gmail.com wrote: Hello and thank you for the much needed feedback. One thing that you must consider is that function prototypes have a few implications beyond typing but it seems like you're only looking at it as a tool for type hinting. The interpreter will crea

[Python-Dev] Re: 3.11 enhanced error location - can it be smarter?

2022-01-18 Thread MRAB
On 2022-01-18 21:58, Pablo Galindo Salgado wrote: The code that computes the lines is already quite complex (to the point that has to do some AST analysis and post-parsing) so I am quite worried to introduce a lot of complexity in this area. I am fine doing something that we can easily check fo

[Python-Dev] Re: I want to contribute to Python.

2022-02-06 Thread MRAB
On 2022-02-06 13:18, Ezekiel Adetoro wrote: Hello, My name is Ezekiel, and it is my desire to start contributing to Python, be part of the core development of Python. I have forked the CPython and cloned it. What is the next step I need to do? Look on the issue tracker for a bug that you can

[Python-Dev] Re: Are "Batteries Included" still a Good Thing? [was: It's now time to deprecate the stdlib urllib module]

2022-03-27 Thread MRAB
On 2022-03-27 19:52, Dan Stromberg wrote: On Sat, Mar 26, 2022 at 5:58 PM Ethan Furman > wrote: [apologies for the late post, just found this in my drafts folder] On 2/7/22 12:49 AM, Stéfane Fermigier wrote: > 3. Overall, I think the days where "batter

[Python-Dev] Re: walrus operator and expression

2022-03-28 Thread MRAB
On 2022-03-28 23:59, Chris Angelico wrote: On Tue, 29 Mar 2022 at 09:53, Ethan Furman wrote: In the following bit of code: while s := input.read(MAXBINSIZE): while len(s) < MAXBINSIZE and ns := input.read(MAXBINSIZE-len(s)): s += ns line = binascii.b2a_bas

[Python-Dev] Re: Updating inspect APIs

2022-04-17 Thread MRAB
On 2022-04-17 18:20, Pablo Galindo Salgado wrote: Hi, We are currently debating in gh-88116 (https://github.com/python/cpython/issues/88116 ) what's the best way forward to update the APIs in the inspect module to include the new position inform

<    1   2   3   4   5   6   >