Title: Add PEP 484 -- Type Hints · Issue #368 · python-ldap/python-ldap · GitHub
Open Graph Title: Add PEP 484 -- Type Hints · Issue #368 · python-ldap/python-ldap
X Title: Add PEP 484 -- Type Hints · Issue #368 · python-ldap/python-ldap
Description: Python supports type hints to improve static analysis: https://www.python.org/dev/peps/pep-0484/ This helps to identify cases, were wrong types are passed into functions et al by using type checkers likehttp://mypy-lang.org/ or https://g...
Open Graph Description: Python supports type hints to improve static analysis: https://www.python.org/dev/peps/pep-0484/ This helps to identify cases, were wrong types are passed into functions et al by using type checker...
X Description: Python supports type hints to improve static analysis: https://www.python.org/dev/peps/pep-0484/ This helps to identify cases, were wrong types are passed into functions et al by using type checker...
Opengraph URL: https://github.com/python-ldap/python-ldap/issues/368
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add PEP 484 -- Type Hints","articleBody":"Python supports type hints to improve static analysis:\r\n\u003chttps://www.python.org/dev/peps/pep-0484/\u003e\r\nThis helps to identify cases, were wrong types are passed into functions et al by using type checkers like\u003chttp://mypy-lang.org/\u003e or \u003chttps://github.com/google/pytype/\u003e.\r\n\r\n`python-ldap` does not yet seem to contain those annotations nor am I aware of any project doing that.\r\nThose annotation can either we added directly in the library like\r\n\r\n\u003e def func(arg: str, val: int = 0) -\u003e Tuple[int, str]\r\n\r\nsince Python 3.5 or in a Python-2 backward compatible way as\r\n\r\n\u003e def func(arg, val=0): # type: (str, int) -\u003e Tuple[int, str]\r\n\r\nAs an alternative the annotations can be put into so-called \"stub files\" names \"*.pyi\", which are collected by \u003chttps://github.com/python/typeshed\u003e, but inline annotations are preferred as they are easier to keep in sync.\r\n\r\n\r\nI started working on that, but other projects have preempted that\r\neffort. My current work is at\r\n\u003chttps://github.com/univention/typeshed/commit/8fc5f796d4ef009e5cf8282575ae304994170b25\u003e,\r\nbut it not much more then generating the stubs using `stubgen`.\r\nIf someone wants to join that effort that is much appreciated.\r\n\r\n\r\nThis was proposed to the [Mailing List](https://mail.python.org/pipermail/python-ldap/2020q2/004098.html).\r\n@tiran proposed to start the work only after the Python 2 legacy code is removed:\r\n\u003e we are planning to drop support for Python 3.5 and earlier in the next\r\n\u003e version of python-ldap. This would make it simpler to add signatures for\r\n\u003e type hints directly to the code base. Patches are welcome, but please\r\n\u003e wait until we have finalized Python 2 cleanup in master.","author":{"url":"https://github.com/pmhahn","@type":"Person","name":"pmhahn"},"datePublished":"2020-07-01T16:41:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/368/python-ldap/issues/368"}
| 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:6e04bc0c-f0ec-4614-70bd-f97a766f94df |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AF0A:140E58:49C542B:5F94147:697500FB |
| html-safe-nonce | 9bad356d689508d117f42ee5b8ad79a55b704dd336a587cff2280892d57b5669 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjBBOjE0MEU1ODo0OUM1NDJCOjVGOTQxNDc6Njk3NTAwRkIiLCJ2aXNpdG9yX2lkIjoiNTk1MDI1MDQ0NTc4NjM0MTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d0f75a02404ec327be50f042b0abd8c8daa8ddfe579ca0a404a1e2fe10f7115f |
| hovercard-subject-tag | issue:649122595 |
| 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-ldap/python-ldap/368/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b73e8649952fd770895e71fce3bff7212706a74145e53b00d11ec32e1c9295fc/python-ldap/python-ldap/issues/368 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b73e8649952fd770895e71fce3bff7212706a74145e53b00d11ec32e1c9295fc/python-ldap/python-ldap/issues/368 |
| og:image:alt | Python supports type hints to improve static analysis: https://www.python.org/dev/peps/pep-0484/ This helps to identify cases, were wrong types are passed into functions et al by using type checker... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pmhahn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4a4bf5f4e28041a9d2e5c107d7d20b78b4294ba261cab243b28167c16a623a1f |
| turbo-cache-control | no-preview |
| go-import | github.com/python-ldap/python-ldap git https://github.com/python-ldap/python-ldap.git |
| octolytics-dimension-user_id | 33895877 |
| octolytics-dimension-user_login | python-ldap |
| octolytics-dimension-repository_id | 111794776 |
| octolytics-dimension-repository_nwo | python-ldap/python-ldap |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 111794776 |
| octolytics-dimension-repository_network_root_nwo | python-ldap/python-ldap |
| 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 | 488b30e96dfd057fbbe44c6665ccbc030b729dde |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width