Re: [Python-ideas] Make partial a built-in

2016-09-19 Thread Stefan Behnel
אלעזר schrieb am 19.09.2016 um 17:59: > If at all, it should be function.bind(). It was discussed and dropped; I > don't remember why, but one problem is that it looks like an in-place > modification. IMHO, the main drawback of that solution is that it only works for functions and not for any

Re: [Python-ideas] PEP: Hide implementation details in the C API

2017-07-12 Thread Stefan Behnel
Victor Stinner schrieb am 11.07.2017 um 12:19: > Split the ``Include/`` directory of CPython: > > * ``python`` API: ``Include/Python.h`` remains the default C API > * ``core`` API: ``Include/core/Python.h`` is a new C API designed for > building Python > * ``stable`` API:

Re: [Python-ideas] Generator syntax hooks?

2017-08-08 Thread Stefan Behnel
Soni L. schrieb am 08.08.2017 um 01:56: > On 2017-08-07 08:35 PM, Steven D'Aprano wrote: >> Hi Soni, and welcome! >> >> On Mon, Aug 07, 2017 at 04:30:05PM -0300, Soni L. wrote: >> >>> What if, (x for x in integers if 1000 <= x < 100), was syntax sugar >>> for (x for x in range(1000, 100))?

Re: [Python-ideas] PEP 550 v2

2017-08-18 Thread Stefan Behnel
Nathaniel Smith schrieb am 16.08.2017 um 09:18: > On Tue, Aug 15, 2017 at 4:55 PM, Yury Selivanov wrote: >> Here's the PEP 550 version 2. > Awesome! +1 >> Backwards Compatibility >> === >> >> This proposal preserves 100% backwards compatibility. > > While this is mostly true

Re: [Python-ideas] Make map() better

2017-09-13 Thread Stefan Behnel
Jason H schrieb am 13.09.2017 um 17:54: > I'm rather surprised that there isn't a Iterable class which dict and list > derive from. > If that were added to just dict and list, I think it would cover 98% of > cases, and adding Iterable would be reasonable in the remaining scenarios. Would you

Re: [Python-ideas] Add time.time_ns(): system clock with nanosecond resolution

2017-10-15 Thread Stefan Behnel
Nick Coghlan schrieb am 14.10.2017 um 17:46: > On 14 October 2017 at 18:21, Antoine Pitrou wrote: >> On Sat, 14 Oct 2017 10:49:11 +0300 >> Serhiy Storchaka wrote: >>> I don't like the idea of adding a parallel set of functions. >>> >>> In the list of alternatives in PEP 410 there is no an idea

Re: [Python-ideas] Add time.time_ns(): system clock with nanosecond resolution

2017-10-13 Thread Stefan Behnel
Victor Stinner schrieb am 13.10.2017 um 16:12: > I would like to add new functions to return time as a number of > nanosecond (Python int), especially time.time_ns(). I might have missed it while skipping through your post, but could you quickly explain why improving the precision of time.time()

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread Stefan Behnel
Ryan Gonzalez schrieb am 11.09.2017 um 19:16: > One thing I want to point out: there are a lot of really useful Python > libraries that have come to rely on annotations being objects, ranging > from plac to fbuild to many others. I could understand something that > delays the evaluation of

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-12 Thread Stefan Behnel
Lukasz Langa schrieb am 11.09.2017 um 21:25: > I remember mostly Stefan Behnel's concerns about Cython's annotations, I'm currently reimplementing the annotation typing in Cython to be compatible with PEP-484, so that concern is pretty much out of the way. This PEP still has an impact on Cython,

Re: [Python-ideas] OT: slowing rotation [was: High Precision datetime]

2018-05-18 Thread Stefan Behnel
Greg Ewing schrieb am 18.05.2018 um 10:05: > Ethan Furman wrote: >> How long before the earth stops rotating?  > > Apparently about 1.9 trillion years. So, does that mean we now need to hold our breath for 1.9 british trillion years or 1.9 american trillion years? Assuming you were referring

