对 Cursor 的一些观察和思考
2025 1 26 05:32 PM 0 条评论 24 次查看
をつあおにまで GFW!
2025 1 26 05:32 PM 0 条评论 24 次查看
2024 12 26 11:13 PM 0 条评论 55 次查看
boto3
)来进行调用,没有异步实现。2024 9 30 05:19 PM 0 条评论 104 次查看
2024 8 9 12:26 AM 0 条评论 435 次查看
2024 7 14 11:11 PM 0 条评论 428 次查看
2024 5 29 07:45 PM 0 条评论 278 次查看
ProxiesTypes
:URLTypes = Union["URL", str]
ProxyTypes = Union[URLTypes, "Proxy"]
ProxiesTypes = Union[ProxyTypes, Dict[URLTypes, Union[None, ProxyTypes]]]
可以看出,dict[str, str]
应该是符合它的参数签名的,然而我传入一个 dict[str, str]
参数后,Pylance 却会报错,这让我大为不解。from typing import Mapping
a: dict[int, int] = {}
b: dict[int, int | str] = a # error:
# Expression of type "dict[int, int]" is incompatible with declared type "dict[int, int | str]"
# "dict[int, int]" is incompatible with "dict[int, int | str]"
# Type parameter "_VT@dict" is invariant, but "int" is not the same as "int | str"
# Consider switching from "dict" to "Mapping" which is covariant in the value type
c: Mapping[int, int | str] = a
d: Mapping[int | str, int] = a # error:
# Expression of type "dict[int, int]" is incompatible with declared type "Mapping[int | str, int]"
# "dict[int, int]" is incompatible with "Mapping[int | str, int]"
# Type parameter "_KT@Mapping" is invariant, but "int" is not the same as "int | str"
是不是很奇怪,为啥 dict[int, int]
和 dict[int, int | str]
或 Mapping[int | str, int]
都不兼容,而与 Mapping[int, int | str]
兼容?2024 5 16 12:17 AM 2 条评论 538 次查看
2024 5 14 12:12 AM 0 条评论 294 次查看
2024 4 23 02:22 AM 0 条评论 263 次查看
SELECT ... FOR UPDATE
的形式来加锁。test
有一个被索引的列 a
,有一行 a
为 100 的数据。当执行 SELECT * FROM test WHERE a = 1 FOR UPDATE
后,其他事务无法插入任何 a < 100
的数据,因为被这两把锁给锁住了。2024 4 2 10:47 PM 0 条评论 1590 次查看
分类:编程 标签:无