JuliaPy / JuliaPy/PyCall.jl

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

Open
#849 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.