3 reasons you should be github-maxxing:
1. It grows your "alpha" network
When you keep creating cool code, the drooling masses on LinkedIn probably will not notice.
But the biggest players will. They will start to know, like and trust you, and beyond that - respect you. So that when you cross paths professionally, they are more strongly inclined to use their influence to get you that job offer, or on that project you want.
2. It gives you constant feedback
Every time you add a new feature, and let people know about it (more that below), something pretty special happens:
You get feedback.
This feedback can be a lot of fun, or it can be pretty unpleasant, or anywhere in between...
But any which way, it will be valuable.
The most fun feedback is glowing praise from folks you look up to you. On the other extreme, sniping comments from the above-mentioned drooling masses can be entertaining too, once you learn to laugh at them. The most interesting feedback may be none at all; if no one seems to care, that also tells you something important.
Either which way, you only get this priceless feedback if you are GitHub maxxing in the first place.
3. It focuses your learning like nothing else
If you want to become truly skilled on some topic, some tech, some stack or whatever techie thing...
Building an open source project for it will accelerate your growth like nothing else.
There's a "building in public" factor that focuses your attention - because you know if you cut sloppy corners, there will be a consequence for that. So it is easy to invest your best.
There is the continual feedback you get (see #2) that directly enhances your rate and depth of learning, skill-building, and mastery.
And you'll naturally make it a priority to focus on what is most valuable to you. You won't get distracted with side-quest projects that do not have lasting value.
Here is the most self-destructive code a Python developer can write:
----
try:
do_something()
except:
pass
----
I call this "The most diabolical Python antipattern"
What this does is execute the code inside the "try" block. And if an error is raised - ANY exception whatsoever - you simply will not know.
The reason is that the "except: pass" will silently suppresses the exception. It hides from you the fact that there was an error at all.
Exceptions are good, because they immediately tell you something is wrong, and give you information that may help you fix it.
Without that, you get bugs that take hours or even days to figure out. Like I said: diabolical.
It doesn't just hide normal exceptions, like TypeError (if you accidently add an integer to a string), or ValueError (if you convert a string like "not a number" into an int()), or DoesNotExist (if a database query in your Django application unexpectedly fails).
If you mis-type a variable name? That's NameError, which is an exception. COMPLETELY HIDDEN by this diabolical dark pattern.
The worst example I ever encountered cost us a whole week of engineer time, at one of my previous startups. I tell that story in chapter 5 of the book.
And it is pretty easy to avoid. Just refuse to type "except: pass". Always catch a specific exception, or at least log that something has happened.
This tactic will deliver you from a lot of agony. Assuming you are smart enough to use it, of course.
My favorite metric for my progress as a coder:
"How little time do I spend debugging?"
I love how this captures several dimensions:
* Am I making fewer bugs to begin with?
* When I do make bugs, am I deciphering and fixing them quickly?
* Over time, as the application fleshes out, and the codebase becomes larger and more complex... with more opportunities for hairy intertwined bugs... as this progresses, am I architecting my code and tests to avoid getting bogged down?
Bonus: all else equal, the less of my life I spend debugging, the happier I am, and the more I enjoy creating software to begin with.
What do you think? Is this a metric you like? Or do you have a better one?
As AI coding tools improve, new opportunities are emerging for those who combine deep technical knowledge with the mental flexibility to augment their productivity with new AI technologies.
If you want to write better Python, learn OOP.
It's useful. Which is why pretty much all realistic Python codebases are built on classes and objects.
Writing classes is creating new building blocks. The better you get at that, the easier it is for you to write great code!
The two most important exceptions in Python
There are over 60 exception types built into Python. And honestly, most of them you don't need to know about.
But there are two you ought to memorize:
TypeError, and ValueError.
Both are well demonstrated with int().
int() accepts strings. If you write int("42"), it returns 42. But if you write int("forty two"), it doesn't return anything. Instead, it raises ValueError.
ValueError means "I can take this type of data, but not this specific value." int() takes strings, but not all strings.
Now, if you write int([42]), that also triggers an exception - raising TypeError.
TypeError means "I cannot accept the type of data you are giving me." int() does not accept lists.
Internalizing the above benefits you bigtime, in two ways.
First, you spend less time in debugging hell. When you see a stack trace using one or the other, you more immediately know what went wrong, and how to fix it. That is Bigtime Benefit Number One.
Number Two is more subtle:
The code you write becomes more of a joy to work with, by you and others.
Because it is more aligned with how Python itself works. When you write code raising TypeError, or ValueError, you do it congruently with how Python raises them. You avoid an 'uncanny alley' effect of mis-using these exceptions every Python coder sees every day. So reasoning about your code becomes smoother and simpler.
All of which makes your coding life better. And better for those who work with you, interacting with your code. Which soon or sooner will come right back to benefit you too, in other ways.
Something to think about.
Panda's powerful abstractions
Here's a function I wrote:
This is pulled from real production code. "df" is a Pandas dataframe. And this function, load_df(), is a "building block" function. It's used to load data from a variety of different CSV files, and process them into dataframes that are useful in my program.
Notice the "extra" argument. From what you see in this fragment, what does "extra" do?
More precise questions:
1) What's the TYPE of extra?
Answer: It's a function.
2) What does it return?
Answer: It returns a dataframe.
3) What does it let you do?
Answer: Anything you want with the input dataframe. You can do any kind of modification, transformation, filtering, or even constructing a totally different dataframe.
In other words... extra() is a customization hook. When you're writing a function that will load a dataframe from a CSV file, and you want to use load_df()... but you also need to do some extra, specific customization... you can just write your own extra function to do that.
Here's an example, pulled from the same codebase:
See how you're creating a function, extra_filter(), and passing it in as an argument to load_df(). You don't CALL extra_filter() yourself; load_df() does.
This is a good example of one of Python's most powerful and important abstractions:
Function objects.
And it's realistic. Literally - the above is copied verbatim from production code I wrote, solving a real business problem.
Which makes now a good time to think about how you can use this idea... in your own code, today.
How can you make your own code more expressive, more powerful, more impressive, with customization hooks like this?
P.S. Another, more complex example:
Do you see how it fits the same general pattern? Defining an "extra" function, and passing it to load_df().
'The danger of toy code examples is twofold: they are often too abstract to make anyone go “ooh, that’s compelling”, and they are easily refuted with “I would never write it that way anyway”.
The danger of overly complex examples is that they provide a convenient strawman for critics of the proposal to shoot down (“that’s obfuscated”).
Yet there is some use for both extremely simple and extremely complex examples: they are helpful to clarify...'
- From PEP 572
@catalinmpit By falling in love. There is a field of creative joy you can tap into, pulling you through hours of deep intense focus. When you learn to hold an enthralling incremental vision for each chunk of the software system as it becomes more fully real, you have no interest in stopping.
The core values of Powerful Python
Everything I attempt to teach you centers around three core values:
1. Professionalism
2. Craftsmanship
3. Fun
Professionalism means you can be relied on. You do what you say, and you follow through. Every team you join, you carry your weight, and more. You have standards, those standards are high, and you are an example to those around you. To the point just having you on the team makes people feel more confident the project will be a raving success.
Craftsmanship is about excellence in engineering. Writing code you are proud of. That OTHERS are proud of. Hunting down that last farthing of quality, even in some corner of the codebase no one else will ever look at. You take pride in your work, not for the approval of others, but for the approval of yourself.
Fun is about making this life journey worthwhile. That we work our job to take care of ourselves and those we love, yes. And that includes creating the most enjoyable memories we can, the best life experiences we can. And if we are going to spend hours today writing code, let's have a blast so we are excited to do it again tomorrow.
You see, this is about more than Python tips n tricks.
Python is just how I get my hooks in ya. The real goal is to elevate your mastery and timeless skills. To help you harvest that potential you know you have.
And it is important to keep this in mind, as we inhale the daily onslaught of details about some patch level or whatever that is just going to be obsolete in a few months. That we keep our eyes on what has the greatest lasting value.
When to use logging:
As often as you can.
When you insert logging calls early and often, then by the time you need them, your program will have a thorough set already installed... reporting heaps of useful information for troubleshooting, monitoring, and more.
The new reality of remote work
"Remote jobs are only for the top 1%."
So sayeth a post I recently found online.
Because the world had shifted heavily to remote work for a while...
And we all know it has shifted back.
But there is hope. When you write code for a living, it is logistically quite possible to work remotely. Giving you more freedom in your schedule, reclaiming an hour(s) each day from commuting, and enjoying a sweeter quality of life than those stuck all day in the office.
The employer just has to want you badly enough they will grant your demand for remote work. Hence that "1%" post, which holds much truth.
As far as Python is concerned, what skills are needed to be in this "top 1%"?
A) Great code organization skills, so you can create powerful and reusable components at diverse levels. Classes, modules, libraries, and so on.
B) Writing robust, rock-solid code. Which means writing testable code, and high-quality tests that cover it well.
C) Grokking Python's memory model so you avoid memory bottlenecks when processing larger amounts of data. (Failing to do this shoves performance off a cliff.)
D) Dexterity with the higher-order "metaprogramming" patterns used in the source of Python's most famous libraries... allowing you to rapidly evolve increasingly complex systems, and write programs doing things others never even dream of. (This sets you apart in interviews like nothing else.)
E) Managing the trade-off between writing high quality code, vs. making it "good enough" that you can ship and move on to the next priority breathing down your neck.
There are more things to list here...
But this is a good chunk of it.
Mental exercise: look through the above, and self-evaluate. On a scale of 1-5, where do you sit on A to E?
And if you want a systematic, step-by-step program to get you to the top of these, as soon as six weeks from today, your best bet is Powerful Python Bootcamp.
I love how testing engineer Rahul Mathur put it:
"It's not the language that is important. It's your thinking and how that thinking applies to the language. Powerful Python permanently embeds that into your brain, and that helps a lot for working professionals."
For more, follow the link in my profile.
AI code generation tools are accelerators. Enhancing the coding abilities you already have.
And if you do not have that base of coding skills to begin with... There is only so much it can enhance.
Let me introduce perhaps the most important concept for getting ahead in the next 10 years:
Differential Advantage.
That's a lot of syllables. But it is critical every Python professional know this idea, understand it, and successfully leverage it to get and stay ahead.
This concept comes from certain elite corners of the fitness community.
And it makes the distinction that your outcomes are determined not just by your own advantages (skills, job experience, etc.) in the job market. What also matters is your RELATIVE advantage over others competing for the same income opportunities.
For example:
- AI coding tools let ANYONE create certain kinds of programs. Anyone. It's not a rare skill set - just requires reading and writing English.
- Free, abundant, and tremendously high quality beginner Python courses have created a torrent of people with a certain level of coding skills.
- Companies get flooded with an overwhelming pile of polished, impressive-looking applications for every job they post. Yours will, in general, be one of many.
The question, then:
How do you stand out?
How do you develop capabilities others do NOT have. How do you create software that non-coders using AI cannot create. How do you wield Python in a way that the Python-noob masses cannot keep up. How do you develop and demonstrate your above-and-beyond skills, in a way that makes your job application shine bright in that dim pile of other resumes?
This is differential advantage.
And it is more important than you think.
Because coding jobs of all stripes are likely to contract in the coming decade. As AI coding tools get better, they will simply replace entire full-time jobs previously filled by lower-skilled developers and data pros.
That means the pie may shrink. Even if not, the daily flood of new coders continues, faster than new jobs will be created.
So, take a moment:
What skills and capabilities can you develop that set you apart? That will create a differential advantage for you, in your career?
Reply and tell me.