Dart on keyword
摘要:on 在 mixin 中的使用 abstract class Animal { // properties String name; double speed; // constructor Animal(this.name, this.speed); // abstract method void
阅读全文
Dart final const
摘要:Dart中的const和final 在Dart编程语言中,const和final关键字都用于声明常量。虽然它们的目的相同,但在语义和使用上略有不同。 const const关键字用于创建不可变(immutable)的常量,这些常量的值必须在编译时就已知。const可以用于变量、方法和集合(如List
阅读全文
Dart try on catch
摘要:Dart try catch on finally void main() { int a = 12; int b = 0; int res; try { res = a ~/ b; } on UnsupportedError { // it is used as we know waht erro
阅读全文
Python GIL 和 多处理器
摘要:当谈到Python的多线程时,人们经常会提到全局解释器锁(Global Interpreter Lock,GIL)。GIL是CPython解释器中的一个机制,它确保同一时间只有一个线程在解释Python字节码。这导致了Python的多线程执行在某种程度上是单线程化的,无法充分利用多个处理器。现在让我
阅读全文