Re: [Python-Dev] PEP 466 (round 5): selected network security enhancements for Python 2.7

2014-03-26 Thread Ethan Furman
On 03/26/2014 05:00 AM, Nick Coghlan wrote: The Mac OS X binary installers historically followed the same policy as other POSIX installations and dynamically linked to the Apple provided OpenSSL libraries. However, Apple has now ceased updating these cross-platform libraries, instead requiring t

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

2014-03-26 Thread Ethan Furman
On 03/26/2014 08:14 AM, Thomas Wouters wrote: On Tue, Mar 25, 2014 at 11:37 PM, Ethan Furman wrote: In particular, ``%s`` will not accept numbers (use a numeric format code for that), nor ``str`` (encode it to ``bytes``). I don't understand this restriction, and there is

Re: [Python-Dev] collections.sortedtree

2014-03-26 Thread Ethan Furman
On 03/26/2014 01:31 PM, Marko Rauhamaa wrote: I have made a full implementation of a balanced tree and would like to know what the process is to have it considered for inclusion in Python 3. Open a ticket on the tracker [1], post your code to that ticket, sign the CLA [2], answer questions, et

Re: [Python-Dev] On the necessity of PEPs [was "collections.sortedtree"]

2014-03-26 Thread Ethan Furman
On 03/26/2014 02:46 PM, Antoine Pitrou wrote: On Wed, 26 Mar 2014 17:37:40 -0400 Donald Stufft wrote: On Mar 26, 2014, at 5:30 PM, Barry Warsaw wrote: I guess if someone *wants* to go through the PEP gauntlet, I won't stop them. It builds character. Is that what it’s called? “character” >:]

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

2014-03-26 Thread Ethan Furman
On 03/26/2014 02:41 PM, Victor Stinner wrote: 2014-03-26 15:35 GMT+01:00 Ethan Furman : --- Examples:: >>> b'%a' % 3.14 b'3.14' >>> b'%a' % b'abc&#x

Re: [Python-Dev] On the necessity of PEPs [was "collections.sortedtree"]

2014-03-26 Thread Ethan Furman
On 03/26/2014 07:11 PM, Eli Bendersky wrote: On Wed, Mar 26, 2014 at 2:27 PM, Benjamin Peterson wrote: I'm not sure if that's a good thing or not. YMMV but IMHO this is a good thing. PEPs provide a single point of reference to a discussion that would otherwise be spread over multiple centi-

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

2014-03-27 Thread Ethan Furman
On 03/27/2014 04:24 AM, Antoine Pitrou wrote: On Tue, 25 Mar 2014 15:37:11 -0700 Ethan Furman wrote: ``%a`` will call ``ascii()`` on the interpolated value. This is intended as a debugging aid, rather than something that should be used in production. Non-ASCII values will be encoded to either

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

2014-03-27 Thread Ethan Furman
On 03/27/2014 04:42 AM, Nick Coghlan wrote: I also seem to recall Guido saying he liked it [%a], which flipped the discussion from "do we have a good rationale for including it?" to "do we have a good rationale for the BDFL to ignore his instincts?". However, it would be up to Guido to confirm t

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

2014-03-27 Thread Ethan Furman
On 03/27/2014 10:29 AM, Guido van Rossum wrote: I also don't understand why we can't use %b instead of %s. AFAIK %b currently doesn't mean anything and I somehow don't expect we're likely to add it for other reasons (unless there's a proposal I'm missing?). Just like we use %a instead of %r to

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

2014-03-27 Thread Ethan Furman
On 03/27/2014 10:55 AM, Ethan Furman wrote: On 03/27/2014 10:29 AM, Guido van Rossum wrote: I also don't understand why we can't use %b instead of %s. AFAIK %b currently doesn't mean anything and I somehow don't expect we're likely to add it for other reasons (unle

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

2014-03-27 Thread Ethan Furman
On 03/27/2014 11:24 AM, Guido van Rossum wrote: On Thu, Mar 27, 2014 at 10:55 AM, Ethan Furman wrote: The biggest reason to use %s is to support a common code base for 2/3 endeavors. But it's mostly useless for that purpose. In Python 2, in practice %s doesn't mean "stri

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

2014-03-27 Thread Ethan Furman
On 03/27/2014 11:53 AM, Guido van Rossum wrote: So what's the use case for Python 2/3 compatible code? IMO the main use case for the PEP is simply to be able to construct bytes from a combination of a template and some input that may include further bytes and numbers. E.g. in asyncio when you

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

2014-03-27 Thread Ethan Furman
On 03/27/2014 11:59 AM, Guido van Rossum wrote: PS. I am not trying to be difficult. I honestly don't understand the use case yet, and the PEP doesn't do much to support it. How's this? Compatibility with Python 2 ==

[Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Request for Pronouncement

2014-03-27 Thread Ethan Furman
Requesting pronouncement on PEP 461. Full text below. === PEP: 461 Title: Adding % formatting to bytes and bytearray Version: $Revision$ Last-Modified: $Date$ Author: Ethan Furman Status: Draft Type: Standards Track

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

2014-03-27 Thread Ethan Furman
On 03/27/2014 11:41 AM, Guido van Rossum wrote: Much better, but I'm still not happy with including %s at all. Otherwise it's accept-worthy. (How's that for pressure. :-) FWIW, I feel the same, but the need for compatible 2/3 code bases is real. Hey, how's this? We'll let %s in, but immediat

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Request for Pronouncement

2014-03-27 Thread Ethan Furman
On 03/27/2014 01:44 PM, Guido van Rossum wrote: Accepted. Yay! If you're going to commit another change, may I suggest to add, to the section stating that %r is not supported, that %a is usually a suitable replacement for %r? Done. -- ~Ethan~ _

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

2014-03-27 Thread Ethan Furman
On 03/27/2014 03:10 PM, Greg Ewing wrote: R. David Murray wrote: I've done the 'landmark' thing as well, in the string context; that can be very useful when doing incremental test driven development. (Granted, you could do that with __bytes__; Can't you do it more easily just by wrapping asci

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

2014-03-28 Thread Ethan Furman
On 03/27/2014 04:26 AM, Nick Coghlan wrote: On 27 March 2014 20:47, Victor Stinner wrote: The PEP 461 looks good to me. It's a nice addition to Python 3.5 and the PEP is well defined. +1 from me as well. One minor request is that I don't think the rationale for rejecting numbers from "%s" is

[Python-Dev] PyErr_ Fetch | Restore & friends

2014-03-29 Thread Ethan Furman
I'm working on issue 1615 [1] and came up with this tidbit, which works [2], but not well enough: slot_tp_getattr_hook(PyObject *self, PyObject *name) { ... +PyObject *error_type, *error_value, *error_traceback; ... +/* if an AttributeError is set, save it and call getattr; i

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

2014-03-29 Thread Ethan Furman
On 03/29/2014 11:59 AM, Antoine Pitrou wrote: On Sat, 29 Mar 2014 11:53:45 -0700 "Gregory P. Smith" wrote: I understand that sentiment but that is an unjustified fear. It is not a good reason not to do it. Projects are already trying to port stuff today and running into roadblocks when it comes

Re: [Python-Dev] PyErr_ Fetch | Restore & friends

2014-03-29 Thread Ethan Furman
On 03/29/2014 01:47 PM, Nick Coghlan wrote: On 30 March 2014 03:05, Ethan Furman wrote: This bit of code won't even finish compiling. I am not sure if my understanding of references (and how these functions create/consume them) or my understanding of when and where to call PyErr_

Re: [Python-Dev] PEP 465: A dedicated infix operator for matrix multiplication

2014-04-07 Thread Ethan Furman
On 04/07/2014 01:38 PM, Victor Stinner wrote: I'm not sure that it's a good thing to modify the *language* for a specific domain. But you can do a lot without modify the language :-) That ship has already sailed. Features have already been added at the behest of the numerical community. --

Re: [Python-Dev] [Python-checkins] cpython (3.4): docs: Document __objclass__. Closes #19281.

2014-04-08 Thread Ethan Furman
Sorry, posted to wrong list the first time. On 04/08/2014 09:33 AM, Ethan Furman wrote: On 04/08/2014 09:07 AM, yury.selivanov wrote: http://hg.python.org/cpython/rev/0973d45197cc > +The :attr:`__objclass__` is interpreted by the :mod:`inspect` module as +specifying the class where t

Re: [Python-Dev] arguments policy: **kwargs.pop()

2014-04-11 Thread Ethan Furman
On 04/11/2014 02:01 PM, Christian Tismer wrote: I have these style problems with several modules that I am reluctant to use, therefore. I know that I'm pretty alone with that. You are not alone in that. -- ~Ethan~ ___ Python-Dev mailing list Python-

Re: [Python-Dev] [numpy wishlist] PyMem_*Calloc

2014-04-14 Thread Ethan Furman
On 04/14/2014 08:36 AM, Benjamin Peterson wrote: On Sun, Apr 13, 2014, at 22:39, Nathaniel Smith wrote: SO, we'd like to route our allocations through PyMem_* in order to let tracemalloc "see" them, but because there is no PyMem_*Calloc, doing this would force us to give up on the calloc() opti

Re: [Python-Dev] this is what happens if you freeze all the modules required for startup

2014-04-17 Thread Ethan Furman
On 04/17/2014 10:33 AM, Jurko Gospodnetić wrote: In general, what I really like about using Python for software development is the ability to open any stdlib file and easily go poking around using stuff like 'import pdb;pdb.set_trace()' or simple print statements. +1 -- ~Ethan~ _

Re: [Python-Dev] static typing of input arguments in signatures

2014-04-19 Thread Ethan Furman
On 04/13/2014 04:58 PM, R. David Murray wrote: On Sun, 13 Apr 2014 15:59:36 -0400, Terry Reedy wrote: On 4/13/2014 4:11 AM, �ukasz Langa wrote: On Apr 13, 2014, at 12:48 AM, Stefan Behnel wrote: So, what I've learned from seven years of Cython is that static typing in signatures is actually

Re: [Python-Dev] PEP 469: Restoring the iterkeys/values/items() methods

2014-04-19 Thread Ethan Furman
Thank you for taking the time to write this up, Nick. However, I am -1 on it. One of the allures of Python 3 is the increase in simplicity and elegance. Restoring cruft does not help with that. Python 2 idioms that get restored to Python 3 must have real value: unicode literals, wire-protoco

Re: [Python-Dev] PEP 469: Restoring the iterkeys/values/items() methods

2014-04-21 Thread Ethan Furman
On 04/20/2014 10:39 PM, Nick Coghlan wrote: Lists as mutable snapshots -- [...] The semantic equivalent of these operations in Python 3 are ``list(d.keys())``, ``list(d.values())`` and ``list(d.iteritems())``. Last item should be ``list(d.items())``. Iterator obje

[Python-Dev] ref leaks

2014-04-23 Thread Ethan Furman
Command line: ./python -m test.regrtest -v -R3:3 test_tools Results: Ran 44 tests in 7.628s OK (skipped=1) . test_tools leaked [0, 2, 2] references, sum=4 1 test failed: test_tools Any words of wisdom for tracking those leaks? -- ~Ethan~

Re: [Python-Dev] ref leaks

2014-04-24 Thread Ethan Furman
On 04/23/2014 09:06 PM, Benjamin Peterson wrote: On Wed, Apr 23, 2014, at 19:14, Ethan Furman wrote: Command line: ./python -m test.regrtest -v -R3:3 test_tools Results: Ran 44 tests in 7.628s OK (skipped=1) . test_tools leaked [0, 2, 2] references, sum=4 1 test

Re: [Python-Dev] ConfigParser mangles keys with special chars

2014-04-25 Thread Ethan Furman
On 04/25/2014 09:46 AM, Fred Drake wrote: At this point, it would be a backward-incompatible change, so it's unlikely such a change could be allowed to affect existing code. All bug-fixes are backwards-incompatible, yet we fix them anyway. ;) It seems to me the real question is do we fix it

Re: [Python-Dev] ConfigParser mangles keys with special chars

2014-04-25 Thread Ethan Furman
On 04/25/2014 11:54 AM, Fred Drake wrote: On Fri, Apr 25, 2014 at 2:45 PM, Terry Reedy wrote: I leave it to someone to carefully read the doc, but a brief glance indicates "There are nearly as many INI format variants as there are applications using it. configparser goes a long way to provide s

Re: [Python-Dev] pep8 reasoning

2014-04-25 Thread Ethan Furman
On 04/25/2014 12:45 PM, Florent wrote: 2014-04-25 18:10 GMT+02:00 Nick Coghlan: And if you're going to publish a tool to enforce your *personal* style guide and include your own custom rules that the "this is OK" examples in PEP 8 fail to satisfy, don't call it "pep8". Two cases where signale

Re: [Python-Dev] pep8 reasoning

2014-04-25 Thread Ethan Furman
On 04/25/2014 03:26 PM, Donald Stufft wrote: pep8.py doesn’t violate PEP8, it just takes a stricter view of it. If pep8 reports errors on things that PEP 8 says are okay, that's a violation. -- ~Ethan~ ___ Python-Dev mailing list Python-Dev@python.o

Re: [Python-Dev] pep8 reasoning

2014-04-25 Thread Ethan Furman
On 04/25/2014 05:42 PM, Donald Stufft wrote: On Apr 25, 2014, at 7:20 PM, Ethan Furman wrote: On 04/25/2014 03:26 PM, Donald Stufft wrote: pep8.py doesn’t violate PEP8, it just takes a stricter view of it. If pep8 reports errors on things that PEP 8 says are okay, that's a viol

Re: [Python-Dev] pip: cdecimal an externally hosted file and may be unreliable [sic]

2014-05-09 Thread Ethan Furman
On 05/08/2014 02:02 PM, Paul Moore wrote: Socially, this change does not seem to be having the effect of persuading more package developers to host on PyPI. The stick doesn't appear to have worked, maybe we should be trying to find a carrot? Or maybe we have to accept that some developers have s

Re: [Python-Dev] Values and objects

2014-05-10 Thread Ethan Furman
[bringing back on-list] On 05/10/2014 07:30 PM, Devin Jeanpierre wrote: On Sat, May 10, 2014 at 2:38 PM, Ethan Furman wrote: On 05/10/2014 02:03 PM, Devin Jeanpierre wrote: spam is referring to a local variable that has not been bound. This is not an implementation detail. The

Re: [Python-Dev] Language Summit Follow-Up

2014-05-30 Thread Ethan Furman
On 05/30/2014 09:46 AM, Chris Barker wrote: On Thu, May 29, 2014 at 4:43 AM, Nick Coghlan wrote: For that last point, my interest is as much educational as it is in easing the transition from Python 2. The parentheses in "print('Hello world!')" mean introducing the idea of function calls early

Re: [Python-Dev] Returning Windows file attribute information via os.stat()

2014-06-10 Thread Ethan Furman
On 06/09/2014 09:02 PM, Ben Hoyt wrote: To solve this problem, what do people think about adding an "st_winattrs" attribute to the object returned by os.stat() on Windows? +1 to the idea, whatever the exact implementation. -- ~Ethan~ ___ Python-Dev

Re: [Python-Dev] subprocess shell=True on Windows doesn't escape ^ character

2014-06-11 Thread Ethan Furman
On 06/11/2014 07:12 PM, Chris Angelico wrote: On Thu, Jun 12, 2014 at 12:07 PM, Chris Angelico wrote: ISTM what you want is not shell=True, but a separate function that follows the system policy for translating a command name into a path-to-binary. That's something that, AFAIK, doesn't currentl

Re: [Python-Dev] Criticism of execfile() removal in Python3

2014-06-16 Thread Ethan Furman
On 06/16/2014 10:40 AM, Chris Barker wrote: My conclusions: 1) runfile() is not really very usefull, it's fine to hve removed it. s/runfile/execfile -- ~Ethan~ ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listin

