JuliaPy / JuliaPy/PyCall.jl

PyDict now a possible bug, on current Python in Ubuntu and Python 3.7 according to docs

Offen
#849 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Julia
Sterne
1.5k
Forks
186
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Since as of Python 3.7 Python's dict is ordered (and seemingly backported in Ubuntu at least, i.e. for Python 3.6), does PyDict need to be change here (at least documented)?

I noticed "This returns a PyDict, which is a no-copy wrapper around a Python dictionary." and that OrderedCollections.jl isn't used for OrderedDict (until I get it into Base as the default), do we need to change stuff here?

Even for older Python versions that do not use ordered by default (if there are any such still in use), I think it may make sense to convert to OrderedDict.

https://docs.python.org/3.6/tutorial/datastructures.html#dictionaries

```
julia> using PyCall

julia> py"""
tel = {'jack': 4098, 'sape': 4139}
tel['guido'] = 4127
"""

julia> tel = py"tel"
Dict{Any, Any} with 3 entries:
"sape" => 4139
"guido" => 4127
"jack" => 4098
```

That's unlike in:

Python 2.7.17 (default, Jul 20 2020, 15:37:01)
and
Python 3.6.9 (default, Jul 17 2020, 12:50:27)

```
>>> tel
{'sape': 4139, 'jack': 4098, 'guido': 4127}
```

Despite Python's docs saying otherwise, on my Ubuntu 18.04.5 LTS.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.