Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Steven D'Aprano
On Wed, Jul 04, 2018 at 05:02:07PM +1000, Chris Angelico wrote: > On Wed, Jul 4, 2018 at 4:07 PM, Serhiy Storchaka wrote: > "Assignment is a statement" -- that's exactly the point under discussion. Not any more it isn't. We've now gone from discussion to bitter recriminations *wink* > "del i

Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Steven D'Aprano
On Wed, Jul 04, 2018 at 12:10:11AM -0700, Nathaniel Smith wrote: > Right, Python has a *very strong* convention that each line should > have at most one side-effect, import math, fractions, decimal (PEP 8 be damned, sometimes, especially in the REPL, this is much better than three separate imp

Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Steven D'Aprano
On Wed, Jul 04, 2018 at 10:20:35AM -0400, David Mertz wrote: > Hmmm... I admit I didn't expect quite this behavior. I'm don't actually > understand why it's doing what it does. > > >>> def myfun(): > ...print(globals().update({'foo', 43}), foo) Try it with a dict {'foo': 43} instead of a set

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

2018-07-04 Thread Steven D'Aprano
On Wed, Jul 04, 2018 at 03:36:18PM +0300, Ivan Pozdeev via Python-Dev wrote: > On 04.07.2018 15:29, Victor Stinner wrote: > >The PEP 572 has been approved, it's no longer worth it to discuss it ;-) > > > >Victor > > As of now, https://www.python.org/dev/peps/pep-0572/ is marked as "draft". https:

Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Steven D'Aprano
On Wed, Jul 04, 2018 at 10:13:15AM -0700, Devin Jeanpierre wrote: > > > In Python it'd look like this: > > > > > > if x = expr(); x < 0: > > > do_stuff() [...] > > Python's parser is restricted to LL(1) by design, so treating semicolons > > in "if" statements as a special case might not even be

Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Steven D'Aprano
On Wed, Jul 04, 2018 at 08:33:17PM +0300, Ivan Pozdeev via Python-Dev wrote: > >>while total != (total := total + term): > >>    term *= mx2 / (i*(i+1)) > >>    i += 2 > >>return total [...] > It took me a few minutes to figure out that this construct actually > checks term == 0. That's badly

Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Steven D'Aprano
On Wed, Jul 04, 2018 at 08:32:32PM +0200, Sven R. Kunze wrote: > >>while total != (total := total + term): > >>    term *= mx2 / (i*(i+1)) > >>    i += 2 > >>return total > > This very example here caught my eye. > > Isn't total not always equal to total? What would "regular" Python have > look

Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Steven D'Aprano
On Wed, Jul 04, 2018 at 03:24:08PM -0400, Terry Reedy wrote: > On 7/4/2018 9:35 AM, Steven D'Aprano wrote: > >On Wed, Jul 04, 2018 at 05:02:07PM +1000, Chris Angelico wrote: > >>On Wed, Jul 4, 2018 at 4:07 PM, Serhiy Storchaka > >>wrote: > > > >>&q

Re: [Python-Dev] PEP 572, VF/B, and "Shark Jumping"

2018-07-04 Thread Steven D'Aprano
On Wed, Jul 04, 2018 at 04:52:54PM -0700, Mike Miller wrote: > Additionally, I have noticed a dichotomy between prolific "C programmers" > who've supported this PEP and many Python programmers who don't want it. Prolific C programmers like me, hey? *shakes head in a combination of amusement a

Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Steven D'Aprano
On Wed, Jul 04, 2018 at 01:00:41PM -0700, Devin Jeanpierre wrote: > On Wed, Jul 4, 2018 at 11:04 AM Steven D'Aprano wrote: > > Did you actually mean arbitrary simple statements? > > > > if import math; mylist.sort(); print("WTF am I reading?"); True: > >

Re: [Python-Dev] PEP 572, VF/B, and "Shark Jumping"

2018-07-04 Thread Steven D'Aprano
On Thu, Jul 05, 2018 at 05:33:50AM +0300, Ivan Pozdeev via Python-Dev wrote: > And https://mail.python.org/pipermail/python-dev/2018-June/154160.html > disproves the "chosen often these days in new languages". Ivan, I think you may have linked to the wrong page. That page was Chris kindly refer

Re: [Python-Dev] Assignment expression and coding style: the while True case

2018-07-04 Thread Steven D'Aprano
On Thu, Jul 05, 2018 at 12:51:37AM +0200, Victor Stinner wrote: > I propose to start the discussion about "coding style" (where are > assignment expressions appropriate or not?) with the "while True" > case. We don't even have an official implementation yet, and you already want to start prescri

Re: [Python-Dev] PEP 572, VF/B, and "Shark Jumping"

2018-07-05 Thread Steven D'Aprano
On Thu, Jul 05, 2018 at 08:52:24PM +0300, Ivan Pozdeev via Python-Dev wrote: > * Same goes for `except`: doesn't accept expressions, same semantic. py> def make_exception(arg): ... return ValueError if arg else TypeError ... py> expr = [make_exception] py> try: ... 1+"1" ... except expr[

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

2018-07-05 Thread Steven D'Aprano
On Thu, Jul 05, 2018 at 09:00:39PM -0400, Alexander Belopolsky wrote: > Do we want to protect users who > cannot tell = from == so much that we are willing to cause Python to be > the first language with two non-interchangeable assignment operators? Not even close to the first. Go beat us to it

Re: [Python-Dev] Symmetric vs asymmetric symbols (was PEP 572: Do we really need a ":" in ":="?)

2018-07-06 Thread Steven D'Aprano
On Sat, Jul 07, 2018 at 01:03:06PM +1200, Greg Ewing wrote: > Ivan Pozdeev via Python-Dev wrote: > >(while "<>" reads "less or greater" which is mathematically not > >equivalent to that: not everything has a defined ordering relation. > > I think this is a silly argument against "<>". While I ag

Re: [Python-Dev] Naming comprehension syntax [was Re: Informal educator feedback on PEP 572 ...]

2018-07-06 Thread Steven D'Aprano
On Sat, Jul 07, 2018 at 02:58:23AM +0300, Ivan Pozdeev via Python-Dev wrote: > >Also, "generator builder" is not much more expressive than "generator > >expression", I agree with Guido on that comment. The only advantage (such little as it is) is that we can refer to them all using the same ter

Re: [Python-Dev] why is not 64-bit installer the default download link for Windows?

2018-07-10 Thread Steven D'Aprano
On Wed, Jul 11, 2018 at 05:14:34AM +0300, Ivan Pozdeev via Python-Dev wrote: > On 11.07.2018 1:41, Victor Stinner wrote: > >2018-07-09 18:01 GMT+02:00 Steve Dower : > >>The difficulty is that they *definitely* can use the 32-bit version, and > >>those few who are on older machines or older installs

Re: [Python-Dev] PEP 572 and assert

2018-07-17 Thread Steven D'Aprano
On Tue, Jul 17, 2018 at 07:24:12PM +0300, Serhiy Storchaka wrote: > 17.07.18 18:48, Guido van Rossum пише: > >On Tue, Jul 17, 2018 at 8:28 AM, Serhiy Storchaka >> wrote: > >Should not the assert statement introduce an implicit lexical scope > >for preventing lea

Re: [Python-Dev] PEP 572 and assert

2018-07-17 Thread Steven D'Aprano
On Wed, Jul 18, 2018 at 03:41:08AM +1000, Steven D'Aprano wrote: > Besides, there is a legitimate use for assignment expressions in > assertions: > > assert (spam := something) > 2, 'not enough spam' > assert sequence[foo] == 999, 'sequence item

Re: [Python-Dev] Issue?

2018-08-22 Thread Steven D'Aprano
On Wed, Aug 22, 2018 at 06:40:42PM +0800, 楼晓峰 wrote: > Why compare twice? This is not a mailing list for asking for help with your own code. You can try this list instead: https://mail.python.org/mailman/listinfo/python-list -- Steve ___ Python-De

Re: [Python-Dev] Python REPL doesn't work on Windows over remote powershell session (winrm)

2018-08-26 Thread Steven D'Aprano
On Sat, Aug 25, 2018 at 11:09:10PM +, ZHU Xiang wrote: > But for the remote Windows powershell session the REPL doesn’t work, > when I type ‘’python” on the remote session, there’s nothing happened. [...] > FYI, I’ve also opened a issue on Microsoft Powershell GitHub : > https://github.com/Po

Re: [Python-Dev] Official citation for Python

2018-09-09 Thread Steven D'Aprano
On Sun, Sep 09, 2018 at 03:43:13PM -0400, Jacqueline Kazil wrote: > The PSF has received a few inquiries asking the question — “How do I cite > Python?”So, I am reaching out to you all to figure this out. If you figure it out, it would be lovely to see some movement on this ticket: https://bugs.

Re: [Python-Dev] Official citation for Python

2018-09-10 Thread Steven D'Aprano
On Mon, Sep 10, 2018 at 09:25:29PM +0200, Chris Barker via Python-Dev wrote: > I"d like ot know what thee citations are expected to be used for? > > i.e. -- usually, academic papers have a collection of citiations to > acknowledge where you got an idea, or fact, or It serves both to > jusstif

Re: [Python-Dev] Official citation for Python

2018-09-11 Thread Steven D'Aprano
On Tue, Sep 11, 2018 at 11:16:08AM +0200, Chris Barker wrote: > On Tue, Sep 11, 2018 at 3:48 AM, Steven D'Aprano > wrote: > > > > That is about reproducible results, which is really a different thing > > than > > > the usual citations. > > >

Re: [Python-Dev] Official citation for Python

2018-09-12 Thread Steven D'Aprano
On Tue, Sep 11, 2018 at 10:35:04PM +0200, Chris Barker wrote: > On Tue, Sep 11, 2018 at 2:45 PM, Steven D'Aprano > wrote: > > > I think this thread is about *academic* citations. > > yes, I assumed that as well, what in any of my posts made you think > otherwise? W

Re: [Python-Dev] Change in Python 3's "round" behavior

2018-09-26 Thread Steven D'Aprano
On Wed, Sep 26, 2018 at 07:26:17AM -0400, j...@math.brown.edu wrote: > I did find the revealingly-invalid bug report > https://bugs.python.org/issue32956 ("python 3 round bug"), so I asked > there, but wanted to invite anyone else on this list who might be > interested to help. What about those

Re: [Python-Dev] Change in Python 3's "round" behavior

2018-09-27 Thread Steven D'Aprano
On Thu, Sep 27, 2018 at 05:55:07PM +1200, Greg Ewing wrote: > j...@math.brown.edu wrote: > >I understand from > >https://github.com/cosmologicon/pywat/pull/40#discussion_r219962259 > >that "to always round up... can theoretically skew the data" > > *Very* theoretically. If the number is even a whi

Re: [Python-Dev] switch statement

2018-09-29 Thread Steven D'Aprano
On Fri, Sep 21, 2018 at 02:10:00PM -0700, Guido van Rossum wrote: > There's already a rejected PEP about a switch statement: > https://www.python.org/dev/peps/pep-3103/. There's no point bringing this > up again unless you have a new use case. > > There have been several promising posts to python-

Re: [Python-Dev] Change in Python 3's "round" behavior

2018-09-30 Thread Steven D'Aprano
On Sat, Sep 29, 2018 at 09:40:03PM -0400, Alex Walters wrote: > ...and we have a stats module that would be a great place for a round > function that needs to cancel rounding errors. This has nothing to do with statistics. You should consider that this is often called "Banker's Rounding" and wh

Re: [Python-Dev] Change in Python 3's "round" behavior

2018-09-30 Thread Steven D'Aprano
On Mon, Oct 01, 2018 at 10:50:36AM +1300, Greg Ewing wrote: > Alex Walters wrote: > >Other use case is finance, where you can end up with interest calculations > >that are fractional of the base unit of currency. US$2.345 is impossible > >to > >represent in real currency, so it has to be rounded.

Re: [Python-Dev] dear core-devs

2018-10-01 Thread Steven D'Aprano
Hi Michael, and welcome, On Tue, Oct 02, 2018 at 12:41:56AM +0200, Michael Felt wrote: [...] > FYI: since the end of July I have dedicated 16 to 24 hours of my free > time to get this done. All for Python; all in my freetime. My employer > does not care - I do, or did. [...] > I am, to put it li

[Python-Dev] Should assert continue to do a LOAD_GLOBAL on AssertionError?

2018-10-03 Thread Steven D'Aprano
On the bug tracker, there's a discussion about the current behaviour of the assert statement, where shadowing AssertionError will change the behaviour of the assertion. https://bugs.python.org/issue34880 Currently, assert does a LOAD_GLOBAL on AssertionError, which means if you shadow the name

[Python-Dev] Arbitrary non-identifier string keys when using **kwargs

2018-10-04 Thread Steven D'Aprano
While keyword arguments have to be identifiers, using **kwargs allows arbitrary strings which aren't identifiers: py> def spam(**kwargs): ... print(kwargs) ... py> spam(**{"something arbitrary": 1, '\n': 2}) {'something arbitrary': 1, '\n': 2} There is some discussion on Python-Ideas on whe

Re: [Python-Dev] dear core-devs

2018-10-04 Thread Steven D'Aprano
On Thu, Oct 04, 2018 at 09:55:10AM +0200, Petr Viktorin wrote: > Is paying the best way to get features into Python? No, but it is *a* way to get features into Python. It may be a good way to get a feature that is important to (generic) you, but the core devs don't have enough time, interest or

Re: [Python-Dev] Arbitrary non-identifier string keys when using **kwargs

2018-10-09 Thread Steven D'Aprano
On Tue, Oct 09, 2018 at 09:37:48AM -0700, Jeff Hardy wrote: > > When this behavior of set/getattr was discussed a decade or so ago, > > Guido said not to disable it, but I believe he said it should not be > > considered a language feature. There are other situations where CPython > > is 'looser'

Re: [Python-Dev] Arbitrary non-identifier string keys when using **kwargs

2018-10-09 Thread Steven D'Aprano
On Tue, Oct 09, 2018 at 10:26:50AM -0700, Guido van Rossum wrote: > My feeling is that limiting it to strings is fine, but checking those > strings for resembling identifiers is pointless and wasteful. Sure. The question is, do we have to support uses where people intentionally smuggle non-identi

Re: [Python-Dev] Arbitrary non-identifier string keys when using **kwargs

2018-10-12 Thread Steven D'Aprano
On Thu, Oct 11, 2018 at 01:27:08PM -0400, Chris Barker - NOAA Federal via Python-Dev wrote: > > On the server side, the application could be doing something like > > assuming that the kwargs are e.g. column names > > This is exactly a use-case for non-identifier strings in kwargs. Why not just p

Re: [Python-Dev] "Deprecation" of os.system in favor of subprocess?

2018-10-24 Thread Steven D'Aprano
On Wed, Oct 24, 2018 at 09:34:34AM -0400, Calvin Spealman wrote: > Simply put, there is no valid use case for os.system over subprocess That is simply not true. That's your opinion, masquerading as a fact, and made in the face of Steve Dower's description of at least one appropriate use of os.

Re: [Python-Dev] short-circuiting runtime errors/exceptions in python debugger.

2018-10-26 Thread Steven D'Aprano
On Fri, Oct 26, 2018 at 04:18:37PM -0700, Ed Peschko wrote: > all, > > I was debugging a very long script that I was not all that familiar > with, and I was doing my familiar routine of being very careful in > evaluating expressions to make sure that I didn't hit such statements > as: > > TypeErr

Re: [Python-Dev] Standardize error message for non-pickleable types

2018-10-29 Thread Steven D'Aprano
On Mon, Oct 29, 2018 at 09:17:12PM +, MRAB wrote: > Therefore, my preference is for: > > "cannot pickle 'XXX' object" +1 I completely concur with MRAB. -- Steve ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mail

Re: [Python-Dev] Standardize error message for non-pickleable types

2018-10-29 Thread Steven D'Aprano
On Mon, Oct 29, 2018 at 08:51:34PM +0100, Victor Stinner wrote: > Le lun. 29 oct. 2018 à 20:42, Serhiy Storchaka a écrit : > > 1. "pickle" or "serialize"? > > serialize -1 Serializing is more general; pickle is merely one form of serializing: https://en.wikipedia.org/wiki/Comparison_of_data_se

Re: [Python-Dev] Need discussion for a PR about memory and objects

2018-11-04 Thread Steven D'Aprano
On Sun, Nov 04, 2018 at 11:43:50AM +0100, Stephane Wirtel wrote: > In this PR [https://github.com/python/cpython/pull/3382] "Remove reference > to > address from the docs, as it only causes confusion", opened by Chris > Angelico, there is a discussion about the right term to use for the > address

Re: [Python-Dev] Get a running instance of the doc for a PR.

2018-11-04 Thread Steven D'Aprano
On Sun, Nov 04, 2018 at 04:12:39PM +0100, Stephane Wirtel wrote: > My workflow is the following steps: > > git wpr XYZ > cd ../cpython-XYZ > ./configure --prefix=$PWD-build --with-pydebug --silent > make -j 4 -s > make PYTHON=../python -C Doc/ venv > make -C Doc/ check suspicious html serve > >

Re: [Python-Dev] Get a running instance of the doc for a PR.

2018-11-04 Thread Steven D'Aprano
On Sun, Nov 04, 2018 at 12:16:14PM -0500, Ned Deily wrote: > On Nov 4, 2018, at 12:04, Paul Ganssle wrote: > > > Some of the concerns about increasing the surface area I think are a > > bit overblown. I haven't seen any problems yet in the projects that > > do this, You may or may not be right

Re: [Python-Dev] Get a running instance of the doc for a PR.

2018-11-04 Thread Steven D'Aprano
On Sun, Nov 04, 2018 at 05:05:07PM +0100, Stephane Wirtel wrote: > >If I am making doc patches, shouldn't I be doing that *before* I > >submit the PR? How else will I know that my changes haven't broken the > >docs? > > You can use the web interface of Github and just add/remove/modify a > paragra

Re: [Python-Dev] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-06 Thread Steven D'Aprano
This list is for the development *of* the Python interpreter, not support for *using* Python. If you signed up to this mailing list via the web, it clearly says: Do not post general Python questions to this list. highlighted in a great big box in red. Was that not clear enough? What can we

[Python-Dev] Signalling NANs

2018-11-09 Thread Steven D'Aprano
I'm trying to understand some unexpected behaviour with float NANs in Python 3.5. Background: in IEEE-754 maths, NANs (Not A Number) come in two flavours, so called "quiet NANs" and "signalling NANs". By default, arithmetic operations on qnans return a qnan; operations on snans "signal", which

Re: [Python-Dev] Signalling NANs

2018-11-10 Thread Steven D'Aprano
On Fri, Nov 09, 2018 at 01:17:09PM -0800, Chris Barker via Python-Dev wrote: > works for me, too: > > In [9]: x = cast_int2float(0x7ff80001) > In [10]: hex(cast_float2int(x)) > Out[10]: '0x7ff80001' > > In [11]: x = cast_int2float(0x7ff1) > In [12]: hex(cast_float2int(

Re: [Python-Dev] Signalling NANs

2018-11-11 Thread Steven D'Aprano
On Sat, Nov 10, 2018 at 04:27:29PM -0800, Nathaniel Smith wrote: > Apparently loading a sNaN into an x87 register silently converts it to > a qNaN, and on Linux C compilers are allowed to do that at any point: > > > https://stackoverflow.com/questions/22816095/signalling-nan-was-corrupted-whe

Re: [Python-Dev] Need discussion for a PR about memory and objects

2018-11-19 Thread Steven D'Aprano
Responding to a few points out of order. On Mon, Nov 19, 2018 at 04:14:03PM -0800, Chris Barker via Python-Dev wrote: > I think being a bit more explicit about what properties an ID has, and how > the id() function works, and we may not need an anlogy at all, it's not > that difficult a concept.

Re: [Python-Dev] Inclusion of lz4 bindings in stdlib?

2018-11-28 Thread Steven D'Aprano
On Wed, Nov 28, 2018 at 10:43:04AM -0800, Gregory P. Smith wrote: > PyPI makes getting more algorithms easy. Can we please stop over-generalising like this? PyPI makes getting more algorithms easy for *SOME* people. (Sorry for shouting, but you just pressed one of my buttons.) PyPI might as we

Re: [Python-Dev] Inclusion of lz4 bindings in stdlib?

2018-11-28 Thread Steven D'Aprano
On Wed, Nov 28, 2018 at 07:14:03PM -0800, Brett Cannon wrote: > On Wed, 28 Nov 2018 at 13:29, Steven D'Aprano wrote: > > > On Wed, Nov 28, 2018 at 10:43:04AM -0800, Gregory P. Smith wrote: > > > > > PyPI makes getting more algorithms easy. > > > > Ca

Re: [Python-Dev] Inclusion of lz4 bindings in stdlib?

2018-11-29 Thread Steven D'Aprano
On Thu, Nov 29, 2018 at 09:36:51AM -0500, Benjamin Peterson wrote: > I don't think it's asymmetric. People have raised several practical > problems with a large stdlib in this thread. These include: > > - The evelopment of stdlib modules slows to the rate of the Python > release schedule. That'

Re: [Python-Dev] Inclusion of lz4 bindings in stdlib?

2018-11-29 Thread Steven D'Aprano
On Thu, Nov 29, 2018 at 09:53:30AM -0500, Benjamin Peterson wrote: [...] > > This is not an argument either for or against adding LZ4, I have no > > opinion either way. But it is a reminder that "just get it from PyPI" > > represents an extremely privileged position that not all Python users >

Re: [Python-Dev] Standard library vs Standard distribution?

2018-11-29 Thread Steven D'Aprano
On Thu, Nov 29, 2018 at 01:30:28PM -0800, Nathaniel Smith wrote: [...] > > > https://anaconda.com/ > > > https://www.activestate.com/products/activepython/ > > > http://winpython.github.io/ > > > http://python-xy.github.io/ > > > https://www.enthought.com/product/canopy/ > > > https://software.int

Re: [Python-Dev] Standard library vs Standard distribution?

2018-11-30 Thread Steven D'Aprano
On Fri, Nov 30, 2018 at 01:45:17AM +, Oscar Benjamin wrote: > They do include much more than we need so I'd agree that Anaconda is a > nuclear reactor. The things I want from it are not though. Numpy is > not a nuclear reactor: at it's core it's just providing a > multidimensional array. And

Re: [Python-Dev] Compilation of "except FooExc as var" adds useless store

2019-01-06 Thread Steven D'Aprano
On Sun, Jan 06, 2019 at 01:10:48PM +0200, Paul Sokolovsky wrote: [...] > P.S. > I actually wanted to argue that such an implementation is hardly ideal > at all. Consider: > > > e = "my precious data" > try: > 1/0 > except Exception as e: > pass > > # Where's my *global* variable? >

Re: [Python-Dev] Compilation of "except FooExc as var" adds useless store

2019-01-06 Thread Steven D'Aprano
On Sun, Jan 06, 2019 at 03:03:03PM +0200, Paul Sokolovsky wrote: [...] > Ack. Such an explanation makes sense, though semantics behind it is > "magic". And given that variable deletion happens conditionally on > whether exception happened or not, it's still pretty strange. I don't think anyone *l

Re: [Python-Dev] python subprocess module to submit a list of slurm sbatch jobs, each job use multiprocessing.Pool to run simulation on single compute node in cluster

2019-01-07 Thread Steven D'Aprano
This mailing list is for the development of the Python interpreter, not for asking questions about your own code. Did you sign up using the Python-Dev mailing list website? At the top of the page, it says Do not post general Python questions to this list. For help with Python please se

Re: [Python-Dev] How can i insert more than 32K data to a column type clob in db2 using python programming

2019-01-08 Thread Steven D'Aprano
On Tue, Jan 08, 2019 at 01:35:29PM +0530, Aman Agrawal wrote: > Hi Team, > > I have tried to insert in clob data type more than 32k byte data but > getting error:- This mailing list is for the development of the Python interpreter, not for asking questions about your own code. Did you sign up u

[Python-Dev] ctypes: is it intentional that id() is the only way to get the address of an object?

2019-01-17 Thread Steven D'Aprano
Disclaimer: I'm not a ctypes expert, so I might have this completely wrong. If so, I apologise for the noise. The id() function is documented as returning an abstract ID number. In CPython, that happens to have been implemented as the address of the object. I understand that the only way to pa

Re: [Python-Dev] ctypes: is it intentional that id() is the only way to get the address of an object?

2019-01-18 Thread Steven D'Aprano
On Thu, Jan 17, 2019 at 11:37:13AM +0100, Antoine Pitrou wrote: I said: > > The id() function is documented as returning an abstract ID number. In > > CPython, that happens to have been implemented as the address of the > > object. > > > > I understand that the only way to pass the address of

Re: [Python-Dev] ctypes: is it intentional that id() is the only way to get the address of an object?

2019-01-18 Thread Steven D'Aprano
On Thu, Jan 17, 2019 at 04:48:38PM -0800, Gregory P. Smith wrote: > I've heard that libraries using ctypes, cffi, or cython code of various > sorts in the real world wild today does abuse the unfortunate side effect > of CPython's implementation of id(). I don't have specific instances of > this i

Re: [Python-Dev] ctypes: is it intentional that id() is the only way to get the address of an object?

2019-01-18 Thread Steven D'Aprano
Thanks for the detailed answer. A further question below. On Thu, Jan 17, 2019 at 07:50:51AM -0600, eryk sun wrote: > On 1/17/19, Steven D'Aprano wrote: > > > > I understand that the only way to pass the address of an object to > > ctypes is to use that id. Is that i

Re: [Python-Dev] ctypes: is it intentional that id() is the only way to get the address of an object?

2019-01-18 Thread Steven D'Aprano
On Thu, Jan 17, 2019 at 10:09:36PM -0800, Steve Dower wrote: > For everyone who managed to reply *hours* after Eryk Sun posted the > correct answer and still get it wrong, here it is again in full. Sorry, I'm confused by your response here. As far as I can see, nobody except Eryk Sun gave any tec

Re: [Python-Dev] Add more SyntaxWarnings?

2019-01-24 Thread Steven D'Aprano
On Thu, Jan 24, 2019 at 04:01:26PM -0600, Neil Schemenauer wrote: > On 2019-01-24, Terry Reedy wrote: > > Serhiy Storchaka suggested a compiler SyntaxWarning and uploaded a > > proof-of-concept diff that handled the above and many similar cases. > > I believe that in general we should give better

Re: [Python-Dev] Add more SyntaxWarnings?

2019-01-24 Thread Steven D'Aprano
At the cost of breaking threading a bit, I'm going to reply to a few different people in one post. On Fri, Jan 25, 2019 at 09:52:53AM +1100, Chris Angelico wrote: > On Fri, Jan 25, 2019 at 9:42 AM Steven D'Aprano wrote: > > We could say that implementations are allowed

Re: [Python-Dev] Another update for PEP 394 -- The "python" Command on Unix-Like Systems

2019-02-13 Thread Steven D'Aprano
ys on the Internet.) BUt even if representative, this survey only tells us what version people are using, now how they invoke it. We can't conclude that the command "python" means Python 3 for these users. We simply don't know one way or another (and I personally wo

Re: [Python-Dev] Another update for PEP 394 -- The "python" Command on Unix-Like Systems

2019-02-13 Thread Steven D'Aprano
l we know whether or not this FUD is widespread. Whatever we plan, we should allow for *both* a Python 3.10 and a Python 4, and then we'll be good even if 4.0 follows 3.12 :-) -- Steven ___ Python-Dev mailing list Python-Dev@python.org https://ma

Re: [Python-Dev] Compact ordered set

2019-02-28 Thread Steven D'Aprano
long-obsolete historical connection, I think the two types are unrelated and the behaviour of one has little or no implications for the behaviour of the other. "Cars have windows that you can open. Submarines should have the same. They're both vehicles, right?" -- Steven

Re: [Python-Dev] configparser: should optionxform be idempotent?

2019-03-07 Thread Steven D'Aprano
multiprocessing threading metaclass decorator comprehension futures etc mean. They're all "obscure jargon" terms to someone. The first time I came across "tuple", I had no idea what it meant (and in fact it took me many years to stop misspelling

Re: [Python-Dev] configparser: should optionxform be idempotent?

2019-03-07 Thread Steven D'Aprano
ortion of users, while also explaining the term for those who aren't familiar with it. We all win! -- Steven ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Using CLA assistant for Python contributions

2019-03-07 Thread Steven D'Aprano
: - the signing process is straight-forward and easy; - and supporting the legacy CLAs is particularly difficult; but if the existing CLAs haven't expired, haven't been revoked, and there's no legal reason why they are no longer in force, then why are you asking us to re-sign? I wil

Re: [Python-Dev] Using CLA assistant for Python contributions

2019-03-08 Thread Steven D'Aprano
ask that question (on the basis of why make things harder for > myself). But if it's needed, then fair enough. Because what you don't know can't hurt you? You're signing a legal document. Shouldn't you understand the implications

Re: [Python-Dev] Using CLA assistant for Python contributions

2019-03-08 Thread Steven D'Aprano
On Fri, Mar 08, 2019 at 10:58:00AM +, Paul Moore wrote: > On Fri, 8 Mar 2019 at 10:39, Steven D'Aprano wrote: > > > > On Fri, Mar 08, 2019 at 07:25:37AM +, Paul Moore wrote: > > > > > PS I would also prefer not to have to re-sign, but just have my >

Re: [Python-Dev] (Licensing question) backport of shutil.copyfile() functionality

2019-03-12 Thread Steven D'Aprano
ributors assign their copyright in the contribution to him. But that may discourage contributors. But since Giampaolo seems to be thinking of using the MIT licence, the point may be moot :-) -- Steven ___ Python-Dev mailing list Python-Dev@python.org ht

Re: [Python-Dev] int() and math.trunc don't accept objects that only define __index__

2019-03-14 Thread Steven D'Aprano
flow, and always forget that it can raise. py> float("9e") inf py> float(str(9*10**)) inf But: py> float(9*10**) Traceback (most recent call last): File "", line 1, in OverflowError: int too large to conve

Re: [Python-Dev] Remove tempfile.mktemp()

2019-03-20 Thread Steven D'Aprano
then there ought to be a way to set the entropy used. But I think the default secrets entropy is fine, and its better to have longer names than shorter ones, within reason. I don't think 40-50 characters (plus any prefix or suffix) is excessive for a temporary

Re: [Python-Dev] Remove tempfile.mktemp()

2019-03-20 Thread Steven D'Aprano
rfaces" and I'm still vulnerable to an Advanced Persistent Threat that has compromised the OS specifically to target my application. If the attacker controls the OS or the hardware, then effectively they've already won. -- Steven ___ Python-D

Re: [Python-Dev] Replacement for array.array('u')?

2019-03-22 Thread Steven D'Aprano
40, 1107361792]) Getting the string out again is no harder: py> bytes(a).decode('utf-32be') 'ℍℰâѵÿ Ϻεταł' But having said that, it would be nice to have an array code which treated the values as single UTF-32 characters: array('?', [&#

Re: [Python-Dev] (no subject)

2019-04-10 Thread Steven D'Aprano
, I presume you signed up to this mailing list via the web interface at https://mail.python.org/mailman/listinfo/python-dev Is there something we could do to make it more clear that this is not the right place to ask for help? -- Steven ___ Python

Re: [Python-Dev] Proposal: dict.with_values(iterable)

2019-04-22 Thread Steven D'Aprano
; it all happens by magic, behind the scenes. I think the proposal here is to add some sort of interface, possibly a new method, to explicitly use key sharing. -- Steven ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org

Re: [Python-Dev] Unicode identifiers in test files?

2019-05-03 Thread Steven D'Aprano
ot;Look, that's why there's rules, understand? So that you *think* before you break 'em." -- Terry Pratchett, "The Thief Of Time" -- Steven ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.or

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

2019-05-07 Thread Steven D'Aprano
s and lead to silent failure: py> class Y: ... def __eq__(self, other): ... raise NotImplementedError ... py> 123 == Y() Traceback (most recent call last): File "", line 1, in File "", line 3, in __eq__ NotImplementedError Hope this helps. -- Steven

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

2019-05-07 Thread Steven D'Aprano
emented is a very common bug in third-party code. I've written heaps of classes that wrongly force a False result. But I've learned better and don't do it any more :-) -- Steven ___ Python-Dev mailing list Python-Dev@python.org http

Re: [Python-Dev] Easier debugging with f-strings

2019-05-07 Thread Steven D'Aprano
don't have a better suggestion, sorry. In an earlier draft, back when this was spelled !d, you specifically talked about whitespace. Does this still apply? spam = 42 f'{spam=}' # returns 'spam=42' f'{spam =}' # return

Re: [Python-Dev] Adding a toml module to the standard lib?

2019-05-15 Thread Steven D'Aprano
ctober/054101.html It isn't very long (only about a dozen or so quite short posts) but you probably ought to be at least familiar with it, and if possibly respond to any opposing comments. Thanks, -- Steven ___ Python-Dev mailing list

Re: [Python-Dev] Adding a toml module to the standard lib?

2019-05-15 Thread Steven D'Aprano
On Wed, May 15, 2019 at 09:35:16PM +1000, Steven D'Aprano wrote: > It isn't very long (only about a dozen or so quite short posts) but you > probably ought to be at least familiar with it, and if possibly respond > to any opposing comments. Sorry, to clarify, I don't me

Re: [Python-Dev] Parser module in the stdlib

2019-05-20 Thread Steven D'Aprano
On Mon, May 20, 2019 at 08:55:59AM -0700, Guido van Rossum wrote: > I am interested in switching CPython's parsing strategy to something else > (what exactly remains to be seen) Are you re-thinking the restriction to LL(1) grammars?

Re: [Python-Dev] PEP 594: Removing dead batteries from the standard library

2019-05-21 Thread Steven D'Aprano
esy, but honestly, "just install it from PyPI" is not friendly to beginners or those who just want something that works without a load of extra complexity. -- Steven ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] PEP 594: Removing dead batteries from the standard library

2019-05-22 Thread Steven D'Aprano
tributing features to a module, that's a good sign that it *is* in use and isn't dead and we shouldn't remove it. It seems perverse to say "we ought to remove this module because nobody is maintaining it" and then reject attempts to maintain it! You'll

Re: [Python-Dev] PEP 594: Removing dead batteries from the standard library

2019-05-22 Thread Steven D'Aprano
n obsolete format that even Windows email stopped using. I think the presence of that is somewhat ironic on a thread arguing that we ought to remove working modules for obsolete formats. -- Steven ___ Python-Dev mailing list Python-Dev@python

Re: [Python-Dev] PEP 594: Removing dead batteries from the standard library

2019-05-22 Thread Steven D'Aprano
al and can be > parsed with a few lines of code. There is no need to use spwd. so I think you're undercutting your own argument. If reading from /etc/shadow is such a bad thing that we must remove it, why tell people that they can parse it themselves? Not that we could stop the

Re: [Python-Dev] PEP 594: Removing dead batteries from the standard library

2019-05-22 Thread Steven D'Aprano
ll have to download them, giving more opportunity for typo-squatter attacks. -- Steven ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] PEP 594: Removing dead batteries from the standard library

2019-05-22 Thread Steven D'Aprano
On Tue, May 21, 2019 at 01:59:56PM -0400, Terry Reedy wrote: > On 5/21/2019 9:01 AM, Steven D'Aprano wrote: > ... > >Many Python users don't have the privilege of being able to install > >arbitrary, unvetted packages from PyPI. They get to use only packages > >fr

Re: [Python-Dev] PEP 594: Removing dead batteries from the standard library

2019-05-22 Thread Steven D'Aprano
On Wed, May 22, 2019 at 01:31:18PM +0200, Christian Heimes wrote: > On 22/05/2019 12.19, Steven D'Aprano wrote: > > I don't think this PEP should become a document about "Why you should > > use PAM". I appreciate that from your perspective as a Red Hat security

Re: [Python-Dev] PEP 594: update 1

2019-05-23 Thread Steven D'Aprano
se "with". So by my count, in 12 years since Guido's frustrated comment about binhex, it has seen: - removal of an obsolete and ambiguous comment from the source code; - addition of a few with blocks to modernise file handling; - one enhancement request

[Python-Dev] PEP 594 - a proposal for unmaintained modules

2019-05-23 Thread Steven D'Aprano
break modules that currently aren't broken. Thoughts? -- Steven ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] PEP 558: Defined semantics for locals()

2019-05-26 Thread Steven D'Aprano
mo(): ... a = locals() ... b = locals() ... print(a is b) ... py> demo() True -- Steven ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/option

Re: [Python-Dev] [SPAM?] Re: PEP 558: Defined semantics for locals()

2019-05-26 Thread Steven D'Aprano
cal variables; - the dict returned isn't a fixed snapshot, but the PEP calls it a snapshot despite not being one (naming things is hard); - the "snapshop" can change as a side-effect of another operation. If this wasn't already the behaviour, would we want it? -- Steven

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