I really feel this sense of purpose

I really feel this sense of purpose

I really feel this sense of life purpose, and I have to share it in here.

I really feel this sense of purpose, and it is something to do with the pylons, and with the internet towers, and with the offshore wind farms, and the onshore ones as well of course.

This sense of purpose is really something to do with the way that I feel when I see pylons.

Because how could I feel anything so deeply? And how could I love anything so deeply? And how else could I feel anything so deeply, if this was not a life purpose?

So Long, London


When I listen to this song by Taylor Swift I hear the urgency.

I hear the urgency that I really truly need. I feel full of urgency.

There is something that I really need to do - and I really need to do it. "There is only one of you in all of time."

I really need to do it. I really need to do it.

I just need to do it

I used to think that I had to do something really huge on this path and on this journey.

And I'm not saying I won't - I could do. I could do, still. But I think that that the big thing on this journey is my commitment to it. I just still think that the really big thing on this journey is my commitment to it.

And the feedback is clear from my manager, my senior manager, and my mentor: I just have to focus on the task that is in front of me.

I just have to focus on the step that is in front of me.

One step at a time.

One ticket at a time.

Thank you.

Adding Serializers

I added some serializers into my code yesterday (in Django).

A serializer allows you to accomplish a solution in much fewers lines of code.

It parses the data for you and can take it directly into a model. It verifies the quality and the authenticity of the data for you and if the types are right - because why wait for the tests to fail before checking the quality of your data?

A wind turbine on a hill with a wind turbine in the background. The sky is blue.
I wanted to share loads of pictures of the wind farms in Luxembourg where I am from. I love the wind farms and the pylons, I love each and every wind turbine so so much - my love I feel for them is infinite!
Python Solutions

I solved the "Milk and Cookies for Santa" problem on CodeWars yesterday in Python. It was so sweet. It was such a cute problem to do.

Here is my code solution
from datetime import date

def time_for_milk_and_cookies(todays_date: date) -> bool:
    return todays_date.day == 24 and todays_date.month == 12
SO GUESS WHAT!!! MY SOLUTION WAS IDENTICAL TO THE TOP SOLUTION. I AM SO SO SO SO HAPPY - THANKS.
  • Frome datetime, we import date
  • The function takes in a date object, and it outputs a bool. It is very important to know your inputs and outputs in functions. 
    • Remember, these are like toasters; we have to know something that we put in, and something we put out. Sometimes functions can have less explicit toasters too.
  • So then we do all the code in one line which is so cool - this is pretty much my first time doing this for a level 7 problem in Python, I think. We put it all on one line because we just return whatever the output of that expression is.
  • So what do we return? 
  • well firstly we return the output of an expression - this expression evaluates to a bool
  • And we can see that there is an and statement - this means that in order for the bool to return True, both of the expressions have to be True.
  • So what are the two statements that we try, and have to make sure to be true?
    • todays_date.day has to be equal to 24
    • todays_date.month has to be equal to 12
So:
  • todays_date is a date object
  • it has attributes such as day, month and year
  • unlike a dictionary in Python you do NOT use square brackets to access attributes
  • in an Object in Python you use . notation.
This is so weird cos in JavaScript you can use [] and . to access properties of an object. In Python Objects and Dictionaries are two different things and I only learned this properly yesterday.

Being a Python Legend and Solving More Challenges

I wanted to do some more Python.

I wanted to solve Disemvowel Trolls again because I did it in JS a while back. I passed but with the most hideous code in the world. I was looking stuff up and I got some ideas for a better solution but I wanted to see this solution through to the end. Then I can compare and look at some of the better solutions.
def disemvowel(troll_string: str) -> str:
    troll_list = list(troll_string)
    new_list = []
    for character in troll_list:
        if character != "a" and character != "e" and character != "i" and character != "o" and character != "u" and character != "A" and character != "E" and character != "I" and character != "O" and character != "U":
            new_list.append(character)
    new_troll_string = "".join(new_list)
    return new_troll_string

This is just getting humiliating omg.

I need to start writing better solutions.

Here is the top solution: 

def disemvowel(string):
    return "".join(character for character in string if character.lower() not in "aeiou")

So what do they do here? Well it's just like in my above solution to the santa problem - they return everything in one line.

  • They join the return value of a string.
  • Well what is it that they do inside of the join? ARRRRRRGH. 
  • Arrrrrrgh it's my nemesis again arrrrgh! It's a GENERATOR EXPRESSION.
  • Right so what does this expression do then please? thanks
  • for every character in the string
  • IF the character is not in "aeiou"
    • BUT we convert the character to lowercase first - so that the character is lowercase no matter what
  • THEN we YIELD the character
  • I repeat, we YIELD that character
  • I repeat, we YIELD the character!!! Because this is how generator expressions work. 
  • And then WE JOIN TOGETHER the OUTPUT OF THAT YIELD.
  • Thank you.

Solution Number 2:

Okay quickly because I'm getting off the train: this solution is perfectly clear although I made it more readable as well (by actually naming the variables, LOL).
def disemvowel(string):
    for letter in "aeiouAEIOU":
        string = string.replace(letter,'')
    return string
  • We loop through every letter in a new made-up string: "aeiouAEIOU"
  • We check string
  • We call the replace() method - JUST FROM LOOKING AT THIS I can infer that replace() takes in a character (could be more?) and replaces all of the instances of that character (or those characters?) with the input that we give it. So in this case that would be every instance of that letter in the string - with an empty string.
  • We then just return the string...
Thank you.

I see fireworks

I see fireworks.

I see fireworks.

When I look into my future I see fireworks.

I can't explain it can't explain it. But when I look into my software engineering future.

I see fireworks.

I see fireworks.

Thank you.

I JUST COMPLETED ANOTHER PULL REQUEST...*

... And that one is for the pylons.

Because:

EVERYTHING I DO, I DO IT FOR THE PYLONS

Everything I do, I do it for the pylons.

Because I love them sooo much.

Everything I do, I do it for the pylons.

Everything I do, I do it for the pylons.

Everything I do, I do it for the pylons.

Thank you.

* That was as sentence or two written at work. Most of this is being done on the weekend. Which is when I solve my python problems (and sometimes after work as well...). 💜💚💙💙

How much I care

NO. 

NO.

NO.

I could never, never tell you. No matter how many blog posts I write.

I could never ever tell you how much I love this stuff. No matter what I write.

I could never never tell you. I could write around the whole world - wrapping the whole world in lengths and lengths of my paper and of my words - I could never ever tell you how much I love this stuff. I could never, never tell you how much I love this stuff. Software Engineering.

Thank you.



Comments

Popular posts from this blog

Hello World

Yosemite

Two Lines of Thought, Makes Me Wonder What I'm Missing