ohmypy Profile Banner
Anton Zhiyanov Profile
Anton Zhiyanov

@ohmypy

Followers
6K
Following
2K
Media
247
Statuses
2K

Open source maintainer. Writing interactive technical books at https://t.co/WIgisTXlhd

Joined March 2013
Don't wanna be here? Send us removal request.
@ohmypy
Anton Zhiyanov
9 months
Just a not-so-humble reminder that the best way to add interactive examples to your product docs, online course, or blog is with Codapi. It's lightweight, battle-tested, and open source.
Tweet card summary image
codapi.org
Embed executable code snippets directly into your product documentation, online course or blog post.
0
6
42
@ohmypy
Anton Zhiyanov
9 days
I've been working with the errors package for a while, but I only recently noticed that it has an ErrUnsupported sentinel (Go 1.21+). It indicates that the requested operation can't be performed because it's not supported. Have you ever used ErrUnsupported?
Tweet media one
5
5
51
@ohmypy
Anton Zhiyanov
10 days
All jokes aside, I've implemented promises and async/await in Go. Just make sure you NEVER use them.
Tweet card summary image
github.com
Promises and async/await in Go. Contribute to nalgeon/azor development by creating an account on GitHub.
3
2
48
@ohmypy
Anton Zhiyanov
13 days
P.S. I totally made that up. Here's your async/await implementation, though :). Performed by a highly trained individual; DO NOT try this at home.
Tweet media one
5
5
159
@ohmypy
Anton Zhiyanov
13 days
Good news for JavaScript and Python folks: async/await is coming to Go, so you'll feel right at home!
Tweet media one
49
34
713
@ohmypy
Anton Zhiyanov
16 days
The new chapter of my interactive Go Concurrency book covers signaling, one-time execution, and object pools. If you think channels are the only way for goroutines to communicate, check it out!.
Tweet card summary image
antonz.org
Sending events between goroutines.
0
19
148
@ohmypy
Anton Zhiyanov
18 days
I've updated the list of Go features by version. Now, each feature has ➀ a link to the documentation, ➁ a link to the proposal, and ➂ a link to the commits. It's fascinating to see how Go has changed over the years.
Tweet card summary image
antonz.org
Which major features appeared in which versions of Go.
3
25
123
@ohmypy
Anton Zhiyanov
19 days
I asked several hundred Go developers what they like most about the upcoming 1.25 release. Here are the results:. ➀ JSON v2.➁ GOMAXPROCS, synctest, new GC.➂ WaitGroup.Go
Tweet media one
2
10
93
@ohmypy
Anton Zhiyanov
20 days
Going back to testing, yet another example is the testify/assert package. Similar to Python's TestCase, it has functions like Equal, NotEqual, EqualError, Error, NoError, ErrorAs, ErrorIs, etc. Even Greater and GreaterOrEqual!. While designing my own test assertions package, I
Tweet media one
2
0
9
@ohmypy
Anton Zhiyanov
20 days
Another example of a wide interface is Go's Regexp. Here's a sneak peak:. FindAllString.FindAllStringIndex.FindAllStringSubmatch.FindAllStringSubmatchIndex.FindString.FindStringIndex.FindStringSubmatch.FindStringSubmatchIndex. Compare to a third-party regexp2 package:.
1
0
7
@ohmypy
Anton Zhiyanov
20 days
One crucial piece of advice John Ousterhout gives in his book "Philosophy of Software Design" is about deep modules. Module depth is a way of thinking about cost versus benefit. The benefit provided by a module is its functionality. The cost of a module (in terms of system.
1
3
27
@ohmypy
Anton Zhiyanov
21 days
You don't need testify/assert to write clear, simple, and expressive Go tests.
Tweet card summary image
antonz.org
Equal, Err and True are quite enough.
2
9
29
@ohmypy
Anton Zhiyanov
23 days
Okay, I did it again. I reimplemented Redis using Postgres. Key/value, expiration, maps, lists, sets, and sorted sets — everything in your favorite database. With a Redis-compatible API and wire protocol.
Tweet card summary image
github.com
Redis re-implemented with SQL. Contribute to nalgeon/redka development by creating an account on GitHub.
7
17
175
@ohmypy
Anton Zhiyanov
27 days
The SQL syntax for SQLite and Postgres is *very* similar. Out of the 21 most complex SQLite queries that handle sorted set operations, I only need to change one to make it work with Postgres. The others work as they are.
Tweet media one
0
0
16
@ohmypy
Anton Zhiyanov
27 days
I made it through the blockchain hype wave, but I'm not so sure about the current one. I understand the excitement, but I'd rather see 1/10 of the AI-related posts I see now. Maybe even 1/50.
1
0
16
@ohmypy
Anton Zhiyanov
28 days
Maintaining razor-sharp focus and saying "no" all the time is not what we are good at. But recognizing this is the first step toward achieving simplicity.
0
0
5
@ohmypy
Anton Zhiyanov
28 days
Another reason why simple is difficult is that you have to pick your battles carefully. Nothing is easier than saying "yes" to every feature, but that just leads to a complex, half-baked mess.
1
0
5
@ohmypy
Anton Zhiyanov
28 days
Creating simple products is hard. Most of us have no idea what "simple" really means (not "easy"!), or how to achieve it. We're taught to embrace complexity and even enjoy it.
1
1
18
@ohmypy
Anton Zhiyanov
29 days
It's such a relief to switch from standard library assertions to more concise ones 😅
Tweet media one
Tweet media two
3
0
5
@ohmypy
Anton Zhiyanov
29 days
Not only is @boyter's scc a great tool for counting lines of code, but it also values my work more than anyone ever will. $22,607 for a two-file Go package! That's why I appreciate it so much :)
Tweet media one
0
3
20
@ohmypy
Anton Zhiyanov
30 days
How about a micro test assertions Go package with flexible error checking?. Only 100 loc. I've named it "be" :).
Tweet media one
3
1
29