Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add handler for tuple #87

Open
Almenon opened this issue Apr 28, 2019 · 0 comments
Open

add handler for tuple #87

Almenon opened this issue Apr 28, 2019 · 0 comments

Comments

@Almenon
Copy link
Owner

Almenon commented Apr 28, 2019

add the handler to https://github.com/Almenon/AREPL-backend/blob/master/python/arepl_custom_handlers.py

from collections import namedtuple
Person = namedtuple('Person', 'first_name last_name zip_code')
p1 = Person('Joe', 'Schmoe', '93002')
print(dir(p1))
print(p1.__repr__)

Named tuples are not represented well in the variable viewer - the important part of the tuple is the py/seq and py/newargs isn't really necessary.

vars:

-{
    Person: -{
        py/type: "__main__.Person"
    },
    p1: -{
        py/object: "__main__.Person",
        py/newargs: -{
            py/tuple: +[3 items]
        },
        py/seq: -[
            "Joe",
            "Schmoe",
            "93002"
        ]
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant