最新发布第12页
排序
Day 10 – 函数输出
单返回值 函数通过 return 关键字,进行函数的输出。 def function_name(input_parameter): <body of function that uses input_argument> return output 示例代码 def format_name(f_nam...
Day 18 – Turtle 与 GUI
绘制正方形 利用turtle进行正方形的绘制 # 导入模块 import turtle for i in range(4): turtle.forward(100) turtle.left(90) my_screen = turtle.Screen() # 点击屏幕推出GUI界面 my_screen.ex...
Swift Concurrency by Example
Async/await Sequences and streams Tasks and task groups Actors Testing Solutions
Windows 部署 Ollama
下载 Ollama在 https://ollama.com/download/ 页面下载,系统对应的 Ollama 程序。部署 Ollama安装 Ollama双击 Ollama 的程序,即可进行 Ollama 的安装。修改环境变量Ollama 的默认模型存储路径...
Day 16 – 面向对象编程(OOP)
面向对象编程(Object Oriented Programming, OOP),模拟事物为对象(Object),每个对象都有自己的属性(attribute)以及方法(methods)。 对象与类 在 OOP 中,有类(Class)以及对象(Obje...
Day 20 – 贪吃蛇(上)
设置游戏屏幕 from turtle import Screen screen = Screen() # 设置屏幕大小 screen.setup(width=600, height=600) # 设置背景颜色 screen.bgcolor('black') # 设置标题 screen.title('贪吃蛇')...
What calls the first async function? 什么调用第一个异步函数?
You can only call async functions from other async functions, because they might need to suspend themselves and everything that is waiting for them. This leads to a bit of a chicke...
Understanding actor initialization 了解 actor 初始化
Swift's actors run on their own executor most of the time, so they manage how and where their work is done. However, during the actor's initialization its executor isn't ready to t...
Who decides which actor code runs on? 谁决定在哪个 actor 代码上运行?
One common confusion with actors comes in deciding exactly where code runs, because just adding @MainActor and hoping for the best is rarely good enough.与 Actor 的一个常...
How to serialize parameterized tests with Swift Testing 如何使用 Swift Testing 序列化参数化测试
Swift Testing's parameterized tests allow us to send multiple values into a single test, and they'll be run in parallel for maximum performance. If you don't want this – if you wa...