Re: [Python-Dev] Python 2.7 patch levels turning two digit

2014-06-21 Thread Ethan Furman
On 06/21/2014 02:37 PM, M.-A. Lemburg wrote: My answers to these are: 1. We should use dynamic linking instead and not let OpenSSL bugs trigger Python releases; 2. It's not a big problem; 3. Yes, please, since it is difficult for people to develop and debug their extensions with a 2008 compiler,

Re: [Python-Dev] Tone it down on Twitter?

2018-07-06 Thread Ethan Furman
On 07/06/2018 12:30 PM, Brett Cannon wrote: IOW believing you have been disrespected does not suddenly give you permission to be disrespectful as well. Thanks, Brett, for the reminder. I know we all have rough days, and it's easy to forget to take a break before responding. -- ~Ethan~

Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?

2018-07-12 Thread Ethan Furman
On 07/12/2018 03:03 PM, Abdur-Rahmaan Janhangeer wrote: btw smileys in this thread should have been :=) lol! -- ~Ethan~ ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail

Re: [Python-Dev] Use of Cython

2018-09-04 Thread Ethan Furman
On 09/04/2018 11:55 AM, Stefan Behnel wrote: Adding the right language would lower the bar, IMHO. Cython is Python. It allows users with a Python background to implement C things without having to thoroughly learn C/and/ the CPython C-API first. So, the way I see it, rather than/adding/ a "thi