Re: [Python-ideas] Why not picoseconds?

2017-10-20 Thread Stefan Behnel
Antoine Pitrou schrieb am 16.10.2017 um 10:20: > On Sun, 15 Oct 2017 22:00:10 -0700 > Guido van Rossum wrote: >> On Sun, Oct 15, 2017 at 8:40 PM, Nick Coghlan wrote: >> >>> Hopefully by the time we decide it's worth worrying about picoseconds in >>> "regular" code, compiler support for decimal128

Re: [Python-ideas] Why CPython is still behind in performance for some widely used patterns ?

2018-02-19 Thread Stefan Behnel
Nick Coghlan schrieb am 02.02.2018 um 06:47: > to make the various extension module authoring tools > easier to discover, rather than having folks assuming that handcrafted > calls directly into the CPython C API is their only option. Or even a competitive option. Tools like Cython or pybind11 go

Re: [Python-ideas] Syntactic sugar to declare partial functions

2018-08-13 Thread Stefan Behnel
Michel Desmoulin schrieb am 09.08.2018 um 18:59: > I'd rather have functools.partial() to be added as a new method on > function objects. > >> from functools import partial >> >> def add(x:int,y:int)->int: >> returnx +y >> >> add_2 = partial(add,2) > > Would become: > > add_2 =

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-15 Thread Stefan Behnel
Michael Selik schrieb am 14.08.2018 um 21:42: > This is supported by education research. Some light Googling found a > study on the topic [0] that is consistent with my own observations. OTx2, and no offence, but … this is supported by research as well. People tend to search just long enough to

Re: [Python-ideas] Performance improvements via static typing

2018-07-20 Thread Stefan Behnel
Michael Hall schrieb am 19.07.2018 um 15:51: > While I am aware of projects like Cython and mypy, it seems to make sense > for CPython to allow optional enforcement of type hints, with compiler > optimizations related to it to be used. While this would not receive the > same level of performance

Re: [Python-ideas] slice[] to get more complex slices

2018-07-23 Thread Stefan Behnel
Stephan Hoyer schrieb am 23.07.2018 um 18:01: > On Mon, Jul 23, 2018 at 4:24 AM Paul Moore wrote: > >> I thought the reason the proposal got nowhere was because it's pretty >> simple to define it yourself: >> >> >>> class SliceHelper: >> ... def __getitem__(self, slice): >> ... return

Re: [Python-ideas] A better (simpler) approach to PEP 505

2018-07-23 Thread Stefan Behnel
David Mertz schrieb am 23.07.2018 um 16:12: > The need addressed by PEP 505 is real; it's also MUCH more niche and > uncommon than something that would merit new syntax. Moreover, the actual > legitimate purpose served by the PEP 505 syntax is easily served by > existing Python simply by using a

Re: [Python-ideas] slice[] to get more complex slices

2018-07-22 Thread Stefan Behnel
Todd schrieb am 22.07.2018 um 21:03: > For basic slices, the normal "slice(start, stop, step)" syntax works well. > But it becomes much more verbose to create more complicated slices that you > want to re-use for multiple multidimensional data structures, like numpy, > pandas, xarray, etc. > >

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-09-01 Thread Stefan Behnel
Matthew Einhorn schrieb am 31.08.2018 um 20:57: > with model: > with Dense(): > units = 64 > activation = 'relu' > input_dim = 100 > > with Dense(): > units = 10 > activation = 'softmax' This looks like it could use 'class' instead of 'with'.

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

2018-03-25 Thread Stefan Behnel
Jeroen Demeyer schrieb am 24.03.2018 um 22:38: > On 2018-03-24 09:09, Nick Coghlan wrote: >> If it was just about introspection, then we could define a new protocol >> method or attribute, update the inspect module to respect it, and call >> it done. > > True. In fact, I got a long way by just

Re: [Python-ideas] No need to add a regex pattern literal

