Skip to content

Lists are converted to objects instead of arrays #176

Closed

Description

@caseyjhol

Issue type

Bug

How did you install PythonMonkey?

Installed from pip

OS platform and distribution

MacOS 13.5.2

Python version (python --version)

3.11

PythonMonkey version (pip show pythonmonkey)

0.2.2.dev85+a7e1bcc

Bug Description

When passing a list into a JS function, the list is converted into an object rather than an array, which is unexpected.

Expected:
[ 1, 2, 3 ] true

Actual:
{ '0': 1, '1': 2, '2': 3 } false

Standalone code to reproduce the issue

import pythonmonkey as pm

items = [1, 2, 3]
isArray = pm.eval('Array.isArray')(items)
pm.eval('console.log')(items, isArray)

Relevant log output or backtrace

No response

Additional info if applicable

No response

What branch of PythonMonkey were you developing on? (If applicable)

No response

Activity

  1. Hamada-Distributed commented on Nov 16, 2023

    @Hamada-Distributed
    Contributor

    @wesgarland @caleb-distributive how do we feel about this? How difficult would it be to have python lists coerce to javascript arrays?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions