Title: gh-88773: Added teleport method to Turtle library by liam-gersten · Pull Request #103974 · python/cpython · GitHub
Open Graph Title: gh-88773: Added teleport method to Turtle library by liam-gersten · Pull Request #103974 · python/cpython
X Title: gh-88773: Added teleport method to Turtle library by liam-gersten · Pull Request #103974 · python/cpython
Description: Fully implemented and tested a teleport method as described by the issue. This method behaves differently from the goto (or setpos) method, and can be especially helpful when creating and filling multiple separate objects. Implementation: There already exists a goto method, aliased as setpos | setposition | goto. It basically moves the turtle to the given position, but if the pen is down, it draws a line along the path. Additionally, the move is not instant, and you can see it go along the path to get to the destination. Users of the library may find themselves raising the pen, calling the method, and then lowering it so that a line doesn’t get drawn. Another issue with using goto for this is that regardless of whether the pen is raised, an "imaginary" line is still drawn from the current position to the destination. When filling is enabled, this invisible line acts as a boundary for the fill color. If one were creating multiple separate objects with filling enabled, they would need to run the exact code in the teleport method in order to fill them separately as desired. The following is a demo of the difference between goto and teleport for filling multiple objects. Justification: One might think we should just update the goto method to behave this way with a flag like teleport=True. However, all of the pen controlling methods are in one class, TPen, and all of the visual and position controlling methods are in another, TNavigator. The primary turtle class, RawTurtle(TPen, TNavigator) inherits methods from both of these, and since teleport needs access to methods and attributes in both of these classes, this is where it should be written. While it would be possible to give goto access to the TPen class via inheritance, this would be a messy refactor for what should be a distinct method. Resolves #88773 Issue: gh-88773
Open Graph Description: Fully implemented and tested a teleport method as described by the issue. This method behaves differently from the goto (or setpos) method, and can be especially helpful when creating and filling m...
X Description: Fully implemented and tested a teleport method as described by the issue. This method behaves differently from the goto (or setpos) method, and can be especially helpful when creating and filling m...
Opengraph URL: https://github.com/python/cpython/pull/103974
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:8d9df3a4-baf1-2725-cc1c-5c32c3f2d584 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | C3FC:6F9CA:3F1504:54781A:6969C33C |
| html-safe-nonce | f69f6bdff26e1475651c652a022e030b85f7b987173379debff8e505419cebb3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDM0ZDOjZGOUNBOjNGMTUwNDo1NDc4MUE6Njk2OUMzM0MiLCJ2aXNpdG9yX2lkIjoiODE0OTM0MDc2ODE4NzMwMjcxNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 18d50cb521ce7590fc018d7c9a60adcf7814101c2313e212ba1bf85f53584ff4 |
| hovercard-subject-tag | pull_request:1332213082 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,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/python/cpython/pull/103974/checks |
| twitter:image | https://avatars.githubusercontent.com/u/71834820?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/71834820?s=400&v=4 |
| og:image:alt | Fully implemented and tested a teleport method as described by the issue. This method behaves differently from the goto (or setpos) method, and can be especially helpful when creating and filling m... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width