Title: Inconsistent Conversion of Sequence Types · Issue #909 · pythonnet/pythonnet · GitHub
Open Graph Title: Inconsistent Conversion of Sequence Types · Issue #909 · pythonnet/pythonnet
X Title: Inconsistent Conversion of Sequence Types · Issue #909 · pythonnet/pythonnet
Description: Environment Pythonnet version: 2.4 (build from df0574d) Python version: 2.7, 3.6, 3.7 Operating System: Windows 10 Details I am trying to convert from List to PyList and back without losing type information. // this works: int[] values2 ...
Open Graph Description: Environment Pythonnet version: 2.4 (build from df0574d) Python version: 2.7, 3.6, 3.7 Operating System: Windows 10 Details I am trying to convert from List to PyList and back without losing type in...
X Description: Environment Pythonnet version: 2.4 (build from df0574d) Python version: 2.7, 3.6, 3.7 Operating System: Windows 10 Details I am trying to convert from List to PyList and back without losing type in...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/909
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistent Conversion of Sequence Types","articleBody":"### Environment\r\n- Pythonnet version: 2.4 (build from df0574db552020397728648ee3ec576aa3a1c2a8)\r\n- Python version: 2.7, 3.6, 3.7\r\n- Operating System: Windows 10\r\n\r\n### Details\r\n\r\nI am trying to convert from List\u003cint\u003e to PyList and back without losing type information.\r\n\r\n```C#\r\n // this works:\r\n int[] values2 = new int[] { 1, 2, 3 };\r\n var pyvalues2 = values2.ToPython();\r\n pyvalues2.As\u003cint[]\u003e();\r\n\r\n // this does not work.\r\n List\u003cint\u003e values = new List\u003cint\u003e { 1, 2, 3 };\r\n var pyvalues = values.ToPython();\r\n pyvalues.As\u003cList\u003cint\u003e\u003e(); // unable to convert back to List\u003cint\u003e\r\n```\r\n\r\nIt seems ToPython will just take any IEnumerable or IList and turn it into a python list. Even though it is not generally possible to convert it back. In this case I'd rather keep it as the original type, because eventually I'll need to get it back to C#.\r\n\r\nI understand why the current behavior makes things easier, but it would be great if it was possible to disable or alter this behavior.","author":{"url":"https://github.com/rmadsen-ks","@type":"Person","name":"rmadsen-ks"},"datePublished":"2019-07-10T08:12:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/909/pythonnet/issues/909"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9350f19a-97f5-a6d7-3b8d-dafc0398384a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CE36:F23B3:30F8229:319DA0F:69702DCE |
| html-safe-nonce | 43eb3227d85ff8feb4941482b0534c9ae8039722228ad7052eb0f5da7dc32697 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTM2OkYyM0IzOjMwRjgyMjk6MzE5REEwRjo2OTcwMkRDRSIsInZpc2l0b3JfaWQiOiI1MTg3NzE0NDY2ODYxNTU5MjQ2IiwicmVnaW9uX2VkZ2UiOiJzZWEiLCJyZWdpb25fcmVuZGVyIjoic2VhIn0= |
| visitor-hmac | c66a8920403a4145e15449df3499c4b40f947d227de942435eb451484b86ee60 |
| hovercard-subject-tag | issue:466165438 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pythonnet/pythonnet/909/issue_layout |
| twitter:image | https://opengraph.githubassets.com/948793b9a293bbb77d3e78942e9f67996b9716548809b011289c5f73a2b1b8d0/pythonnet/pythonnet/issues/909 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/948793b9a293bbb77d3e78942e9f67996b9716548809b011289c5f73a2b1b8d0/pythonnet/pythonnet/issues/909 |
| og:image:alt | Environment Pythonnet version: 2.4 (build from df0574d) Python version: 2.7, 3.6, 3.7 Operating System: Windows 10 Details I am trying to convert from List to PyList and back without losing type in... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rmadsen-ks |
| hostname | github.com |
| expected-hostname | github.com |
| None | 01fa379f5de85ef8e791d09724e69709ce9eb9595278316e0a921312dc88e0bc |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | dda91974c069382b0dfa47b2da7e28bd061c8331 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width