Re: [Python-Dev] bpo-34595: How to format a type name?

2018-09-11 Thread Ethan Furman
On 09/11/2018 05:21 PM, Barry Warsaw wrote: MRAB wrote on 9/11/18 16:06: Perhaps we could have a single format code plus an optional '#' for the "alternate form": %T for short form %#T for fully qualified name OTOH, if %T and variants meant "type" but %t mean something entirely different,

Re: [Python-Dev] Communication channels

2018-10-01 Thread Ethan Furman
On 10/01/2018 01:29 PM, Tres Seaver wrote: I'm pretty strongly -1 on the notion that folks who subscribe python-dev, BPO, and the github repositories should need to *also* follow an arbitrarily-growing set of Twitter accounts: how would one know if a new one popped into being? How likely is it

Re: [Python-Dev] How to update namedtuple asdict() to use dict instead of OrderedDict

2019-01-30 Thread Ethan Furman
On 01/30/2019 02:55 PM, Paul Moore wrote: On Wed, 30 Jan 2019 at 22:35, Raymond Hettinger wrote: My recommendation is Option 4 as being less disruptive and more beneficial than the other options. In the unlikely event that anyone is currently depending on the reordering methods for the outpu

Re: [Python-Dev] Asking for reversion

2019-02-05 Thread Ethan Furman
On 02/05/2019 11:35 AM, Raymond Hettinger wrote: How about we stop using a highly public forum to pile up on Davin (being the subject of a thread like this can be a soul crushing experience). Thank you for the reminder. Right now, he could really use some help and support from everyone on

Re: [Python-Dev] Best way to specify docstrings for member objects

2019-03-20 Thread Ethan Furman
On 03/19/2019 11:55 AM, Raymond Hettinger wrote: I'm working on ways to make improve help() by giving docstrings to member objects. Cool! There's another way I would like to propose. The __slots__ definition already works with any iterable including a dictionary (the dict values are igno

Re: [Python-Dev] Best way to specify docstrings for member objects

2019-03-20 Thread Ethan Furman
On 03/20/2019 03:24 PM, Ethan Furman wrote: On 03/19/2019 11:55 AM, Raymond Hettinger wrote: There's another way I would like to propose. The __slots__ definition already works with any iterable including a dictionary (the dict values are ignored), so we could use the values fo

Re: [Python-Dev] Definition of equality check behavior

2019-05-07 Thread Ethan Furman
On 05/07/2019 02:05 PM, Jordan Adler wrote: Specifically, a comparison between a primitive (int, str, float were tested) and an object of a different type always return False, instead of raising a NotImplementedError. Consider `1 == '1'` as a test case. If the object of a different type do

[Python-Dev] deprecation of abstractstaticmethod and abstractclassmethod

2019-05-15 Thread Ethan Furman
In issue 11610* abstractclassmethod and abstractstaticmethod were deprecated, apparently because they were redundant with the new technique of calling `classmethod` or `staticmethod` followed by a call to `abstractmethod`. To put it in code: # deprecated class Foo(ABC): @abstractclassme

Re: [Python-Dev] Python in next Windows 10 update

2019-05-21 Thread Ethan Furman
On 05/21/2019 01:30 PM, Steve Dower wrote: In the next Windows 10 update that starts rolling out today, we (Microsoft) have added "python.exe" and "python3.exe" commands that are installed on PATH *by default* and will open the Microsoft Store at the page where we (Python core team) publish ou

[Python-Dev] Enum and annotations

2019-06-10 Thread Ethan Furman
Greetings! I saw my first annotation mix-up with regards to Enum today: https://stackoverflow.com/q/56532591/208880 #enum import: from enum import Enum # enum definition: class Status(Enum): on: 1 off: 2 My question for the group: Is this worth "fixing" or s

[Python-Dev] Re: strip behavior provides inconsistent results with certain strings

2019-06-27 Thread Ethan Furman
On 06/27/2019 07:34 AM, dan@bauman.space wrote: Anyone experienced anything like this? This list is for the development /of/ Python, not development /with/ Python. In the future, please take such questions to, for example, Python List*. -- ~Ethan~ * https://mail.python.org/mailman/listinf

[Python-Dev] Re: [Possibly off-topic] Python-Announce floods and delays

2019-07-08 Thread Ethan Furman
On 07/08/2019 12:56 PM, Barry Warsaw wrote: I’m not a super active moderator, but I do have to say that it’s so much easier to clear the queue now that the list is on Mailman 3. That said, it still takes active participation in order to review held messages. Volunteers are welcome! :) Sign

[Python-Dev] Re: Further off-topic: webmaster@ volunteers

2019-07-08 Thread Ethan Furman
On 07/08/2019 03:12 PM, Steve Holden wrote: [even further off-topic] While I have the attention of so many community-spirited individuals, I might mention that webmaster@ could do with a few lurkers to get used to the traffic. At present it's solely maintained by Mats Wichmann and me, and I'm

[Python-Dev] Re: What is a public API?

2019-07-23 Thread Ethan Furman
On 07/23/2019 08:44 AM, Steve Dower wrote: The @public decorator is basically: def public(fn):     __all__.append(fn.__name__)     return fn It's trivial, but it adds a runtime overhead that is also trivially avoided by putting the name in __all__ manually. And once it's public API, we shou

[Python-Dev] Re: What is a public API?

2019-07-23 Thread Ethan Furman
On 07/23/2019 10:21 AM, Barry Warsaw wrote: On Jul 23, 2019, at 09:20, Ethan Furman wrote: On 07/23/2019 08:44 AM, Steve Dower wrote: It's trivial, but it adds a runtime overhead that is also trivially avoided by putting the name in __all__ manually. And once it's public API, we

[Python-Dev] Re: fail keyword like there is pass keyword

2020-10-23 Thread Ethan Furman
On 10/23/20 11:52 AM, Umair Ashraf wrote: Hello Howdy! Can I suggest a feature to discuss and hopefully develop and send a PR. You can, but the place to do it is Python Ideas: https://mail.python.org/mailman3/lists/python-ideas.python.org/ python-id...@python.org I think having

[Python-Dev] Re: fail keyword like there is pass keyword

