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

Suggestion: The Mental Game of Python #10

Open
mmiraglio opened this issue May 25, 2023 · 1 comment
Open

Suggestion: The Mental Game of Python #10

mmiraglio opened this issue May 25, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@mmiraglio
Copy link

Some time ago I watched on Youtube this talk from Raymond Hettinger about the Mental Game of Python where he gives some examples of cognitive load. If you are interested in the topic you might find it useful.

I've asked ChatGPT to make a summary of the talk:

In the talk "The Mental Game of Python," Raymond Hettinger, a Python core developer, presents ten programming strategies using live examples. Here are a few key points from the talk:

  1. Chunking and Aliasing: Hettinger brings up the theory that the human mind can only handle/remember 7 pieces of information at a time, give or take 2. Any more information can cause cognitive overload and errors. Hence, in programming, he emphasizes the importance of ensuring that programmers can use these cognitive 'slots' to improve the code, rather than having to decipher complex logic. This is achieved by modularizing and standardizing through functions, modules, and packages. Hettinger uses Python's random module to highlight the importance of chunking and modular code (source).

  2. Problem Solving: Hettinger quotes the Feynman method of problem-solving: write down a clear problem specification; think very, very hard; write down a solution. He demonstrates the strategies of incremental development and solving simpler programs using the example of a tree walker, showing how they can help build programs that solve complex problems (source).

  3. DRY Principle: Hettinger also discusses the Don't Repeat Yourself (DRY) principle in the context of object-oriented programming (OOP), classes, and inheritance. He suggests that programmers should manually repeat tasks until patterns emerge before moving code into functions, with examples from file conversion to illustrate his point (source).

  4. OOP as a Graph Traversal Problem: Hettinger argues that OOP is essentially a graph traversal problem. Given the richness of the Python ecosystem, he suggests that there's often no need to create new classes. Instead, programmers can identify their current position on the 'graph,' check where they need to go, and use available methods or write new ones to achieve their goals (source).

@zakirullin
Copy link
Owner

@mmiraglio Thank you so much! I am definitely interested in the topic, I'll give it a look.

Special thanks for ChatGPT summary

@zakirullin zakirullin added the enhancement New feature or request label May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants