Re: [Python-ideas] Support parsing stream with `re`

2018-10-08 Thread Erik Bray
On Mon, Oct 8, 2018 at 12:20 PM Cameron Simpson wrote: > > On 08Oct2018 10:56, Ram Rachum wrote: > >That's incredibly interesting. I've never used mmap before. > >However, there's a problem. > >I did a few experiments with mmap now, this is the latest: > > > >path = pathlib.Path(r'P:\huge_file')

Re: [Python-ideas] support toml for pyproject support

2018-10-08 Thread Erik Bray
On Mon, Oct 8, 2018 at 12:23 PM Nathaniel Smith wrote: > > On Mon, Oct 8, 2018 at 2:55 AM, Steven D'Aprano wrote: > > > > On Mon, Oct 08, 2018 at 09:10:40AM +0200, Jimmy Girardet wrote: > >> Each tool which wants to use pyproject.toml has to add a toml lib as a > >> conditional or hard dependenc

Re: [Python-ideas] Asynchronous exception handling around with/try statement borders

2018-09-24 Thread Erik Bray
On Fri, Sep 21, 2018 at 12:58 AM Chris Angelico wrote: > > On Fri, Sep 21, 2018 at 8:52 AM Kyle Lahnakoski > wrote: > > Since the java.lang.Thread.stop() "debacle", it has been obvious that > > stopping code to run other code has been dangerous. KeyboardInterrupt > > (any interrupt really) is d

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

2018-04-11 Thread Erik Bray
On Tue, Apr 10, 2018 at 9:50 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 runtim

Re: [Python-ideas] PEP proposal: unifying function/method classes

2018-03-28 Thread Erik Bray
On Fri, Mar 23, 2018 at 11:25 AM, Antoine Pitrou wrote: > On Fri, 23 Mar 2018 07:25:33 +0100 > Jeroen Demeyer wrote: > >> On 2018-03-23 00:36, Antoine Pitrou wrote: >> > It does make sense, since the proposal sounds ambitious (and perhaps >> > impossible without breaking compatibility). >> >> Wel

[Python-ideas] importlib: making FileFinder easier to extend

2018-02-07 Thread Erik Bray
Hello, Brief problem statement: Let's say I have a custom file type (say, with extension .foo) and these .foo files are included in a package (along with other Python modules with standard extensions like .py and .so), and I want to make these .foo files importable like any other module. On its f

Re: [Python-ideas] Is there a reason some of the PyLong_As* functions don't call an object's __int__?

2017-12-29 Thread Erik Bray
On Thu, Dec 28, 2017 at 8:42 PM, Serhiy Storchaka wrote: > 28.12.17 12:10, Erik Bray пише: >> >> There's no index() alternative to int(). > > > operator.index() Okay, and it's broken. That doesn't change my other point that some functions that could p

Re: [Python-ideas] Is there a reason some of the PyLong_As* functions don't call an object's __int__?

2017-12-28 Thread Erik Bray
On Fri, Dec 8, 2017 at 7:20 PM, Ethan Furman wrote: > On 12/08/2017 04:33 AM, Erik Bray wrote: > >> More importantly not as many objects that coerce to int actually >> implement __index__. They probably *should* but there seems to be >> some confusion about how that

Re: [Python-ideas] Is there a reason some of the PyLong_As* functions don't call an object's __int__?

2017-12-08 Thread Erik Bray
On Fri, Dec 8, 2017 at 1:52 PM, Antoine Pitrou wrote: > On Fri, 8 Dec 2017 14:30:00 +0200 > Serhiy Storchaka > wrote: >> >> NumPy integers implement __index__. > > That doesn't help if a function calls e.g. PyLong_AsLongAndOverflow(). Right--pointing to __index__ basically implies that PyIndex_C

Re: [Python-ideas] Is there a reason some of the PyLong_As* functions don't call an object's __int__?

2017-12-08 Thread Erik Bray
On Fri, Dec 8, 2017 at 12:26 PM, Serhiy Storchaka wrote: > 08.12.17 12:41, Erik Bray пише: >> >> IIUC, it seems to be carry-over from Python 2's PyLong API, but I >> don't see an obvious reason for it. In every case there's an explicit >> PyLong_C

[Python-ideas] Is there a reason some of the PyLong_As* functions don't call an object's __int__?

2017-12-08 Thread Erik Bray
IIUC, it seems to be carry-over from Python 2's PyLong API, but I don't see an obvious reason for it. In every case there's an explicit PyLong_Check first anyways, so not calling __int__ doesn't help for the common case of exact int objects; adding the fallback costs nothing in that case. I ran i

Re: [Python-ideas] install pip packages from Python prompt

2017-11-04 Thread Erik Bray
On Nov 4, 2017 08:31, "Stephen J. Turnbull" < turnbull.stephen...@u.tsukuba.ac.jp> wrote: Erik Bray writes: > Nope. I totally get that they don’t know what a shell or command prompt > is. THEY. NEED. TO. LEARN. Just to be clear I did not write this. Someone replying

Re: [Python-ideas] install pip packages from Python prompt

