Molecules of Swift #002.
#SwiftLang
https://ivantokar.com/posts/tuple-patterns-destructure-values-where-you-use-them
Molecules of Swift #002.
#SwiftLang
https://ivantokar.com/posts/tuple-patterns-destructure-values-where-you-use-them
If someone needs tuple accessors greater than that, please consult the previous comment about being a mad lad.
If someone needs tuple accessors greater than that, please consult the previous comment about being a mad lad.
Match tuple-like data by shape with match-case. 🧵
>>> point = (3, 4)
>>> match point:
... case (x, y):
... print(f"2D point ({x}, {y})")
... case (x, y, z):
... print(f"3D point ({x}, {y}, {z})")
...
2D point (3, 4)
#Python #DailyPythonTip
Match tuple-like data by shape with match-case. 🧵
>>> point = (3, 4)
>>> match point:
... case (x, y):
... print(f"2D point ({x}, {y})")
... case (x, y, z):
... print(f"3D point ({x}, {y}, {z})")
...
2D point (3, 4)
#Python #DailyPythonTip
(c) @mariozechner.at
spaces-mmo is the first step towards that. 😉
github.com/jeamy/phi-sp...
(c) @mariozechner.at
spaces-mmo is the first step towards that. 😉
github.com/jeamy/phi-sp...
Attributes and equality checks work automatically.
For immutability, pass "frozen=True". For orderability, pass "order=True".
Attributes and equality checks work automatically.
For immutability, pass "frozen=True". For orderability, pass "order=True".
Only storing data? Use a data class, an enum or a named tuple.
Only one method and no state to keep between calls? Write a function.
Only storing data? Use a data class, an enum or a named tuple.
Only one method and no state to keep between calls? Write a function.
Now a 3-table search join runs 1000x faster.
www.paradedb.com/blog/joins
Now a 3-table search join runs 1000x faster.
www.paradedb.com/blog/joins
You could look at match-case as like tuple unpacking with a lot more than just length-checking.
Patterns can also match specific VALUES in specific positions:
You could look at match-case as like tuple unpacking with a lot more than just length-checking.
Patterns can also match specific VALUES in specific positions:
There is always more work to do, but it's safe to say that the answer is now: "yes": www.paradedb.com/blog/joins
There is always more work to do, but it's safe to say that the answer is now: "yes": www.paradedb.com/blog/joins
tech_blogs_parade_db | Author: Stu Hood
#Databases
tech_blogs_parade_db | Author: Stu Hood
#Databases