2020-10-23 Thread Ethan Furman
On 10/23/20 4:50 PM, Steven D'Aprano wrote: On Fri, Oct 23, 2020 at 01:06:36PM -0700, Ethan Furman wrote: I think having a *fail* keyword for unit testing would be great. Luckily, we already have it: assert False I take it you don't run your unit tests under -O :-) `raise

[Python-Dev] Re: PEP 642: Constraint Pattern Syntax for Structural Pattern Matching

2020-11-02 Thread Ethan Furman
On 11/2/20 1:52 PM, Glenn Linderman wrote: On 11/2/2020 1:42 PM, Guido van Rossum wrote: But we feel that `case x, x` can easily be misunderstood as "a tuple of two equal values" So what _is_ the syntax for "a tuple of two equal values" ? case x, ?x:  # comes to mind (not that it is in the P

[Python-Dev] Re: PEP 642: Constraint Pattern Syntax for Structural Pattern Matching

2020-11-03 Thread Ethan Furman
On 11/3/20 1:30 AM, Federico Salerno wrote: Re: symbol for lookup Whatever happened to the proposal of using . as prefix? I think . is visible enough while being aesthetically inoffensive. Am i missing some problem or important past objection to it? Many people think . is not visible enough

[Python-Dev] Re: PEP 642: Constraint Pattern Syntax for Structural Pattern Matching

2020-11-03 Thread Ethan Furman
On 11/2/20 2:01 PM, Brandt Bucher wrote: Glenn Linderman wrote: So what _is_ the syntax for "a tuple of two equal values" ? If you’re asking about PEP 634: ``` case x, y if x == y: ``` Which is much clearer, in my opinion. Yeah, I've come 'round to this opinion as well. Let's get basic pa

[Python-Dev] Re: The semantics of pattern matching for Python

2020-11-22 Thread Ethan Furman
On 11/22/20 5:00 PM, Jim J. Jewett wrote: I think your changed constructor: class Car: def __init__(self, manufacturer, variant): self.brand = manufacturer self.model = variant is a particularly good example, and the PEP should specify whether: Car("Chrysler", "PT Cr

[Python-Dev] Re: Advantages of pattern matching - a simple comparative analysis

2020-11-23 Thread Ethan Furman
On 11/23/20 11:06 AM, Larry Hastings wrote: > On 11/23/20 8:15 AM, Brian Coleman wrote: >> def process(root_node: Node): >> def process_node(node: Node): >> if isinstance(node, StringNode): >> return node.value >> elif isinstance(node, NumberNode): >>

[Python-Dev] Re: Advantages of pattern matching - a simple comparative analysis

2020-11-23 Thread Ethan Furman
On 11/23/20 12:05 PM, Chris Angelico wrote: On Tue, Nov 24, 2020 at 7:00 AM Ethan Furman wrote: On 11/23/20 11:06 AM, Larry Hastings wrote: > On 11/23/20 8:15 AM, Brian Coleman wrote: >> def process(root_node: Node): >> def process_node(node: Node): >>

[Python-Dev] Re: Advantages of pattern matching - a simple comparative analysis

2020-11-23 Thread Ethan Furman
On 11/23/20 1:49 PM, David Mertz wrote: On Mon, Nov 23, 2020, 4:32 PM Eric V. Smith I just commented on Steve's post over on Discourse. The problem with this is that the called function (m.case, here) needs to have access to the caller's namespace in order to resolve the expressions, such as

[Python-Dev] Re: Pattern Matching Scope

2020-12-04 Thread Ethan Furman
On 12/4/20 11:15 AM, Jim J. Jewett wrote: To be more specific, I'm not sure what is intended for the 2nd or 3rd case below, which reuse a variable "bound" by the first (failed) match. Nor am I sure whether it matters that the first match fails on the guard predicate, instead of immediately on

[Python-Dev] Re: Pattern Matching Scope

2020-12-04 Thread Ethan Furman
On 12/4/20 12:45 PM, Daniel Moisset wrote:     case (d = a): This is a SyntaxError, (d=a) is not a pattern. Ah, right. I was thinking of the case when a type was specified, aka case MyObj(d = a): -- ~Ethan~ ___ Python-Dev mailing list

[Python-Dev] NEWS, changelog, and blurb -- a teaching moment

2020-12-09 Thread Ethan Furman
Greetings! I'm hoping somebody can alleviate my confusion. I had thought that the blurb tool was created to resolve the near-constant push races when the NEWS file was updated; but it appears that it only affects the change log. If I have a change that really needs to be in the NEWS file itse

[Python-Dev] Re: NEWS, changelog, and blurb -- a teaching moment

2020-12-09 Thread Ethan Furman
On 12/9/20 5:01 PM, Larry Hastings wrote: > "Misc/NEWS" is no longer checked in, it's generated on demand using "blurb merge". So if I understand correctly, blurb makes NEWS, but `whatsnew` is still done by hand. -- ~Ethan~ ___ Python-Dev mailing li

[Python-Dev] __init_subclass__ and metaclasses

2020-12-24 Thread Ethan Furman
PEP 487 introduced __init_subclass__ and __set_name__, and both of those were wins for the common cases of metaclass usage. Unfortunately, the implementation of PEP 487 with regards to __init_subclass__ has made the writing of correct metaclasses significantly harder, if not impossible. The c

[Python-Dev] Re: __init_subclass__ and metaclasses

2020-12-28 Thread Ethan Furman
Issue #42775: https://bugs.python.org/issue42775 PR #23986: https://github.com/python/cpython/pull/23986 ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailm

[Python-Dev] Re: __init_subclass__ and metaclasses

2020-12-28 Thread Ethan Furman
On 12/28/20 9:31 PM, Guido van Rossum wrote: Let me see if I can unpack this. I observe that `type.__new__() ` is really the C function `type_new()` in typeobject.c, and hence I will refer to it by that name. I understand that `type_new()` is the only way to create type objects, and it incl

[Python-Dev] Re: __init_subclass__ and metaclasses

2020-12-29 Thread Ethan Furman
On 12/29/20 8:59 AM, Guido van Rossum wrote: On Mon, Dec 28, 2020 at 10:24 PM Ethan Furman wrote: The `__init_subclass__` and `__set_name__` protocols are intended to be run before a new type is finished, but creating a new type has three major steps: - `__prepare__` to get the namespace

[Python-Dev] Re: PEP 642 v3: Explicit patterns for structured pattern matching

2021-01-03 Thread Ethan Furman
On 1/3/21 8:50 AM, Paul Moore wrote: Personally, I read it and was horribly confused. case object{.host as host, .port as port}: pass Leading periods is a big no-go for me, for all the reasons listed in the original thread. I have not read the full PEP, so take this

[Python-Dev] Re: __init_subclass__ and metaclasses

2021-01-05 Thread Ethan Furman
On 1/5/21 4:22 AM, Nick Coghlan wrote: > On Wed, 30 Dec 2020 at 04:38, Ethan Furman wrote: >> ... there will be a few custom metaclasses that need to move some code >> from their `__new__` to `__init__` instead, and a few that need to add >> an `__init__` to consume any k

[Python-Dev] Re: __init_subclass__ and metaclasses

2021-01-05 Thread Ethan Furman
On 1/5/21 10:25 AM, Guido van Rossum wrote: > On Tue, Jan 5, 2021 at 8:50 AM Ethan Furman wrote: >> [...] >> Perhaps `ABCMeta` can be easily fixed -- it is calling the function that >> records all abstract methods, etc., after the `type.__new__` call; can >> it be ca

[Python-Dev] Re: __init_subclass__ and metaclasses

2021-01-11 Thread Ethan Furman
On 1/7/21 4:56 AM, Nick Coghlan wrote: > Both EnumMeta and ABCMeta should probably be relying on `__set_name__` > for their per-member set up work these days, rather than deferring > that work until after __new__ returns. And here I was thinking that `__set_name__` was for, well, setting the nam

[Python-Dev] Re: 3.10 change (?) for __bool__

2021-01-12 Thread Ethan Furman
On 1/12/21 10:37 PM, Chris Angelico wrote: On Wed, Jan 13, 2021 at 5:05 PM Steven D'Aprano wrote: On Wed, Jan 13, 2021 at 04:47:06AM +1100, Chris Angelico wrote: That'd leave open the option for "foo() if x else foo()" to be optimized down to just "foo()", although I don't think that particul

[Python-Dev] Re: 3.10 change (?) for __bool__

2021-01-13 Thread Ethan Furman
On 1/12/21 11:27 PM, Chris Angelico wrote: On Wed, Jan 13, 2021 at 6:11 PM Ethan Furman wrote: Optimizations are an implementation detail, and implementation details should not change the language. The language can also be defined in an optimization-friendly way, though. Consider how we

[Python-Dev] Re: Let's Fix Class Annotations -- And Maybe Annotations Generally

2021-01-18 Thread Ethan Furman
On 1/18/21 5:33 PM, Guido van Rossum wrote: There's a secret though. `cls.__dict__` is not actually a dict -- is a mappingproxy. The proxy exists because we want to be able to intercept changes to class attributes such as `__add__` or `__getattribute__` in order to manipulate the C-level wrappe

[Python-Dev] Re: Let's Fix Class Annotations -- And Maybe Annotations Generally

2021-01-18 Thread Ethan Furman
On 1/18/21 5:53 PM, Ethan Furman wrote: `__prepare__` returns a dict-like namespace that is used as is.  `EnumMeta` uses `__prepare__` to return an instance of `_EnumDict`. When `type.__new__` is called, whatever the namespace used to be is then converted into a normal Python dict, and a

[Python-Dev] Re: New sys.module_names attribute in Python 3.10: list of all stdlib modules

2021-01-25 Thread Ethan Furman
On 1/25/21 5:03 AM, Victor Stinner wrote: I just added a new sys.module_names attribute, list (technically a frozenset) of all stdlib module names The list is opinionated and defined by its documentation For packages, only sub-packages are listed, not sub-modules. For example, ``co

[Python-Dev] Re: Acceptance of Pattern Matching PEPs 634, 635, 636, Rejection of PEPs 640 and 642

2021-02-08 Thread Ethan Furman
On 2/8/21 12:07 PM, Python Steering Council wrote: After much deliberation, the Python Steering Council is happy to announce that we have chosen to accept PEP 634, and its companion PEPs 635 and 636, collectively known as the Pattern Matching PEPs. Yay! Congratulations Guido, Brandt, Tobias

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-23 Thread Ethan Furman
On 2/22/21 4:24 PM, Irit Katriel via Python-Dev wrote: > We would like to request feedback on PEP 654 -- Exception Groups and > except*. > > https://www.python.org/dev/peps/pep-0654/ > > It proposes language extensions that allow programs to raise and > handle multiple unrelatedexceptions simulta

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-23 Thread Ethan Furman
On 2/23/21 7:56 PM, Guido van Rossum wrote: On Tue, Feb 23, 2021 at 7:37 PM Ethan Furman wrote: It sounds like the long-term goal is to move away from `except` and replace it with `except *` -- is that correct? I don't think so -- if we expected that to happen the extra '*'

[Python-Dev] Re: Alternative syntax for Python's lambda

2021-03-25 Thread Ethan Furman
On 3/25/21 1:06 PM, Dan Stromberg wrote: I posted this to LWN, and thought I'd share it here too: This post is nearly completely devoid of context -- could you post a link, or what you are responding to, or something? -- ~Ethan~ ___ Python-Dev mail

[Python-Dev] failing doc test

2021-03-26 Thread Ethan Furman
I have this documentation: .. class:: FlagBoundary *FlagBoundary* controls how out-of-range values are handled in *Flag* and its subclasses. .. attribute:: STRICT Out-of-range values cause a :exc:`

