@Deprecated is used in Java and I find it very easy to use. Remember
you can also use parameters in decorators.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.
You can use the Jupiter console: https://jupyter.org/
On Fri, 11 Jun 2021 at 15:13, Raymond Bisdorff wrote:
>
> Dear Python developers,
>
> It would be helpful, if the following issue with copy-pasting python
> code-snippets into the standard shell console, could be investigated and
> corrected.
Since `dict` now is ordered, how about a `sort()` method?
It could have the same signature of list.sort(), with an optional
parameter "by" that can be "keys" or "values" ("keys" could be the
default).
___
Python-ideas mailing list -- python-ideas@python.o
On Sun, 23 May 2021 at 19:50, Chris Angelico wrote:
>
> On Mon, May 24, 2021 at 3:38 AM Marco Sulla
> wrote:
> > > > > Do you yearn for actual refactoring tools - which do exist?
> > > >
> > > > Renaming tools of IDE do not work in 100% of the case
On Sun, 23 May 2021 at 19:41, Todd wrote:
>
> The pytoolz/cytoolz project already has this:
> https://toolz.readthedocs.io/en/latest/api.html#toolz.dicttoolz.get_in
It seems a project that is used by many people. I think that JSON is
so much used that that function could be added to the builtin
On Sun, 23 May 2021 at 17:43, <2qdxy4rzwzuui...@potatochowder.com> wrote:
>
> On 2021-05-23 at 16:30:35 +0200,
> Marco Sulla wrote:
>
> > On Sun, 23 May 2021 at 14:50, Chris Angelico wrote:
> > >
> > > On Sun, May 23, 2021 at 10:42 PM Marco Sulla
> &g
On Sun, 23 May 2021 at 17:22, MRAB wrote:
>
> On 2021-05-23 13:37, Marco Sulla wrote:
> > I propose to add a get_deep(*args, default=_sentinel) method to dict.
> >
> > It can accept a single argument, that must be an iterable, or multiple
> > arguments.
> >
&g
On Sun, 23 May 2021 at 14:50, Chris Angelico wrote:
>
> On Sun, May 23, 2021 at 10:42 PM Marco Sulla
> wrote:
> >
> > On Sun, 23 May 2021 at 14:35, Chris Angelico wrote:
> > >
> > > On Sun, May 23, 2021 at 10:30 PM Marco Sulla
> > > wrote:
>
On Sun, 23 May 2021 at 15:30, Thomas Grainger wrote:
>
> seems a bit like https://www.python.org/dev/peps/pep-0505/
>
> eg `d?[1]?[0]`
No, I do not want to suppress the exception, only to have a way to
access a nested object in a complicate dict, for example a dict
generated by a JSON.
In your e
On Sun, 23 May 2021 at 14:35, Chris Angelico wrote:
>
> On Sun, May 23, 2021 at 10:30 PM Marco Sulla
> wrote:
> >
> > I think the only reason to introduce something like `private` is
> > refactoring. If you added a `_variable` and later you decided to
> > ex
I propose to add a get_deep(*args, default=_sentinel) method to dict.
It can accept a single argument, that must be an iterable, or multiple
arguments.
The first element must be a key of the dict. If there's not a second
element, the value is returned. If it's present, it tries to use it as
an ar
I think the only reason to introduce something like `private` is
refactoring. If you added a `_variable` and later you decided to
expose it, you have to change it to `variable`. This is something that
in languages like Java is not necessary, you have only to change the
variable from private to publ
On Mon, 15 Mar 2021 at 20:49, Ethan Furman wrote:
> Everything considered, I think I like allowing `__contains__` to verify both
> names and values
What about Enum.values()?
> adding `default=` to the constructor for the value-based "gimme an
> Enum or None" case
What's the use case, apart ch
On Tue, 16 Mar 2021 at 05:38, Matt Wozniski wrote:
> Color.from_value(1) # returns Color.RED
What if I have an alias?
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.py
On Wed, 3 Mar 2021 at 23:59, Brendan Barnwell wrote:
> But usually you want to define it at the beginning as a sort of
> documentation aid ("this is the public API").
This is a little off-topic, but I'm curious, since usually, for public
functions and classes, I do
__all__ = (Class.__name__, fu
On Tue, 23 Feb 2021 at 02:13, Soni L. wrote:
>
> Currently ~False is -1 and ~True is -2. Would be nicer if ~bool was the
> same as not bool.
I suspect this is more for NumPy people. I remember that one of my
bosses used `~a` on a bool because he started with NumPy and had a
limited knowledge of P
On Tue, 29 Dec 2020 at 22:40, Eelke van den Bos wrote:
>
> Hi Sergio,
>
> The pathlib module includes this feature:
> https://docs.python.org/3/library/pathlib.html#pathlib.Path.unlink
>
> Best,
>
> Eelke
I add that it's quite common to skip FileNotFoundError in removing a
file. I think it's the
On Fri, 1 Jan 2021 at 06:38, Steven D'Aprano wrote:
> Relevant: https://bugs.python.org/issue42801
Can't reproduce on the latest trunk (3.10). I get 1989 as a result.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email
What about a parameter, false by default, that suppresses the
FileNotFoundError exception if true for os.remove()? Something similar
to exist_ok for os.makedirs().
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to py
Maybe it's a crazy idea, but what if we could decorate a single line
of code? For example:
@Timer
a = time_consuming_function()
This will be equivalent to using Steven's context manager, but the
decorator is more simple to comment and uncomment.
Maybe it could be possible to comment also code bl
On Wed, 16 Dec 2020 at 20:18, Paul Sokolovsky wrote:
> But still, are there Python implementations which compile "(a.b)()"
> faithfully, with its baseline semantic meaning? Of course there're.
OK, Paul, why don't you propose a PR and a bug report about it?
On Wed, 16 Dec 2020 at 19:52, Abdulla Al Kathiri
wrote:
>
> Or more concise
> def method(self, spam, eggs, cheese, *args):
> spam = spam or self.spam
> eggs = eggs or self.eggs
> #etc., The above is equivelent to the following:
> spam = spam if spam else self.spam
> eggs = eggs if eggs else self.e
On Tue, 15 Dec 2020 at 17:41, Chris Angelico wrote:
> I learned BOMDAS - Brackets, O (varies in expansion but always minor
> things you don't often see), Multiplication, Division, Addition,
> Subtraction. For some reason it's also written BODMAS, which has the
> exact same meaning (since multiplic
On Tue, 15 Dec 2020 at 15:32, Steven D'Aprano wrote:
>
> On Tue, Dec 15, 2020 at 03:08:51AM -, qaidjoharbarbh...@gmail.com wrote:
> > Hello,
> >
> > Greetings!
> >
> > I have the following idea of adding a function in Lib/datetime.py
> > which when called with the datetime.date object returns
On Wed, 2 Dec 2020 at 09:27, Chris Angelico wrote:
> But you can make your own private research project without asking
> anyone else for information. Why try to synchronize with anyone else?
> Why not just make your own thing and find out what constness can do
> for Python?
I agree. I think it wi
On Tue, 1 Dec 2020 at 23:49, Paul Sokolovsky wrote:
> On Wed, 2 Dec 2020 09:16:56 +1100
> Chris Angelico wrote:
> > If the restricted execution model is incompatible with most Python
> > scripts, why would anyone bother to use it?
>
> E.g. because someone who would want to experiment with JIT, wo
I think that what you want is another language, that already exists
and it's RPython:
https://rpython.readthedocs.io/en/latest/rpython.html
See constants paragraph.
RPython is used to create PyPy, not to limit normal Python programming :-)
___
Python-i
On Tue, 1 Dec 2020 at 13:16, Paul Sokolovsky wrote:
> If you want immutable dict you [know whom to thank for the lack of it -
> stroked thru] can use types.MappingProxyType, as was explained (it's
> all about PEP603).
>
> The last case with immutable dict also shows that proliferation of both
> mu
elico wrote:
>
> On Tue, Dec 1, 2020 at 10:25 AM Marco Sulla
> wrote:
> >
> > On Mon, 30 Nov 2020 at 23:26, David Mertz wrote:
> > > Somehow "dire" doesn't strike me as the right word Maybe you were
> > > looking for "con
On Mon, 30 Nov 2020 at 23:26, David Mertz wrote:
> Somehow "dire" doesn't strike me as the right word Maybe you were looking
> for "conceivably useful in niche cases."?
Well, I think const can be useful for:
* multiprocessing. Now, for example, dict is passed between processes
using MappingP
On Mon, 30 Nov 2020 at 03:39, Chris Angelico wrote:
>
> No, Serhiy meant that you can pass a function to timeit.
Aaah, didn't know this.
On Mon, 30 Nov 2020 at 12:21, Steven D'Aprano wrote:
>
> On Mon, Nov 30, 2020 at 12:11:01AM +0100, Marco Sulla wrote:
>
>
On Sun, 29 Nov 2020 at 23:34, Guido van Rossum wrote:
> OTOH if we were to introduce 'let' or 'const' in the language, it would
> surely be usable to solve a whole bunch of other problems, in addition to
> giving us a cleaner way to solve the value capture problem.
Well, IMHO let could help the
You can use classes as decorators, it's quite more simple:
https://towardsdatascience.com/using-class-decorators-in-python-2807ef52d273?gi=ea5091974462
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-l
On Sun, 29 Nov 2020 at 21:45, wrote:
> To use timeit (or the current Timer class), one has to write the stmt as a
> string which is not convenient (yet I understand that if you want to time a
> code snippet by running it more than once there may be not alternative than
> using stmt as strings)
On Fri, 27 Nov 2020 at 17:11, wrote:
>
> When optimizing code, I often need to timeit a part of code or a function.
> I am using then the following class
> [...]
> that I can use either as a context manager in
> ```
> with Timer("how long does this take?") as t:
> time.sleep(1)
> # output: DEB
On Wed, 18 Nov 2020 at 00:31, Oscar Benjamin
wrote:
> I can write many things myself. That doesn't mean that it wouldn't be
> good if someone already wrote it for me (and for everyone else).
>
What about more_itertools?
___
Python-ideas mailing list --
On Sat, 24 Oct 2020 at 21:49, André Roberge wrote:
> No, it does not. It proposes actual changes to the Python interpreter.
>
> Under my proposal, something like what is proposed there would first be
> implemented as a third party package.
>
Not sure, but yes, the PEP proposes a change to the in
I had many times the same idea: why can't we just "say" to the called
function "use your own default"? I'm quite sure this is possible in a
tricky way, since defaults are stored in the function object.
Anyway, honestly I don't like your syntax proposal.
See PEP 638:
https://www.python.org/dev/peps/pep-0638/
If I have understood well, it proposes what you want
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mai
On Fri, 23 Oct 2020 at 09:39, Steven D'Aprano wrote:
> Using PEP 634 syntax, I could write:
>
>
> def method(self, **kwargs):
> {'spam': spam, 'eggs': eggs, **kw} = **kwargs
> process(spam, eggs)
> super().method(**kw)
>
I like that.
__
On Fri, 23 Oct 2020 at 08:06, Random832 wrote:
> On Thu, Oct 22, 2020, at 21:00, Steven D'Aprano wrote:
> I suspect that calling this particular syntax ugly is picking at a bit of
> an open wound in the history f-string implementation... consider precisely
> why the escaping syntax is {{}} instea
On Thu, 22 Oct 2020 at 12:36, Hans Ginzel wrote:
> On Thu, Oct 22, 2020 at 08:31:34PM +1100, Steven D'Aprano wrote:
> >> cursor.execute(f"INSERT INTO {table} VALUES (1, '{}');")
> >> SyntaxError: f-string: empty expression not allowed
> >
> >Escape the braces by doubling them:
> >f"INSERT INT
On Sat, 17 Oct 2020 at 21:50, Ethan Furman wrote:
>
> On 10/17/20 10:54 AM, Marco Sulla wrote:
>
> > I think that in this case `clear` simply writes N enter chars, until
> > the terminal is "cleared". IMHO this is the safest option.
>
> 'clear'
On Sat, 17 Oct 2020 at 03:37, Steven D'Aprano wrote:
>
> On Fri, Oct 16, 2020 at 11:30:56PM +0200, Marco Sulla wrote:
>
> > Well, in terminals like bash, `clear` does not really delete the
> > previous input. It simply move the scroll so the first line of the
>
Well, in terminals like bash, `clear` does not really delete the
previous input. It simply move the scroll so the first line of the
input is the current input.
Maybe the REPL can emulate this in some way.
___
Python-ideas mailing list -- python-ideas@pyt
I forgot: I noticed that creating dict from a matrix N*2 is not
optimized for lists and tuples. Is this because creation from a
sequence2 is not much used?
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ide
values:
https://github.com/Marco-Sulla/cpython/blob/2eea9ff796685127fc03fcc30ff6c652ed18f5db/Objects/dictobject.c
(It's frozendict_clone and it's used in frozendict_merge)
Iteration continues to be faster. Probably also creation from dict
with holes, I did not test it.
I suppose froz
On Sun, 11 Oct 2020 at 19:53, Wes Turner wrote:
> Arbitrary-precision multiple-precision floats in Python: mpmath, gmpy, sympy
> .evalf() / N()
mpmath has always a global precision:
http://mpmath.org/doc/current/basics.html#setting-the-precision
About SymPy, I worked a little with it within Sag
On Sat, 10 Oct 2020 at 19:28, Tim Peters wrote:
> Try to spell out what you mean - precisely! - by "this". I can't do
> that for you. For any plausible way of fleshing it out I've thought
> of, the answer is "no".
Well, please, don't be so harsh. I'm trying to discuss to someone that
co-created P
On Fri, 9 Oct 2020 at 23:41, Tim Peters wrote:
> But the decimal spec takes a different approach, which Python's docs
> don't explain at all: the otherwise-mysterious ROUND_05UP rounding
> mode. Quoting from the spec:
>
> http://speleotrove.com/decimal/damodel.html
> ...
> The roundi
On Thu, 8 Oct 2020 at 22:10, Tim Peters wrote:
> Again, the concept of a _fixed_ (albeit user-settable) working
> precision is deep in the module's bones.
That is, for what I know, how also BigDecimal in Java works... and
float in any architecture.
___
On Tue, 6 Oct 2020 at 15:33, Alperen Keleş wrote:
> Cars have different states, MovingCar, IdleCar, ParkingCar...
Well, IMHO the solution is quite more simple:
class Car:
def __init__(self):
self.state = "parking"
def move(self):
if self.state != "moving":
ra
What I do not understand is why you need to use the iterator instead
of using the iterable itself. This way you can jump to whatever
position without slicing.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-
In the meanwhile, I updated the code of frozendict to the new 3.10
code. And here I need some help.
As you can see by the new benchs:
https://github.com/Marco-Sulla/cpython/blob/frozendict/frozendict/test/bench.txt
creation of frozendict is not faster anymore. This is because Inada
introduced
You can use slice:
new_iterator = iterator[50001:]
it2 = iter(new_iterator)
or range:
for i in range(50001, len(iterator)):
x = iterator[i]
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@
On Wed, 30 Sep 2020 at 20:02, Steven D'Aprano wrote:
> There's also the factor that the dot operator is not very visually
> distinctive.
I completely agree.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-
On Tue, 29 Sep 2020 at 04:39, <2qdxy4rzwzuui...@potatochowder.com> wrote:
>
> On 2020-09-28 at 23:10:24 -,
> Giang Le wrote:
>
> > I would like to propose an idea for the regular expression module
> > re.search(Pattern, Input) to support List[str] input type.
>
> > So it will return a matched
That I hope it's not the place where this proposal will be sent.
My idea is apparently simple: what if, anytime we create an object,
instead of deleting it, we send it in a trash bin? If the object is,
for some reason, recreated, we can take it from the trash bin. If
there is no more memory, the t
On Fri, 25 Sep 2020 at 14:44, Samuel Colvin wrote:
>
> Sorry I probably wasn't clear enough in what I was suggesting.
>
>>
>> The main question here is why using a hint or a decorator should be
>> better than a simple documentation.
>
>
> For the same reason type hints are better than documentatio
On Fri, 25 Sep 2020 at 11:58, Samuel Colvin wrote:
> I first found myself wanting this when I came back to python
> having been writing rust. The Result type in rust is somewhat
> similar to what's being suggested here. See
> https://doc.rust-lang.org/std/result/
I do not know Rust and I'm not su
For me, the only good thing to differentiate between accepted and
rejected PEPs is to get a look at the old rejected ones, to see if
there's some ideas I can stea... take inspiration. But
https://www.python.org/dev/peps/ already does it.
PS: PAP remembers me the PAP test.
_
thing similar in insertdict_init, but in
"bulk mode".
On Thu, 17 Sep 2020 at 16:49, Marco Sulla wrote:
>
> On Thu, 17 Sep 2020 at 05:31, Inada Naoki wrote:
> >
> > On Thu, Sep 17, 2020 at 8:03 AM Marco Sulla
> > wrote:
> > >
> > > pyth
On Thu, 17 Sep 2020 at 05:31, Inada Naoki wrote:
>
> On Thu, Sep 17, 2020 at 8:03 AM Marco Sulla
> wrote:
> >
> > python -m timeit -n 2000 --setup "from uuid import uuid4 ; o =
> > {str(uuid4()).replace('-', '') : str(uuid4()).replace('
It seems that the variables come out magically.
What about something like:
a, b = "hello world".extract("{} {}")
PS: I do not like extract, it's the first name that comes in my mind
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscrib
Well, it seems ok now:
https://github.com/python/cpython/compare/master...Marco-Sulla:master
I've done a quick speed test and speedup is quite high for a creation
using keywods or a dict with "holes": about 30%:
python -m timeit -n 2000 --setup "from uuid import uuid4 ; o =
{str(uuid4()).replace
Well, I simply forgot vectorcall.
I've done a test and it seems the speedup is about 25%.
Unluckily, now I abandoned definitively the hope of a big big resize,
but it seems I don't resize correctly, since now I have again an
assert error on dk_usable.
What is the difference between dk_usable and
On Tue, 15 Sep 2020 at 18:10, Wes Turner wrote:
>
> json.loads and json.dumps exist only because there was no way to distinguish
> between a string containing JSON and a file path string.
> (They probably should've been .loadstr and .dumpstr, but it's too late for
> that now)
Well, if you see t
On Tue, 15 Sep 2020 at 09:22, Inada Naoki wrote:
>
> On Tue, Sep 15, 2020 at 5:08 AM Marco Sulla
> wrote:
> >
> > 1. How can we check the size of an object only if it's an iterable
> > using the Python C API?
>
> There is no good way. Additionally, we need
Little errata: change
Cython, for example, uses its parser to compile Python code
to
Cython, for example, uses its parser to compile Cython code
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...
On Sun, 23 Aug 2020 at 02:42, Guido van Rossum wrote:
> IMO this is just too large of a step to expect either redradrist or Marco
> Sulla to take.
You're quite right, I have proposed it to have an opinion by experts.
Indeed I have no knowledge about how a parser works. This is why
I just had an idea: we have mp->ma_used and keys->dk_nentries.
holes = mp->ma_keys->dk_nentries - mp->ma_used
is the number of holes in the dict.
So, if holes == 0, you have O(1). But, if the dict has holes, you
can't have O(1), but you can speedup the check of the entry by
counting the NULLs in
Well, I didn't read the entire discussion... but I wrote in
unsuspicious times a stupid little module, msutils, with two stupid
little functions, jsonLoad and jsonDump:
https://github.com/Marco-Sulla/msutils/blob/master/msutils/jsonutil.p
@Inada (senpai?):
In the meanwhile I tried to apply some tricks to speedup the dict
creation without success.
This is my effort:
https://github.com/Marco-Sulla/cpython/blob/master/Objects/dictobject.c
As you can see, I simply "cloned" some functions that create dict, and
removed some c
On Mon, 17 Aug 2020 at 22:10, Guido van Rossum wrote:
>
> Please try to learn how to write a good proposal. A few examples, like you
> did here, just isn't enough. It's worth doing right, and it's worth
> *learning* how to do it right.
Well, I'll try.
In pure python, you can change everything.
On Mon, 17 Aug 2020 at 11:17, Steven D'Aprano wrote:
> Did you have a specific question to be answered or are you just hoping
> to get people interested in the proposal?
It seems I have to repost the proposal I already wrote...
My proposal is to add a way for third party modules to add custom
ke
Well, "up" it's used in forums to draw attention :)
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
...up?
On Thu, 6 Aug 2020 at 04:41, Marco Sulla wrote:
> Think if you're able to do:
>
>
> from aenum import const
> @const a = 5
>
>
> Notice that I'm using the "at" char because I can't find a better character.
>
> I give the rest to your
You probably wants also the python extension for gdb, to go faster to
the interesting code:
https://stackoverflow.com/q/41160447/1763602
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
On Fri, 14 Aug 2020 at 11:10, Chris Angelico wrote:
> IMO the collections module isn't really right for something like that,
> but if you really need a helper function for this one-liner, then I'd
> say having one in your own code is perfectly reasonable.
In my experience I used it a lot, and I s
Excuse me, I sent this message from the wrong email address:
On Fri, 14 Aug 2020 at 09:24, Steven D'Aprano wrote:
> Tensors generalise matrices to an arbitrary number of
> dimensions, 3D and above.
>
> https://medium.com/@quantumsteinke/whats-the-difference-between-a-matrix-and-a-tensor-4505fbdc5
LaTeX for example uses the underscore for subscripts and the ^ for the
superscript. This is not acceptable, since Python (and almost all
languages) uses [] for subscript, and ^ in Python is the XOR logical
operator.
___
Python-ideas mailing list -- pytho
Many times I want a function parameter that is an iterable but not a
string. Usually I do:
try:
var.__iter__
except AttributeError:
# not an iterable
else:
try:
var.isascii
except AttributeError:
# put yuour code here
or
from collections.abc import Iterable
if
On Fri, 14 Aug 2020 at 03:16, Steven D'Aprano wrote:
> Funny you mention this, I have been working on a Matrix object for
> precisely the use-case you discuss (secondary school maths), where
> performance is not critical and the dimensions of the matrix is
> typically single digits.
This is reall
On Fri, 7 Aug 2020 at 14:14, Jonathan Fine wrote:
> At present
> d[1, 2]
> d[(1, 2)]
> are semantically equivalent.
>
> There is a proposal, that
> d[1, 2, a=3, b=4]
> d[(1, 2), a=3, b=4]
> be semantically equivalent.
>
> I find this troubling, for example because
>fn(1, 2, a=3
What about __json__()?
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/arch
On Thu, 6 Aug 2020 at 14:57, Jonathan Grant
wrote:
> Instead of writing this:
>
> try:
> return my_dict[“a”][“b”][“c”][“d”]
> except:
> return “some default”
>
> [...]
>
> I propose we allow for an inline exception handler, like `eor`:
>
> return my_dict[“a”][“b”][“c”][“d”] eor “some defau
On Wed, 5 Aug 2020 at 20:10, Ethan Furman wrote:
> --> from aenum import Constant
>
> --> class K(Constant):
> ... a = 5
> ...
This is exactly what I intended. Think if you're able to do:
from aenum import const
@const a = 5
Notice that I'm using the "at" char because I
On Wed, 5 Aug 2020 at 15:53, Ricky Teachey wrote:
> How about this?
>
> @print(sep="\n")
> 1, 2, 3
If you consider @print as a function decorator, it's quite a problem.
But I was thinking mainly about a sort of "decorator" for the parser
and/or the AST compiler.
This could allow you to have, for
On Wed, 5 Aug 2020 at 13:29, Dominik Vilsmeier wrote:
>
> On 05.08.20 12:40, Greg Ewing wrote:
> > A considerable number of moons ago, I suggested that
> >
> > @my_property
> > fred = 42
> >
> > should expand to
> >
> > fred = my_property("fred", 42)
> >
> > The point being to give the
I forgot that there's also Ray:
https://github.com/ray-project/ray
Ray uses Apache Arrow (and Plasma) under the hood. It seems Plasma was
originally developed by Ray team.
Don't know how they solve the GC problem. Maybe they disable it.
___
Python-ideas
There's also the possibility to use shared ctypes:
https://docs.python.org/3/library/multiprocessing.html#shared-ctypes-objects
Operations like += which involve a read and write are not atomic. So if,
> for instance, you want to atomically increment a shared value it is
> insufficient to just do
>
On Sat, 1 Aug 2020 at 20:25, Stestagg wrote:
> I wrote some (better than the previously shared) benchmarks for this
> change a while ago.
>
I think that you could speed up the algorithm if you check if
dict->ma_keys->dk_lookup
== lookdict_unicode_nodummy. If so, the dict is a combined dict with
On Sat, 1 Aug 2020 at 19:34, Christopher Barker wrote:
> I would think the goal here would be to re-order once in a while to remove
> the holes. But that would take time, of course, so you wouldn't want to do
> it on every deletion. But when?
>
You should have a separate process that does this,
You don't need locks with immutable objects. Since they're immutable, any
operation that usually will mutate the object, generate another immutable
instead. The most common example is str: the sum of two strings in Python
(and in many other languages) produces a new string.
This is usually slower
On Sat, 1 Aug 2020 at 03:00, Inada Naoki wrote:
> Please teach me if you know any algorithm which has no hole, O(1)
> deletion, preserving insertion order, and efficient and fast as array.
>
:)
About the hole, I was thinking that in theory the problem can be
circumvented using a modified versio
Ok... I wrong. The array of items have a NULL key and value if one item is
deleted. Sorry for the confusion.
On Sat, 1 Aug 2020 at 01:09, Guido van Rossum wrote:
> the key and items views already implement the Set ABC, and I'd rather
> refrain from having them *also* implement the Sequence ABC.
On Sat, 1 Aug 2020 at 02:30, Stestagg wrote:
> The dict keys is compact only *until* you delete an item, at which point,
> a hole is left in the array
>
No, the array of items has no hole. The hole is inserted in the hashtable.
___
Python-ideas mailing
On Fri, 31 Jul 2020 at 22:14, Chris Angelico wrote:
> So, constructing a tuple or list from the keys or items WILL give you a
> sequence.
>
Yes. Since now dicts are ordered by insertion, also keys, values and items
are ordered the same way.
It seems to me more simple to add some sequence metho
On Thu, 30 Jul 2020 at 12:57, Vinay Sharma via Python-ideas <
python-ideas@python.org> wrote:
> Python has support for atomic types, I guess:
> Atomic Int:
> https://github.com/python/cpython/blob/master/Include/internal/pycore_atomic.h#L80
> Atomic Store:
> https://github.com/python/cpython/blob/
Is it not more simple to add some sequence methods to the dict views (if
there's a real need)?
If you do tuple(dict.keys()), you get the sequence of keys in the same
insertion order of the dict. It seems to me that the duck already exists
and quacks.
___
1 - 100 of 159 matches
Mail list logo