2019-01-01 Thread Stefan Behnel
Ma Lin schrieb am 31.12.18 um 14:02: > On 18-12-31 19:47, Antoine Pitrou wrote: >> The complaint is that the global cache is still too costly. >> See measurements in https://bugs.python.org/issue35559 > > In this issue, using a global variable `_has_non_base16_digits` [1] will > accelerate 30%. >

Re: [Python-ideas] Add regex pattern literal p""

2018-12-27 Thread Stefan Behnel
Ma Lin schrieb am 27.12.18 um 14:15: >> It'd be good to know just how much benefit this precompilation actually > grants. > > As far as I know, Pattern objects in regex module can be pickled, don't > know if it's useful. > import pickle import regex That's from the external regex

Re: [Python-ideas] Dict joining using + and +=

2019-03-01 Thread Stefan Behnel
Rémi Lapeyre schrieb am 01.03.19 um 16:44: > Le 1 mars 2019 à 16:04:47, Stefan Behnel a écrit: >> I think the behaviour makes sense when you know how it's implemented (keys >> are stored separately from values). > > Is a Python user expected to know the implementation de

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-04 Thread Stefan Behnel
Jimmy Girardet schrieb am 04.03.19 um 10:12: > I'm not old on this list but every time there is a proposal, the answer > is "what are you trying to solve ?". > > Since > > |z ={**x,**y} and z.update(y) Exists, I can"t find the answer. I think the main intentions is to close a gap in the

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-04 Thread Stefan Behnel
James Lu schrieb am 04.03.19 um 03:28: > I propose that the + sign merge two python dictionaries such that if there > are conflicting keys, a KeyError is thrown. Please, no. That would be really annoying. If you need that feature, it can become a new method on dicts. Stefan

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-04 Thread Stefan Behnel
INADA Naoki schrieb am 04.03.19 um 11:15: > Why statement is not enough? I'm not sure I understand why you're asking this, but a statement is "not enough" because it's a statement and not an expression. It does not replace the convenience of an expression. Stefan

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-06 Thread Stefan Behnel
INADA Naoki schrieb am 05.03.19 um 08:03:> On Tue, Mar 5, 2019 at 12:02 AM Stefan Behnel wrote: >> INADA Naoki schrieb am 04.03.19 um 11:15: >>> Why statement is not enough? >> >> I'm not sure I understand why you're asking this, but a statement is >> &

Re: [Python-ideas] Dict joining using + and +=

2019-03-01 Thread Stefan Behnel
Eric V. Smith schrieb am 01.03.19 um 15:49: > I understand Inada to be saying that each value on the LHS (as shown above) > affects the result on the RHS. That's the case with addition of ints and > other types, but not so with the proposed dict addition. As he says, the > {a:1} doesn't affect the

Re: [Python-ideas] Dict joining using + and +=

2019-03-01 Thread Stefan Behnel
Rémi Lapeyre schrieb am 01.03.19 um 15:06: > I’m having issues to understand the semantics of d1 + d2. > > I think mappings are more complicated than sequences it some things > seems not obvious to me. > > What would be OrderedDict1 + OrderedDict2, in which positions would be > the resulting

Re: [Python-ideas] Dict joining using + and +=

2019-03-01 Thread Stefan Behnel
Rémi Lapeyre schrieb am 01.03.19 um 15:50: > Le 1 mars 2019 à 15:41:52, Stefan Behnel a écrit: > >> Rémi Lapeyre schrieb am 01.03.19 um 15:06: >>> I’m having issues to understand the semantics of d1 + d2. >>> >>> I think mappings are more complicated

Re: [Python-ideas] dict.merge(d1, d2, ...) (Counter proposal for PEP 584)

2019-03-21 Thread Stefan Behnel
Steven D'Aprano schrieb am 21.03.19 um 17:21: > On Thu, Mar 21, 2019 at 09:11:18AM -0700, Guido van Rossum wrote: > >> I don't find it easy to understand or remember that d1.update(d2) modifies >> d1 in place, while d1.merge(d2) first copies d1. >> >> Maybe the name can indicate the copying