[Python-Dev] Re: Weird io.OpenWrapper hack to use a function as method

2021-03-31 Thread Ethan Furman
On 3/31/21 6:49 AM, Victor Stinner wrote: tl; dr *Maybe* staticmethod could be modified to become callable? There have been other requests to make staticmethod callable, one of them being https://bugs.python.org/issue20309 +1 for having it done. -- ~Ethan~

[Python-Dev] Re: NOTE: Python 3.9.3 contains an unintentional ABI incompatibility leading to crashes on 32-bit systems

2021-04-05 Thread Ethan Furman
On 4/4/21 7:10 AM, Michał Górny wrote: This is precisely what I meant when I said I don't like the idea of combining security fixes with irrelevant changes. Good that I've chosen to backport the secfixes instead of pushing the new version to Gentoo stable. If I'm a user of Gentoo stable, how

[Python-Dev] Re: Mailman 2 - not receiving moderators emails

2021-04-05 Thread Ethan Furman
On 4/5/21 4:49 PM, da...@thenicols.net wrote: I recently rebuilt my server (Ubuntu 20.04) and rebuilt mailman 2 - upgrading to the latest version 2.1.34. The mail server is postfix Howdy! This list is for developing the next version of Python itself. For help with mailman you can try ma

[Python-Dev] Re: Request for comments on final version of PEP 653 (Precise Semantics for Pattern Matching)

