A Hundred Days of Code, Day 020 - Setting up an Editor for Python Development

Had given myself a day, to see if I could get a good Python development environment using Elpy and Emacs. It does work. Just not well enough for me. At the end of the day today, I was happy I learnt so much about Emacs. But that is not my focus right now. Python is. Emacs knowledge can come slowly and organically. So I have kept Emacs as my regular editor for nearly everything text....

July 28, 2020 · Mario Jason Braganza

A Hundred Days of Code, Day 019 - Future Exercise Addendum

Ok, think I have the problem of writing code, licked. Will start with one problem from all the Lerner Courses, that I still have to do. And another problem, I ask my friends to give me. This should prove for a promising start. If you, dear reader, have problems in Python that you’d like me, a budding Python programmer to solve, please mail them to me at jason at this domain....

July 27, 2020 · Mario Jason Braganza

A Hundred Days of Code, Day 019 - Python Iterators and Generators, Done!

Starting up with the last of the Lerner courses, I got. Iterators and Generators. Hopefully I get done with this and use the same intensity with actually writing code. What shape will that take and how will I write about it? I have no clue For now, notes follow. Notes ** Part 1, Iterators ** If we run the iter function on something and it comes back with an iterator object, then it’s iterable; I can iterate on it....

July 27, 2020 · Mario Jason Braganza

A Hundred Days of Code, Day 018 - Python Comprehensions, Done!

Continuing my comprehensions journey. Hopefully it makes more sense this time around Notes ** Set Comprehensions ** If I want a set of uniques from a group, I could use a set. Or like Reuven likes to joke, a set is a dictionary with no values; an immoral dictionary 😂 Create it with a somesetcomp = set('somecondition' for a something in somethingbig) or in a simpler manner, somesetcomp = {'somecondition' for something in somethingbig} Protip, better to start with a list comprehension, be done with figuring out stuff and then just switch the brackets at the end....

July 26, 2020 · Mario Jason Braganza

A Hundred Days of Code, Day 017 - Python, Advanced Objects, Done!

And we are done with objects! This course finally gave me what I was looking for all these months. The ability to think of and reason about Python, so that I can then think of and reason about, how to build my own programs. Notes Abstract base classes Sounds all high and mighty, but does something pretty logical and simple Helps me test if my object is of a generic (of sorts) type....

July 25, 2020 · Mario Jason Braganza

A Hundred Days of Code, Day 016 - Python, Advanced Objects.

Started up with Python Objects today. This seems like a long, hard one. Here’s hoping I learn lots. Knowing Reuven, I know I will. Notes Part 1, Advanced Methods. This section focuses on the dunder methods in Python. By default objects are not equal to other objects even they they are from the same class, with the same attributes and methods. We could implement our own equals method though. The point being, we need to be intentional and methodical, when we design and implement our classses Static methods are plain old functions that I write in my class for use by both the class and the instance....

July 24, 2020 · Mario Jason Braganza

A Hundred Days of Code, Day 015 - Python, Advanced Functions, Done!

Delving deeper into Python functions and learning more about them, using Reuven Lerner’s Advanced Python Functions Course Notes The co_* series of attributes inside the __code__ attribute inside most functions gives a wealth of information about a function. For example, looking up the argcount attribute for some function hello, with hello.__code__.co_argcount will give us the number of arguments hello takes. And doing a hello.__code__.co_varnames will give us a tuple of all the local variables in a function hello....

July 24, 2020 · Mario Jason Braganza

A Hundred Days of Code, Day 013, Day 14 - Python, Advanced Data Structures, Done!

Notes and experiences for yesterday and today. I ‘wasted’ a lot of time, again, struggling with exercises yesterday and ended up being too zombied to even write the summary post. Have been much smarter about it today. Stopped after about 30 mins and copied and tried to understand the solution. Notes List of Dictionaries Just more convenient than a list of lists, not particularly faster Make it more flexible. Dictionary of dictionaries...

July 22, 2020 · Mario Jason Braganza

A Hundred Days of Code, Day 012 - Python, Advanced Data Structures continued

Ok! Had a nice refreshing break, yesterday being Sunday. Back to work today! If today’s notes, feel a little light, that’s because I was struggling with exercises. Notes Part 2 A lightweight solution to classes, if I am just combining all sorts of data structures is the built-in collections. Some of them could be List of Lists List of Tuples List of Dictionaries Dictionary of Dictionaries Dictionary of Lists Mostly use them to solve tricky issues....

July 20, 2020 · Mario Jason Braganza

A Hundred Days of Code, Day 011 - Python, Advanced Data Structures

Started with a new Reuven Lerner Course, on Advanced Data Structures.. Aiming to comfortably finish this in a week. Notes and experiences, follow. The course is three parts. Part 1 - Deep dive into the common data structures Part 2 - Combining Data Structures. Lists of lists, Dicts of lists, Tuples of Lists and so forth. How far can I go without classes? Or how can I enhance my classes with this approach?...

July 18, 2020 · Mario Jason Braganza