On Fri, Dec 20, 2019 at 4:15 PM Wes Turner wrote:
>
> How slow and space-inefficient would it be to just implement the set methods
> on top of dict?
Speed: Dict doesn't cache the position of the first item. Calling
next(iter(D)) repeatedly is O(N) in worst case.
Space: It waste 8bytes per
How slow and space-inefficient would it be to just implement the set
methods on top of dict?
Do dicts lose insertion order when a key is deleted? AFAIU, OrderedDict do
not lose insertion order on delete. Would this limit the utility of an
ordered set as a queue? What set methods does a queue need
[Nick]
> I must admit that I was assuming without stating that a full OrderedSet
> implementation would support the MutableSequence interface.
Efficient access via index position too would be an enormous new
requirement, My bet: basic operations would need to change from O(1)
to O(log(N)).
On Fri., 20 Dec. 2019, 1:56 pm Tim Peters, wrote:
> So what problem(s) would a dynamic ordered set really be aiming at? I
> don't know. Consistency & predictability I understand and appreciate,
> but little beyond that. Even FIFO ordering is somewhat a PITA, since
> `next(iter(set))` is an
[David Mertz ]
> It's not obvious to me that insertion order is even the most obvious or
> most commonly relevant sort order. I'm sure it is for Larry's program, but
> often a work queue might want some other order. Very often queues
> might instead, for example, have a priority number assigned
[Nick]
> I took Larry's request a slightly different way:
Sorry, I was unclear: by "use case" I had in mind what appeared to me
to be the overwhelming thrust of the _entirety_ of this thread so far,
not Larry's original request.
> he has a use case where he wants order preservation (so built in
On Thu, Dec 19, 2019 at 5:39 PM Nick Coghlan wrote:
> I took Larry's request a slightly different way: he has a use case where
> he wants order preservation (so built in sets aren't good), but combined
> with low cost duplicate identification and elimination and removal of
> arbitrary elements
Hi,
Le mer. 18 déc. 2019 à 16:43, Julien Danjou a écrit :
> The only way to retrieve the current exception is via sys.excinfo or
> PyErr_GetExcInfo in C. However, the issue is that they don't take a
> PyThreadState as argument, but use _PyThreadState_GET() to retrieve the
> thread state.
If we
On Fri., 20 Dec. 2019, 2:58 am Tim Peters, wrote:
> [Nick Coghlan ]
> > Starting with "collections.OrderedSet" seems like a reasonable idea,
> > though - that way "like a built-in set, but insertion order preserving"
> will
> > have an obvious and readily available answer, and it should also
> >
OrderedSet implementations:
- https://github.com/methane/cpython/pull/23/files
- https://pypi.org/search/?q=orderedset
- https://pypi.org/project/orderedset/
- https://code.activestate.com/recipes/576694/
- https://pypi.org/project/ordered-set/
-
[Nick Coghlan ]
> Starting with "collections.OrderedSet" seems like a reasonable idea,
> though - that way "like a built-in set, but insertion order preserving" will
> have an obvious and readily available answer, and it should also
> make performance comparisons easier.
Ya, I suggested starting
from locale import seasons_greetings
seasons_greetings()
On behalf of the entire Python development community, and the currently serving
Python release team in particular, I'm pleased to announce the unprecedented
combined release of no less than four versions of Python. Let's dig in!
Python
12 matches
Mail list logo