Python 工匠

The answer implements the double meaning of the requirement in the code

Original link: https://www.piglei.com/articles/the-answer-is-in-the-code-fulfill-requirements/ Realize the “rock, paper, scissors” game One day, I saw an interesting discussion in a Python technical group. The discussion started with such a requirement: Topic: Write code to simulate the “rock, paper, scissors” game. Players A and B play 10 random games and print the results. Requirements: Use the number 0 …

The answer implements the double meaning of the requirement in the code Read More »

If programming is writing

Original link:https://www.zlovezl.cn/articles/if-programming-is-writing/ Many people compare programming to writing. For example, Bruce Eckel, the author of “Thinking in Java”, said: “A programmer is a writer.” There are indeed many similarities between the two. Good articles and good code are both inexact structures. with beautiful expression. When writing, everyone can use words to make sentences and form …

If programming is writing Read More »

Several function parameter passing modes of Go

Original link:https://www.zlovezl.cn/articles/go-func-argument-patterns/ 1. Common parameters The Go language supports calling functions by passing parameters in order. Here is an example function: // ListApplications 查询应用列表func ListApplications(limit, offset int) []Application { return allApps[offset : offset+limit] } calling code: ListApplications(5, 0) When you want to add new parameters, you can directly modify the function signature. For example, the …

Several function parameter passing modes of Go Read More »

4 Tips for Designing Server-Side Software Configurations

When designing and developing server-side (back-end) software, configuration files are an inescapable topic. A configuration file is a special file used to store various configurable items. Every software presets some default configurations, but these defaults may not work in all situations. Therefore, in different environments, we often need to extend and modify them with configuration …

4 Tips for Designing Server-Side Software Configurations Read More »