[Python-ideas] Re: More efficient list copying

2021-10-05 Thread Gregory P. Smith
On Sat, Oct 2, 2021, 10:20 PM Christopher Barker wrote: > > But sure, if we can eliminate inefficiencies in Python standard data > types, then why not? > Because the C implementation becomes hard to maintain. All of our linear containers could benefit from non-linear implementations in some sce

[Python-ideas] Re: Improving sys.executable for embedded Python scenarios

2021-05-01 Thread Gregory P. Smith
On Sat, May 1, 2021 at 10:49 AM Gregory Szorc wrote: > The way it works today, if you have an application embedding Python, your > sys.argv[0] is (likely) your main executable and sys.executable is probably > None or the empty string (per the stdlib docs which say not to set > sys.executable if t

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread Gregory P. Smith
Given I've never even heard of Strunk & White (my own privilege i'd assume)... yeah. I don't actually know what the existing "When writing English, follow Strunk and White." text in PEP-8 even means. It doesn't hyperlink to an online source for English style probably because this was written so l

[Python-ideas] Re: Bringing the print statement back

2020-06-09 Thread Gregory P. Smith
On Tue, Jun 9, 2020 at 5:49 PM Naomi Ceder wrote: > FWIW... > > As someone who has spent at least the last 5 years trying (unsuccessfully) > to reprogram 15 years of muscle memory of print as a statement, I vote +1 > to print without parens. > > As someone who teaches Python and groans at explain

[Python-ideas] Re: Live variable analysis -> earlier release?

2020-04-09 Thread Gregory P. Smith
On Wed, Apr 8, 2020, 10:37 AM Antoine Pitrou wrote: > On Wed, 8 Apr 2020 10:18:47 -0700 > Guido van Rossum wrote: > > > > > But when I leave "large" temp objects hanging and > > > give a rip, I already stick in "del" statements anyway. Very rarely, > > > but it happens. > > > > > > > I recall t

[Python-ideas] Re: Live variable analysis -> earlier release?