2017-11-02 Thread Erik Bray
On Oct 30, 2017 8:57 PM, "Alex Walters" wrote: > -Original Message- > From: Python-ideas [mailto:python-ideas-bounces+tritium- > list=sdamon@python.org] On Behalf Of Erik Bray > Sent: Monday, October 30, 2017 6:28 AM > To: Python-Ideas > Subject: Re

Re: [Python-ideas] install pip packages from Python prompt

2017-10-30 Thread Erik Bray
On Mon, Oct 30, 2017 at 11:27 AM, Erik Bray wrote: > On Sun, Oct 29, 2017 at 8:45 PM, Alex Walters wrote: >> Then those users have more fundamental problems. There is a minimum level >> of computer knowledge needed to be successful in programming. Insulating >> users fr

Re: [Python-ideas] install pip packages from Python prompt

2017-10-30 Thread Erik Bray
On Sun, Oct 29, 2017 at 8:45 PM, Alex Walters wrote: > Then those users have more fundamental problems. There is a minimum level > of computer knowledge needed to be successful in programming. Insulating > users from the reality of the situation is not preparing them to be > successful. Pretend

Re: [Python-ideas] + operator on generators

2017-06-30 Thread Erik Bray
On Fri, Jun 30, 2017 at 1:09 AM, Jan Kaliszewski wrote: > 2017-06-25 Serhiy Storchaka dixit: > >> 25.06.17 15:06, lucas via Python-ideas пише: > >> > I often use generators, and itertools.chain on them. >> > What about providing something like the following: >> > >> > a = (n for n in range(2

Re: [Python-ideas] Asynchronous exception handling around with/try statement borders

2017-06-28 Thread Erik Bray
On Wed, Jun 28, 2017 at 3:19 PM, Greg Ewing wrote: > Erik Bray wrote: >> >> At this point a potentially >> waiting SIGINT is handled, resulting in KeyboardInterrupt being raised >> while inside the with statement's suite, and finally block, and hence >> Loc

Re: [Python-ideas] Asynchronous exception handling around with/try statement borders

2017-06-28 Thread Erik Bray
On Wed, Jun 28, 2017 at 3:09 PM, Erik Bray wrote: > On Wed, Jun 28, 2017 at 2:26 PM, Nick Coghlan wrote: >> On 28 June 2017 at 21:40, Erik Bray wrote: >>> My colleague's contention is that given >>> >>> lock = threading.Lock() >>> >>

Re: [Python-ideas] Asynchronous exception handling around with/try statement borders

2017-06-28 Thread Erik Bray
On Wed, Jun 28, 2017 at 2:26 PM, Nick Coghlan wrote: > On 28 June 2017 at 21:40, Erik Bray wrote: >> My colleague's contention is that given >> >> lock = threading.Lock() >> >> this is simply *wrong*: >> >> lock.acquire() >> tr

[Python-ideas] Asynchronous exception handling around with/try statement borders

2017-06-28 Thread Erik Bray
Hi folks, I normally wouldn't bring something like this up here, except I think that there is possibility of something to be done--a language documentation clarification if nothing else, though possibly an actual code change as well. I've been having an argument with a colleague over the last cou

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Erik Bray
On Fri, Jun 2, 2017 at 7:52 AM, Greg Ewing wrote: > Victor Stinner wrote: >> >> How do you write π (pi) with a keyboard on Windows, Linux or macOS? > > > On a Mac, π is Option-p and ∑ is Option-w. I don't have a strong opinion about it being in the stdlib, but I'd also point out that a strong adv

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-30 Thread Erik Bray
On Fri, Dec 30, 2016 at 5:05 PM, Nick Coghlan wrote: > On 29 December 2016 at 22:12, Erik Bray wrote: >> >> 1) CPython's TLS: Defines -1 as an uninitialized key (by fact of the >> implementation--that the keys are integers starting from zero) >> 2) pthreads: Do

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-29 Thread Erik Bray
On Wed, Dec 21, 2016 at 5:07 PM, Nick Coghlan wrote: > On 21 December 2016 at 20:01, Erik Bray wrote: >> >> On Wed, Dec 21, 2016 at 2:10 AM, Nick Coghlan wrote: >> > Option 2: Similar to option 1, but using a custom type alias, rather >> > than >> &g

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-21 Thread Erik Bray
On Wed, Dec 21, 2016 at 11:01 AM, Erik Bray wrote: > That all sounds good--between the two option 2 looks a bit more explicit. > > Though what about this? Rather than adding another type, the original > proposal could be changed slightly so that Py_tss_t *is* partially > defi

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-21 Thread Erik Bray
On Wed, Dec 21, 2016 at 2:10 AM, Nick Coghlan wrote: > On 21 December 2016 at 01:35, Masayuki YAMAMOTO > wrote: >> >> 2016-12-20 22:30 GMT+09:00 Erik Bray : >>> >>> This is probably an implementation detail, but ISTM that even with >>> PyThread_call

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-20 Thread Erik Bray
On Tue, Dec 20, 2016 at 9:26 AM, Nick Coghlan wrote: > On 20 December 2016 at 00:53, Erik Bray wrote: >> >> On Mon, Dec 19, 2016 at 3:45 PM, Erik Bray wrote: >> >> Likewise - we know the status quo isn't right, and the proposed change >> >> addresses

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-19 Thread Erik Bray
On Mon, Dec 19, 2016 at 3:45 PM, Erik Bray wrote: > On Mon, Dec 19, 2016 at 1:11 PM, Nick Coghlan wrote: >> On 17 December 2016 at 03:51, Antoine Pitrou wrote: >>> >>> On Fri, 16 Dec 2016 13:07:46 +0100 >>> Erik Bray wrote: >>> > Greetings al

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-19 Thread Erik Bray
On Mon, Dec 19, 2016 at 1:11 PM, Nick Coghlan wrote: > On 17 December 2016 at 03:51, Antoine Pitrou wrote: >> >> On Fri, 16 Dec 2016 13:07:46 +0100 >> Erik Bray wrote: >> > Greetings all, >> > >> > I wanted to bring attention to an issue that&

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-19 Thread Erik Bray
On Sat, Dec 17, 2016 at 8:21 AM, Stephen J. Turnbull wrote: > Erik Bray writes: > > > Abstract > > > > > > The proposal is to add a new Thread Local Storage (TLS) API to CPython > > which would supersede use of the existing TLS API within

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-19 Thread Erik Bray
On Sun, Dec 18, 2016 at 12:10 AM, Masayuki YAMAMOTO wrote: > 2016-12-17 18:35 GMT+09:00 Stephen J. Turnbull > : >> >> I don't understand this. I assume that there are no such platforms >> supported at present. I would think that when such a platform becomes >> supported, code supporting "key" fu

[Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-16 Thread Erik Bray
Greetings all, I wanted to bring attention to an issue that's been languishing on the bug tracker since last year, which I think would best be addressed by changes to CPython's C-API. The original issue is at http://bugs.python.org/issue25658, but I have made an effort below in a sort of proto-PE

Re: [Python-ideas] PEP8 dictionary indenting addition

2016-10-11 Thread Erik Bray
On Sun, Oct 9, 2016 at 2:25 AM, Steven D'Aprano wrote: > On Sat, Oct 08, 2016 at 09:26:13PM +0200, Jelte Fennema wrote: >> I have an idea to improve indenting guidelines for dictionaries for better >> readability: If a value in a dictionary literal is placed on a new line, it >> should have (or at

Re: [Python-ideas] if-statement in for-loop

2016-09-27 Thread Erik Bray
On Tue, Sep 27, 2016 at 5:33 PM, Nick Coghlan wrote: > On 28 September 2016 at 00:55, Erik Bray wrote: >> On Sun, Sep 11, 2016 at 12:28 PM, Bernardo Sulzbach >> wrote: >>> On 09/11/2016 06:36 AM, Dominik Gresch wrote: >>>> >>>> So I asked

Re: [Python-ideas] if-statement in for-loop

2016-09-27 Thread Erik Bray
On Sun, Sep 11, 2016 at 12:28 PM, Bernardo Sulzbach wrote: > On 09/11/2016 06:36 AM, Dominik Gresch wrote: >> >> So I asked myself if a syntax as follows would be possible: >> >> for i in range(10) if i != 5: >> body >> >> Personally, I find this extremely intuitive since this kind of >> if-st

Re: [Python-ideas] real numbers with SI scale factors

2016-08-31 Thread Erik Bray
. Point being nothing about this particular feature requires special support from the language, unless I'm missing something obvious. And given that Astropy (or any other units library) is third-party chances are a feature like this will land in place a lot faster than it has any chanc

Re: [Python-ideas] A proposal to rename the term "duck typing"

2016-08-29 Thread Erik Bray
On Sun, Aug 28, 2016 at 7:41 PM, Bruce Leban wrote: > > > On Sunday, August 28, 2016, ROGER GRAYDON CHRISTMAN wrote: >> >> >> We have a term in our lexicon "duck typing" that traces its origins, in >> part to a quote along the lines of >> "If it walks like a duck, and talks like a duck, ..." >> >

Re: [Python-ideas] real numbers with SI scale factors

2016-08-29 Thread Erik Bray
On Mon, Aug 29, 2016 at 3:05 PM, Erik Bray wrote: > On Mon, Aug 29, 2016 at 9:07 AM, Ken Kundert > wrote: >> On Mon, Aug 29, 2016 at 01:45:20PM +1000, Steven D'Aprano wrote: >>> On Sun, Aug 28, 2016 at 08:26:38PM -0700, Brendan Barnwell wrote: >>> >

Re: [Python-ideas] real numbers with SI scale factors

2016-08-29 Thread Erik Bray
On Mon, Aug 29, 2016 at 9:07 AM, Ken Kundert wrote: > On Mon, Aug 29, 2016 at 01:45:20PM +1000, Steven D'Aprano wrote: >> On Sun, Aug 28, 2016 at 08:26:38PM -0700, Brendan Barnwell wrote: >> > On 2016-08-28 18:44, Ken Kundert wrote: >> > >When working with a general purpose programming language, t