You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: public/blogs/async-python.mdx
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,36 +4,36 @@ seoTitle: How Async Python Works Under The Hood
4
4
summary: How it really works under the hood
5
5
isReleased: true
6
6
isSequel: false
7
-
lastModDate: 2022-02-01T09:15:00-0401
8
-
firstModDate: 2022-02-01T09:15:00-0401
7
+
lastModDate: 2020-02-02T09:15:00-0401
8
+
firstModDate: 2020-02-02T09:15:00-0401
9
9
minutesToRead: 7
10
10
tags:
11
11
- 'python'
12
12
- 'async'
13
13
- 'typing'
14
14
---
15
15
<C>
16
-
You may have encountered explanations that appear overly simplistic, merely emphasizing the importance of async programming without delving into the mechanics or exploring high-level APIs such as the <Lhref="https://github.com/python/cpython/tree/main/Lib/asyncio">`asyncio`</L> module in the standard library. Clearly, you already understand the significance and use cases, so let's cut to the chase and see how it actually works.
16
+
You may have encountered explanations that appear overly simplistic, merely emphasizing the importance of async programming without going into the mechanics or exploring high-level APIs such as the <Lhref="https://github.com/python/cpython/tree/main/Lib/asyncio">`asyncio`</L> module in the standard library. Clearly, you already understand the significance and use cases, so let's cut to the chase and see how it actually works.
17
17
</C>
18
18
<H2>Pausing</H2>
19
19
<C>
20
-
So, what's the deal with async functions in Python? We all know they pause execution until some operation resolves, right? but how does this mechanism truly operate? To understand this, let's take a step back and delve into the foundational concept:
20
+
So, what's the deal with async functions in Python? We all know they pause execution until some operation resolves, right? but how does this mechanism truly operate? Let's take a step back and check out a foundational concept:
21
21
</C>
22
22
<H2>Iterators</H2>
23
23
<C>
24
-
An iterator serves as a programming object that facilitates the systematic traversal of a <Lhref="https://en.wikipedia.org/wiki/Container_(abstract_data_type)">container</L>, granting access to its elements one at a time. It maintains the state of the traversal, allowing the iterator to pause execution after processing a specific item. To continue, a call to the `next()` method, typically named by convention, is made. This call prompts the iterator to resume execution and retrieve the next element in the sequence. This iterative process persists until the iterator reaches the end of the container, and this approach is commonly referred to as lazy evaluation.
24
+
An iterator serves as a programming object that facilitates the systematic traversal of a <Lhref="https://en.wikipedia.org/wiki/Container_(abstract_data_type)">container</L>, granting access to its elements one at a time. It maintains the state of the traversal, allowing the iterator to pause execution after processing a specific item. To continue, a call to the `next()` method, which is typically named by convention, is made. This call prompts the iterator to resume execution and retrieve the next element in the sequence. This iterative process persists until the iterator reaches the end of the container, and this approach is commonly referred to as lazy evaluation.
25
25
</C>
26
26
<S3/>
27
27
<C>
28
-
The key concepts here are the actions of pausing, resuming, and awaiting the next element. These notions become particularly relevant and meaningful when correlated with the concept of asynchronous functions, the idea of pausing and resuming execution aligns with the asynchronous nature of handling tasks, allowing the program to efficiently manage and switch between various operations without blocking the entire execution flow. The term "await" further emphasizes this waiting aspect, where the program can await the completion of a specific asynchronous task before proceeding, we call this task a <Lhref="#related-objects">``Future``</L> , echoing the behavior of iterators in a more dynamic and non-blocking context.
28
+
The key concepts here are the actions of pausing, resuming, and awaiting the next element. These notions become particularly relevant and meaningful when correlated with the concept of asynchronous functions, the idea of pausing and resuming execution aligns with the asynchronous nature of handling tasks, which allows the program to efficiently manage and switch between various operations without blocking the entire execution flow. The term "await" further emphasizes this waiting aspect, where the program can await the completion of a specific asynchronous task before proceeding, we call this task a ``Future``, more on this <Lhref="#related-objects">later.</L>
29
29
</C>
30
30
<H2>How Do I Create An Iterator</H2>
31
31
<C>
32
32
To define your own iterator you have to adhere to the iterator <Lhref='/blog/python-protocols'>protocol</L> meaning you have to define `__iter__` and `__next__` methods
33
33
</C>
34
34
<H3>**``__iter__``**</H3>
35
35
<C>
36
-
The purpose of the ``__iter__`` method is to return the iterator object itself. When this method is implemented in a class, it allows instances of that class to be used in a ``for`` loop or any other iteration context. By returning the iterator object, it enables the iteration over the elements of the associated object.
36
+
The purpose of the ``__iter__`` method is to return the iterator object itself. When this method is implemented in a class, it allows instances of that class to be used in a ``for`` loop or any other iteration context. In other words, it enables the iteration over the elements of the associated object.
37
37
</C>
38
38
<H3>**``__next__``**</H3>
39
39
<C>
@@ -99,7 +99,7 @@ The invocation of `__anext__` involves the use of the `async` and `await` keywor
99
99
</C>
100
100
<H2id="what-is-an-awaitable?">What Exactly Is An **``awaitable``**</H2>
101
101
<C>
102
-
An ``awaitable`` is an object that can be used with the `await` keyword within an async function. It typically represents an operation that may not be immediately completed, such as an asynchronous task or a <Lhref="#related-objects">``Future``</L> object. Essentially, an awaitable is anything that can be awaited for its completion, allowing the program to proceed with other tasks.
102
+
An ``awaitable`` is an object that can be used with the `await` keyword within an async function. It typically represents an operation that may not be immediately completed, such as an asynchronous task or a <Lhref="#related-objects">``Future``</L> object.
Copy file name to clipboardExpand all lines: public/blogs/front-end-performance.mdx
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,17 @@ seoTitle: How to optimize your frontend perf metrics
4
4
summary: How to optimize your frontend perf metrics
5
5
isReleased: true
6
6
isSequel: false
7
-
lastModDate: 2021-10-02T09:15:00-0401
8
-
firstModDate: 2021-10-02T09:15:00-0401
7
+
lastModDate: 2021-10-04T09:15:00-0401
8
+
firstModDate: 2021-10-04T09:15:00-0401
9
9
minutesToRead: 5
10
10
tags:
11
11
- 'performance'
12
12
- 'front-end'
13
13
- 'react'
14
14
---
15
-
15
+
<C>
16
+
*Guide for the impatient*
17
+
</C>
16
18
<C>
17
19
Before I start, I just want to say that you have to always ensure that there's something happening, even if you anticipate heavy client-side load. Display something interesting upon loading instead of leaving the page blank, otherwise, users might assume it's broken and leave, especially with the short attention span these days, if people don't see something interesting they're going to bounce.
Copy file name to clipboardExpand all lines: public/blogs/fundamentals.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ The question is, how do I learn or where do I even look ? The answer is simple:
37
37
38
38
<H2>Getting Duped</H2>
39
39
<C>
40
-
You know what's the best way to make money in a gold rush? Sell shovels. In the 21st century, you sell people dreams.
40
+
You know what was the best way to make money in the gold rush? Selling shovels. In the 21st century, you sell people dreams.
41
41
</C>
42
42
<C>
43
43
Stop falling prey to the false promises peddled by individuals and institutions eager to take your money by selling you unrealistic dreams. Just as you can't expect to achieve six-pack abs and bulging biceps in four weeks with a magical training program advertised by some juiced up guy on Instagram when you haven't stepped in the gym for a day in your life, you shouldn't expect to become a "full-stack" developer in 3 months through bootcamps.
@@ -81,7 +81,7 @@ I can't precisely outline a <L href="https://roadmap.sh">roadmap</L> for you bec
81
81
Just pick a thing, complex or simple, anywhere that you think might be interesting, then keep asking why does this thing exist? What problem is it trying to solve? and follow the trail. By doing so, you'll find yourself going deep into the <Lhref="https://youtu.be/zE7PKRjrid4?si=24T8DoioD-7WotOC&t=93">rabbit hole</L>. It is an intricate journey, but after such a deep dive, you'll find yourself surpassing 99% of individuals out there who don't ask questions and don't even put in any effort at all, just accepting the information as is, and that goes out for everything not just software engineering.
82
82
</C>
83
83
84
-
<H2>Conclusion</H2>
84
+
<H2>The Backwards Education System</H2>
85
85
<C>
86
86
Unfortunately, education that's most marketed out here often falls short of its ideal purpose. It tends to prioritize surface-level familiarity with an array of tools and technologies—many of which are ephemeral, destined to fade into obsolescence within a few short years, just to make a quick buck off of people that lack guidance. Genuine mastery, however, requires transcending the superficial and understanding the fundamental principles that underpin the field. Rather than merely focusing on the latest frameworks and trends, you should strive to grasp how technologies truly function and question the abstractions provided by these different tools, isn't this what <Lhref='/blog/shitty-colleges'>colleges</L> are for?
87
87
As you dive deeper into the journey, with time, you'll inevitably begin to question the validity of certain concepts you've came across along the way. When you find yourself forming your own opinions and insights, it's a sign that you're quite advanced in your mastery of the craft.
0 commit comments