2020-04-08 Thread Gregory P. Smith
On Wed, Apr 8, 2020 at 10:21 AM Guido van Rossum wrote: > On Wed, Apr 8, 2020 at 10:05 AM Alex Hall wrote: > >> This would break uses of locals(), e.g. >> > > Hm, okay, so suppose the code analysis was good enough to recognize most > un-obfuscated uses of locals(), exec() and eval() (and presuma

[Python-ideas] Re: Really long ints

2020-02-04 Thread Gregory P. Smith
On Tue, Feb 4, 2020 at 3:29 AM Chris Angelico wrote: > > Another one to throw into the mix: Trailing underscores, but only if > the expression is incomplete. So in simple cases like this, that means > parenthesizing the number: > > P = (29674495668685510550154174642905332730771991_ > 7998

[Python-ideas] Re: Allow Path object instances in subprocess.Popen

2019-11-03 Thread Gregory P. Smith
On Sun, Nov 3, 2019 at 12:33 AM Brendan Barnwell wrote: > On 2019-11-03 00:02, Eric V. Smith wrote: > > On 11/2/2019 10:02 PM, Jonathan Goble wrote: > >> So there's no reason in that regard to not allow it, and I'm +1 on the > idea. > > > > I disagree. I don't think there's precedent in Python fo

[Python-ideas] Re: Make itertools recipes license easier

2019-10-24 Thread Gregory P. Smith
On Thu, Oct 24, 2019 at 3:21 PM Guido van Rossum wrote: > OK, let's see if we can do CC0. Todd, do you want to read through the link > Steven gave and find out how we should apply this, either to just the > itertools examples, or possibly to all examples in the docs? > Obviously all examples in

[Python-ideas] Re: Add __slots__ to dataclasses to use less than half as much RAM

2019-09-27 Thread Gregory P. Smith
On Fri, Sep 27, 2019 at 5:21 PM Guido van Rossum wrote: > On Fri, Sep 27, 2019 at 11:18 AM Serhiy Storchaka > wrote: > >> I think it needs an explicit support in the type creation machinery (as >> __slots__ itself has) to support descriptors and slots with the same name. >> > > That would be tou

Re: [Python-ideas] Improve os.times() resolution

2019-03-24 Thread Gregory P. Smith
On Sun, Mar 24, 2019 at 5:16 AM Giampaolo Rodola' wrote: > It turns out we could use resource.getrusage() which provides micro > seconds (tested on Linux and macOS): > > import os, resource > for x in range(1000): # warm up > pass > for x in range(5): > a = os.tim

Re: [Python-ideas] Add subprocess.Popen suspend() and resume()

2019-03-24 Thread Gregory P. Smith
I don't think this belongs in subprocess. It isn't related to processes creation. A module on PyPI with the Windows code would make more sense. On Wed, Mar 20, 2019 at 3:19 PM eryk sun wrote: > On 3/18/19, Giampaolo Rodola' wrote: > > > > I've been having these 2 implemented in psutil for a l

Re: [Python-ideas] Enabling / disabling optional type hinting

2019-03-23 Thread Gregory P. Smith
On Sat, Mar 23, 2019 at 11:00 AM Stefan Krah wrote: > On Sat, Mar 23, 2019 at 10:37:43AM -0700, Gregory P. Smith wrote: > > A useless statement like that isn't likely to be typed. I've never seen > > anyone do that. > > Unlikely yes, but ideally type annot

Re: [Python-ideas] Enabling / disabling optional type hinting

2019-03-23 Thread Gregory P. Smith
On Sat, Mar 23, 2019 at 7:37 AM Andre Roberge wrote: > Consider the following example [1]: > > Python 3.7.0 (v3.7.0:1bf9cc5093... > >>> d = { > ... "injury": "flesh wound" > ... } > >>> d["answer"]: 42 > >>> if "answer" in d: > ... print("Don't panic!") > ... else: > ... print(

Re: [Python-ideas] Why operators are useful

2019-03-16 Thread Gregory P. Smith
On Sat, Mar 16, 2019 at 5:02 AM Gustavo Carneiro wrote: > On Sat, 16 Mar 2019 at 10:33, Steven D'Aprano wrote: > >> On Fri, Mar 15, 2019 at 10:53:31PM +, MRAB wrote: >> >> > There was also the suggestion of having both << and >>. >> > >> > Actually, now that dicts are ordered, that would pro

Re: [Python-ideas] PEP 8 and long string literals

2019-02-25 Thread Gregory P. Smith
On Mon, Feb 25, 2019 at 2:05 AM INADA Naoki wrote: > I think long URL in comment or docstring is good reason to ignore > line length limit. > Yep, that's what we do in the yapf autoformatter. There's good reason too, source viewers and editors linkify URLs, if you break them across strings to f

Re: [Python-ideas] Add support for external annotations in the typing module

2019-01-17 Thread Gregory P. Smith
On Thu, Jan 17, 2019 at 2:34 PM Till wrote: > We started a discussion in https://github.com/python/typing/issues/600 > about adding support for extra annotations in the typing module. > > Since this is probably going to turn into a PEP I'm transferring the > discussion here to have more visibilit

Re: [Python-ideas] Using sha512 instead of md5 on python.org/downloads

2018-12-07 Thread Gregory P. Smith
On Fri, Dec 7, 2018 at 3:38 PM Steven D'Aprano wrote: > On Fri, Dec 07, 2018 at 01:25:19PM -0800, Nathaniel Smith wrote: > > > For this specific purpose, md5 is just as good as a proper hash. But all > > else being equal, it would still be better to use a proper hash, just so > > people don't hav

Re: [Python-ideas] anyone need a frozenset or bytearray literal?

2018-07-11 Thread Gregory P. Smith
tes, one could have (1,2,7,2).to_bytes() instead of >> bytes((1,2,7,2)) because b'\x01\x02\x07\x02' is long and boring. >> What about variables in the values {1,2,x}.freeze() should work too ? >> bytes((1,2,7,x)) is not writable as a b string and creates a copy. >> >&

Re: [Python-ideas] anyone need a frozenset or bytearray literal?

2018-07-11 Thread Gregory P. Smith
On Wed, Jul 11, 2018 at 4:45 PM Jelle Zijlstra wrote: > 2018-07-11 16:25 GMT-07:00 Gregory P. Smith : > >> Completely obvious what it does, but it irritates my aesthetic >> sensibilities every time I see: >> frozenset({spam, eggs}) >> >> Why? Because I assu

[Python-ideas] anyone need a frozenset or bytearray literal?

2018-07-11 Thread Gregory P. Smith
Completely obvious what it does, but it irritates my aesthetic sensibilities every time I see: frozenset({spam, eggs}) Why? Because I assume under the hood that creates a set of spam and eggs before calling frozenset to copy it into a new frozenset object before the original set is garbage colle

Re: [Python-ideas] Secure string disposal (maybe other inmutable seq types too?)

2018-06-23 Thread Gregory P. Smith
On Sat, Jun 23, 2018 at 12:57 PM Christian Heimes wrote: > > If you need to protect sensitive data like private keys, then don't load > them into memory of your current process. It's that simple. :) Bugs like > heartbleed were an issue, because private key were in the same process > space as the

Re: [Python-ideas] Spelling of Assignment Expressions PEP 572 (was post #4)

2018-04-16 Thread Gregory P. Smith
On Mon, Apr 16, 2018 at 11:11 AM Ned Batchelder wrote: > On 4/16/18 1:42 PM, Chris Angelico wrote: > > 3) "expr -> name" ==> The information went data way. > > > > So either you take a parallel from elsewhere in Python syntax, or you > > take a hopefully-intuitive dataflow mnemonic symbol. Take y

Re: [Python-ideas] Move optional data out of pyc files

2018-04-10 Thread Gregory P. Smith
On Tue, Apr 10, 2018 at 12:51 PM Eric V. Smith wrote: > > >> 3. Annotations. They are used mainly by third party tools that > >> statically analyze sources. They are rarely used at runtime. > > > > Even less used than docstrings probably. > > typing.NamedTuple and dataclasses use annotations at r

Re: [Python-ideas] Disallow importing the same module under multiple names

2018-03-19 Thread Gregory P. Smith
On Thu, Mar 15, 2018 at 3:26 AM Nick Coghlan wrote: > On 14 March 2018 at 15:20, Chris Billington > wrote: >> >> I wonder if there's any reason something like this shouldn't be built >> into Python's default import system. >> > > There are two main challenges with enforcing such a check, one aff

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings

2018-02-27 Thread Gregory P. Smith
On Tue, Feb 27, 2018 at 2:35 PM Chris Angelico wrote: > This is a suggestion that comes up periodically here or on python-dev. > This proposal introduces a way to bind a temporary name to the value > of an expression, which can then be used elsewhere in the current > statement. > > The nicely-ren

Re: [Python-ideas] A proliferation of (un-)Pythonically programmatic pragmas

2017-11-13 Thread Gregory P. Smith
fwiw, we're going to need the tool name in any pragma anyways so the existing thing that should be common is: # tool-name: meaningfultoken It seems like the only convention that makes sense to me. When I saw your flake8 example of "# noqa: F401" I wanted to rip my eyes out. Because it didn't men

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-21 Thread Gregory P. Smith
Neil, you might also bring this up on the http://lists.idyll.org/listinfo/testing-in-python list as I suspect people there have opinions on this topic. -gps On Mon, Aug 21, 2017 at 9:07 AM Ned Batchelder wrote: > On 8/20/17 9:32 PM, Neil Girdhar wrote: > > This question describes an example of

Re: [Python-ideas] Data Classes (was: Re: JavaScript-Style Object Creation in Python (using a constructor function instead of a class to create objects))

2017-07-12 Thread Gregory P. Smith
On Thu, May 18, 2017 at 6:38 PM Eric V. Smith wrote: > On 5/18/17 2:26 PM, Sven R. Kunze wrote: > > On 17.05.2017 23:29, Ivan Levkivskyi wrote: > >> the idea is to write it into a PEP and consider API/corner > >> cases/implementation/etc. > > > > Who's writing it? > > Guido, Hynek, and I met toda

Re: [Python-ideas] Security: remove "." from sys.path?

2017-06-05 Thread Gregory P. Smith
On Mon, Jun 5, 2017 at 10:52 AM Chris Barker wrote: > On Mon, Jun 5, 2017 at 3:55 AM, Victor Stinner > wrote: > >> A minimum change would be to add the (empty string) at the end of >> sys.path in Python 3.7 rather than adding it at the start. >> >> It would increase Python usability since it avo

Re: [Python-ideas] Fused multiply-add (FMA)

2017-01-17 Thread Gregory P. Smith
Makes sense, thanks! math.fma() it is. :) On Tue, Jan 17, 2017, 7:48 AM Stephan Houben wrote: > Hi Xavier, > > In this bright age of IEEE-754 compatible CPUs, > it is certainly possible to achieve reproducible FP. > I worked for a company whose software produced bit-identical > results on vario

Re: [Python-ideas] Fused multiply-add (FMA)

2017-01-16 Thread Gregory P. Smith
Is there a good reason not to detect single expression multiply adds and just emit a new FMA bytecode? Is our goal for floats to strictly match the result of the same operations coded in unoptimized C using doubles? Or can we be more precise on occasion? I guess a similar question may be asked o

Re: [Python-ideas] api suggestions for the cProfile module

2017-01-10 Thread Gregory P. Smith
At a glance, all of these sound like good modernizing enhancements for cprofile. It just takes someone to contribute the work. :) On Tue, Jan 10, 2017, 8:57 AM Ethan Furman wrote: > On 01/10/2017 08:36 AM, Thane Brimhall wrote: > > > Does anyone have thoughts on this topic? I assume the silence