2021-04-06 Thread Ethan Furman
On 4/4/21 2:15 AM, Mark Shannon wrote: Calling something a "reference" implementation suggests that it is something that people can refer to, that is near perfectly correct and fills in the gaps in the specification. That is a high standard, and one that is very difficult to attain. Indeed.

[Python-Dev] NamedTemporaryFile and context managers

2021-04-08 Thread Ethan Furman
In issue14243 [1] there are two issues being tracked: - the difference in opening shared files between posix and Windows - the behavior of closing the underlying file in the middle of NamedTemporaryFile's context management I'd like to address and get feedback on the context management issue.

[Python-Dev] Re: NamedTemporaryFile and context managers

2021-04-08 Thread Ethan Furman
On 4/8/21 1:43 PM, Antoine Pitrou wrote: On Thu, 8 Apr 2021 13:31:26 -0700 Ethan Furman wrote: ```python from tempfile import NamedTemporaryFile with NamedTemporaryFile() as fp: fp.write(b'some data') fp.close() # Windows workaround fp.open() data = fp.read

[Python-Dev] word choices when criticizing [was: Typing syntax and ecosystem]

2021-04-12 Thread Ethan Furman
> You could say [...] or "I deeply think that this was one of the > worst decisions" [...] Not to get too far off topic, but that's not a good choice of words, either. -- ~Ethan~ ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send

[Python-Dev] PEP-0467: Minor API improvements for binary sequences

2021-04-13 Thread Ethan Furman
-Modified: $Date$ Author: Nick Coghlan , Ethan Furman Status: Deferred Type: Standards Track Content-Type: text/x-rst Created: 30-Mar-2014 Python-Version: 3.9 Post-History: 2014-03-30 2014-08-15 2014-08-16 2016-06-07 2016-09-01 2021-04-13 Abstract During the initial development of the

<    3   4   5   6   7   8   9   10   11   12   >