Title: Mark Shannon's presentation at the 2017 Language Summit · Issue #432 · python/typing · GitHub
Open Graph Title: Mark Shannon's presentation at the 2017 Language Summit · Issue #432 · python/typing
X Title: Mark Shannon's presentation at the 2017 Language Summit · Issue #432 · python/typing
Description: @ilevkivskyi @markshannon. Mark observed that the typing module uses classes to represent types. This can be expensive, since e.g. the type List[int] really ought to be the tuple (List, int) but it's actually a class object which has a f...
Open Graph Description: @ilevkivskyi @markshannon. Mark observed that the typing module uses classes to represent types. This can be expensive, since e.g. the type List[int] really ought to be the tuple (List, int) but it...
X Description: @ilevkivskyi @markshannon. Mark observed that the typing module uses classes to represent types. This can be expensive, since e.g. the type List[int] really ought to be the tuple (List, int) but it...
Opengraph URL: https://github.com/python/typing/issues/432
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Mark Shannon's presentation at the 2017 Language Summit","articleBody":"@ilevkivskyi @markshannon.\r\n\r\nMark observed that the typing module uses classes to represent types. This can be expensive, since e.g. the type List[int] really ought to be the tuple (List, int) but it's actually a class object which has a fair amount of overhead (though not as much as early versions of typing.py, since we now cache these class objects).\r\n\r\nIf we changed to tuples (or at least objects simpler than class object), we'd have a problem: The simpler object couldn't be subclassed from. But who subclasses List[int]? Then again, maybe simpler objects aren't the point?\r\n\r\nMark also pointed out that after\r\n```python\r\nfrom typing import List\r\nclass C(List[int]): pass\r\nprint(C.__mro__)\r\n```\r\nWe find that `C.__mro__` has 17 items!\r\n\r\nI confirmed this. The roughly equivalent code using collections.abc\r\n```python\r\nfrom collections.abc import MutableMapping\r\nclass C(MutableMapping): pass\r\nprint(C.__mro__)\r\n```\r\nhas only 7 items. And subclassing builtins.list\r\n```python\r\nclass C(list): pass\r\nprint(C.__mro__)\r\n```\r\nhas only three.\r\n\r\nThis affects performance, e.g. which is faster?\r\n```python\r\nclass C(list, Sequence[int]): pass\r\nC().append(1)\r\nclass D(Sequence[int], list): pass\r\nD().append(1)\r\n```\r\nOne append() call is 10% faster than the other.\r\n","author":{"url":"https://github.com/gvanrossum","@type":"Person","name":"gvanrossum"},"datePublished":"2017-05-17T23:02:14Z","url":"https://github.com/python/typing/issues/432"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:a4d57e62-acf9-7420-12a9-89fd1e8ed4e3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B888:18FDF5:3B4F93:4F9904:6B002908 |
| html-safe-nonce | 03ae4c34e5659b87a09d51d873b5542fef41cfe2808370565190a6c5e29905c3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODg4OjE4RkRGNTozQjRGOTM6NEY5OTA0OjZCMDAyOTA4IiwidmlzaXRvcl9pZCI6IjY4NzQ3MzAzNTQ2NDE0Nzk5NDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 01ea78e7c36ac91d4de0c3de29ef9133245709736b0c3a92444d71d6e6c36e0c |
| hovercard-subject-tag | issue:229511112 |
| 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/python/typing/432/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fa3facbffcb08ec8ccfdc1ebd90f34b07c568720450922e9b1f577b12aa46f79/python/typing/issues/432 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fa3facbffcb08ec8ccfdc1ebd90f34b07c568720450922e9b1f577b12aa46f79/python/typing/issues/432 |
| og:image:alt | @ilevkivskyi @markshannon. Mark observed that the typing module uses classes to represent types. This can be expensive, since e.g. the type List[int] really ought to be the tuple (List, int) but it... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gvanrossum |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typing git https://github.com/python/typing.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 24604008 |
| octolytics-dimension-repository_nwo | python/typing |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24604008 |
| octolytics-dimension-repository_network_root_nwo | python/typing |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width