Posts

Magic Methods

Image
Magic Methods So by a super cool and awesome and really amazing developer who I work with sometimes, I have been set the task of trying to figure out how we would go about sorting two instances of the same class - based on the value of one of their attributes. magic methods - taylor swift folklore aesthetic and vibe So what are magic methods? Magic methods are "special methods describing how certain objects should behave." They are "dunder methods" (sounds like something out of a fantasy novel?) like __init__ , __repr__ and __lt__ . I came across these when I was first learning Python/Django for my job interview. These methods apparently indicate that these methods "shouldn't be called directly by the programmer, they are normally called by the interpreter itself." Source:  https://blog.cambridgespark.com/magic-methods-a8d93dc55012 There is a thing called __new__ that comes before the __init__ method, but we are not going into this today. I am not g

Lambda Functions

Image
Lambda Functions  11 pm. I'm on the train home from London, having met up with my little sis. Should I do some work? No I don't work at this time. Should I read? I can't at this time. I know. I'll learn some AI. So currently I am taking two foundational modules that my AI engineer colleagues have recommended. Then I can do the full AI/ML career path.  A wind farm in Cornwall that my wonderful sister sent me. Lambda Functions for Pandas "Learn to define a Python function in one line."... Sounds like JavaScript. Which I miss. Only because I love it so much - don't remind me. I miss it every day. Anyway I love Python too...  So this is my attempt at writing a lambda function: age_in_dog_years = lambda age: age * 7 And this is attempt number two: say_hi = lambda name: print('Hi ' + name) Okay not so bad for someone who is writing at midnight on the train on the train from London for today having worked all day. An if statement inside of a lambda functi

Alan Turing's Legacy, Part VII

Image
Alan Turing's Legacy, Part VII I have run out of AT pictures - maybe one of his memorial - but I want to keep sticking to the titles. My next plan was to use pictures of wind farms in Luxembourg, where I am from, so here we go. Using TypedDict So this was my second homework assignment that was set to me by my incredible mentor. I am so so lucky.  I have the most incredible mentorship.  I have the best mentors in the world! And so one of them has set me a task to learn what TypedDict is  And so that means I need to read again - arrrgh. Luckily my lead and I have spent a bit more time on this today so I have some context. But I still need more - hey I wonder if I covered it in my Codecademy course. It's so obvious, please - DUH It does exactly what my Lead has said to me that it does, based on the conversation that we had this morning. So why was I worrying about it so much? From Dafoster (???!) https://dafoster.net/projects/typeddict/ "A TypedDict is a new kind of type reco

What is the enum library, part II?

Image
What is the enum library, part II? I wanted to do a bit more on this - sorry please, thank you. I wanted to do a bit more practical examples. A cute little octopus. Testing out enum code Is there anything else here, that I can take away from this? Is there anything else I have learned here? why meta? I asked chat GPT but it didn't make much sense. It's just a type of enum class I guess? One more interesting source... Here is one more interesting link... Source:  https://www.python-engineer.com/posts/enums-python/ It says here that: "Enum is a built-in data type in Python. It is used to create a finite set of constants." "Enum is a collection of symbolic names and values. It's a shortcut for enumeration and can be imported from the module enum . Enumerations are created using classes." So to give more examples I played around with it some more And I think I've got the idea now - thank you... Thank you.

What is the enum library?

Image
What is the enum library? So what is the enum library in Python, please? A senior colleague and wonderful wonderful mentor has asked me to research this. Specifically, he would like me to understand, in my codebase, why one of my classes is a TextChoices class. To give it a bit more context So my colleague has asked me to research the Python "standard library module named enum ". And he says that Django has enum stalled classes called: TextChoices and IntegerChoices And so he has asked me to research the enum module library... What is the enum module library? I am watching a 5 minute video... I know... due to my neurodiversity I often struggle to watch videos beyond two minutes. But I am DESPERATE for an intro and I need to do it alone... so it's easier than reading it. BLERGH. Why are videos so long and hard to watch. Just get me to the point please already. I lasted about 1 minute and 30 seconds Okay so that is... already longer than I last in most videos anyway. Enum

I have to refocus my priorities

Image
I have to refocus my priorities I have to refocus my priorities. I have to leave the AI for now. I will do it after work again once the time is right or whatever. But for now I just really need to focus ON MY JOB. In my job I am moving off a project I was sort of working on - the best direction is for me to focus on working on, understanding, and maintaining my current codebase. In that sense: I have my tips which I shared in my infographics and in this blog post (on my other blog) yesterday. And so: My main focus has to be just really focusing on my own codebase. I have to GO THROUGH EVERY FILE, THAT IS RELEVANT IN THE CODEBASE FOR EVERY LINE I HAVE TO GO LINE BY LINE AND WRITE COMMENTS FOR EVERY LINE. I HAVE TO UNDERSTAND THE CODEBASE FILE BY FILE FUNCTION BY FUNCTION LINE BY LINE AND THAT HAS TO BE MY PRIORITY AND THAT HAS TO BE MY FOCUS AND THAT HAS TO BE HOW I APPROACH THIS, AND I CAN DO COURSES TOO ON THE SIDE BUT I MIGHT NOT HAVE TIME /TOO MUCH TIME/ BE ABLE TO MAKE IT MY TOP P

Alan Turing's Legacy, Part VI

Image
Alan Turing's Legacy, Part VI I have spoken to my Lead and we have a plan going forwards. We have streamlined the Django course - I am only going to do the first 5 modules. That way I can focus on what is most relevant. But - here is the plan that he has given me in terms of getting to know my Codebase (why have I forgotten everything - 5 pm brain - omg). Going through the Codebase and only focusing on the most important files. I know what these are but of course these are highly confidential so I will put them in a notion doc instead. I have them written down in the back of my notebook. I will write them all down in a notion doc. Going through those files and IDENTIFYING THE KEY FUNCTIONALITY - WHAT DOES THE CODE DO - WHAT IS THE PURPOSE OF EACH FUNCTION. WHAT IS THE CODE'S FUNCTION. And then based upon this, I have some tasks Go through the code and write comments in the code As many comments in the code as I need I do not necessarily need to push them - I can see how that go