Re: [Python-ideas] Clearer communication

2019-02-01 Thread Stefan Behnel
James Lu schrieb am 01.02.19 um 17:40: > A lot of the traffic on this email list is people saying “I don’t understand” > or “that’s not what I meant” or trying to re-explain. A lot of “-1”s are > really “I don’t see the usefulness of this”. > > So I want an open discussion on: How can we

Re: [Python-ideas] Mention more alternative implementations on the PSF website

2019-02-03 Thread Stefan Behnel
Eric V. Smith schrieb am 03.02.19 um 23:41: >> On Feb 3, 2019, at 5:31 PM, James Lu wrote: >> https://www.python.org/download/alternatives/ should possibly mention: >> - Mention the possibility of compiling Python to WASM >>- WASM allows Web and Mobile use of Python at possibly native speed.

[Python-ideas] Re: PEP 637 - support for indexing with keyword arguments

2020-10-06 Thread Stefan Behnel
Stefan Behnel schrieb am 29.09.20 um 11:48: > Salve Stefano, > > Stefano Borini schrieb am 23.09.20 um 22:55: >> "Support for indexing with keyword arguments" has now been merged with >> the assigned PEP number 637. > > Cool, this looks like a great add

[Python-ideas] Re: Accelerate zlib and gzip libraries with Intel's Storage Acceleration Libraries

2020-08-17 Thread Stefan Behnel
Antoine Pitrou schrieb am 17.08.20 um 15:00: > On Mon, 17 Aug 2020 08:49:23 - > "Ruben Vorderman" wrote: >> Dear python developers, >> >> As a bioinformatician I work a lot with gzip-compressed data. Recently I >> discovered Intel's Storage Acceleration Libraries at >>

[Python-ideas] Re: Accelerate zlib and gzip libraries with Intel's Storage Acceleration Libraries

2020-08-17 Thread Stefan Behnel
Steven D'Aprano schrieb am 17.08.20 um 17:00: > On Mon, Aug 17, 2020 at 04:08:54PM +0200, Stefan Behnel wrote: > >> I re-opened the ticket to allow for some discussion over there in order to >> understand the implications better. But I agree that a third-party package >> o

[Python-ideas] Re: PEP 637 - support for indexing with keyword arguments

2020-09-29 Thread Stefan Behnel
Salve Stefano, Stefano Borini schrieb am 23.09.20 um 22:55: > "Support for indexing with keyword arguments" has now been merged with > the assigned PEP number 637. Cool, this looks like a great addition to the language! One thing that I'm missing from the PEP is the C side of things, though.

[Python-ideas] Re: Tracebacks for C code in Python

2020-08-16 Thread Stefan Behnel
Ram Rachum schrieb am 15.08.20 um 21:08: > Here's something that's been bugging me for years. I'll suggest something, > but since I'm a total newbie about this area, it's possible that everything > I'm saying is impossible or doesn't make sense. > > I'm working with some Pandas code now, and

[Python-ideas] Re: Fractions vs. floats - let's have the cake and eat it

2021-05-22 Thread Stefan Behnel
Martin Teichmann schrieb am 18.05.21 um 23:41: > >>> solve(x**2-2/3) > [-0.816496580927726, 0.816496580927726] > > That went wrong. We wanted to have a symbolic result, not a numeric solution! > How did that come about? Well, that's the point of discussion: 2/3 gets > immediately turned into

[Python-ideas] Re: Less is more? Smaller code and data to fit more into the CPU cache?

2022-04-05 Thread Stefan Behnel
Barry Scott schrieb am 27.03.22 um 22:23: On 22 Mar 2022, at 15:57, Jonathan Fine wrote: As you may have seen, AMD has recently announced CPUs that have much larger L3 caches. Does anyone know of any work that's been done to research or make critical Python code and data smaller so that more