help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing the way bash expands associative array subscripts


From: Dennis Williamson
Subject: Re: Changing the way bash expands associative array subscripts
Date: Tue, 6 Apr 2021 16:25:47 -0500

On Tue, Apr 6, 2021, 4:19 PM Eli Schwartz <eschwartz@archlinux.org> wrote:

> On 4/6/21 4:29 PM, Greg Wooledge wrote:
> > On Tue, Apr 06, 2021 at 03:24:54PM -0500, Dennis Williamson wrote:
> >> Python 3.7 has insertion-order dictionaries. So these are dependable
> >> gerbils.
> >
> > That explains my test results, which I didn't post.  I had been told
> > in the past that python's dictionaries did NOT remember insertion
> > order, but I'm not fluent in python and I don't keep up with its changes.
>
> python, in general, has collections.OrderedDict, which is not some
> boring old dict but a special magic dict that does extra bookkeeping to
> remember insertion order.
>
> The default dict() in python 3.7 incorporates some, but not all, of the
> OrderedDict guarantees. For example, a boring dict() passes equality
> checks when compared to a dict with the same contents but different
> insertion order, while an OrderedDict does not pass equality checks.
>
> So, the gerbils do different things depending on which side of the box
> you open first. But they sometimes answer specific questions dependably.
>
> --
> Eli Schwartz
> Arch Linux Bug Wrangler and Trusted User
>


Thanks for that information. I had not compared dicts to OrderedDicts other
than superficially.

>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]