• Home
  • About
    • About The Coder
    • Language List
  • The Rules
    • Rule #1: Clarity Trumps Everything
    • Rule #2: Source Code is for Humans
    • Rule #3: Don’t Ignore Warnings
    • Rule #4: Comment As You Go!
    • Rule #5: Always Use Parentheses
  • CS-101
  • Python-101
  • Guestbook

The Hard-Core Coder

~ I can't stop writing code!

The Hard-Core Coder

Category Archives: Python

Exploring Python.

My Python App Framework

03 Saturday Oct 2020

Posted by Wyrd Smythe in Python

≈ Leave a comment

Tags

computer code, Python 101, Python code

For me, Python modules seem to divide into two basic classes: library modules and application modules. The former contain basic building blocks, but the latter has top-level routines the operating system invokes when it runs the application.

Today I thought I’d post about the application framework I use for all apps.

Continue reading →

Multiplication Visualized

01 Tuesday Sep 2020

Posted by Wyrd Smythe in Fun, Python

≈ 1 Comment

Tags

Cartesian product, computer code, Japanese multiplication method, math, multiplication, Pillow (PIL fork), Python code

On my regular blog I just posted about a Japanese visual multiplication method. It’s a cute trick that ties into the notion of grid multiplication techniques. (In general, multiplication techniques are of some interest due to the Mandelbrot set, which requires multiplying large numbers lots of times.)

It turns out code to generate the patterns was a lot easier than I thought it would be. The hardest part was generating the diagonal summing lines.

Continue reading →

Life With Class

07 Thursday May 2020

Posted by Wyrd Smythe in Fun, Python

≈ Leave a comment

Tags

computer code, Conway's Life game, John Conway, program, Python code

Last time I showed you the functions necessary for Life — for John Conway’s game of Life, that is. We ended up with a set of functions you can use to generate frames of a Life session.

This time I’ll show you an object-oriented version (a Life class) along with some other tweaks to make things look nicer.

Continue reading →

John Conway’s Life

03 Sunday May 2020

Posted by Wyrd Smythe in Fun, Python

≈ Leave a comment

Tags

computer code, Conway's Life game, John Conway, program, Python code

You may have heard that mathematician John Conway died last April. To his everlasting dismay, most people only know him for his “game” of Life (which he considered trivial and inferior to his real mathematical work). Unfortunately for Conway, his Life game is fascinating.

To honor his passing, I whipped up a Python version that I thought I’d share. Python is about the only language I’ve used a lot in which I’ve never implemented Life, so high time I did, right?

Continue reading →

Python Decorators, part 2

25 Saturday Apr 2020

Posted by Wyrd Smythe in CS101, Python

≈ Leave a comment

Tags

Aspect-Oriented Programming, computer language, programming language, Python 101, Python code, Python decorator

Last time I began exploring Python decorators, which are a way of having one function “wrap” another function. Because the wrapper has access to both the input parameters and the return value, it can modify these values (unbeknownst to the inner function).

This time I pick up where I left off by exploring decorators modifying return values, decorators that take parameters, and decorators in classes.

Continue reading →

Python Decorators, part 1

24 Friday Apr 2020

Posted by Wyrd Smythe in CS101, Python

≈ 1 Comment

Tags

Aspect-Oriented Programming, Python 101, Python code, Python decorator

I’ve been playing around with what Python calls decorators. They’re a built-in way of implementing Aspect-Oriented Programming techniques in Python. In fact, they’re quite powerful.

Since they aren’t a common language feature, they can be a little confusing at first, so I thought I’d try my hand at laying out how they work.

Continue reading →

The Eight Queens

23 Sunday Jun 2019

Posted by Wyrd Smythe in CS101, Fun, Python

≈ Leave a comment

Tags

computer code, Python code

There’s a fairly simple puzzle, called The Eight Queens, that I’ve long favored as a project for first semester CS students. The problem is simple enough for a beginner to tackle, yet also interesting enough to be engaging. (And just tricky enough to be a nice beginner challenge.)

Due to a discussion on my other blog, I dug out an old Python implementation I had, and, after looking at it, I thought it might be worth writing a post about. If nothing else, as I said, the problem is interesting enough to be engaging.

Continue reading →

So Random!

01 Tuesday Jan 2019

Posted by Wyrd Smythe in Fun, Python

≈ 3 Comments

Tags

Python code, random

To ring in the new year I thought I’d play around with an old friend from my earliest programming days, a random text generator. Back then (over 30 years ago), but a little bit always, a good way to practice programming is by working on small, relatively easy, but still fun, programs.

Simple games are common choice, but not the only one. (I’ve probably written a version of Mastermind in every programming language I know.) Another fun choice is various image or text generators (or processors). Random text generators, in particular, offer a range of complexity depending on your taste and time.

Continue reading →

Knowing Where To Bang

02 Wednesday Aug 2017

Posted by Wyrd Smythe in Python, Stories

≈ Leave a comment

Tags

computer programmers, computer programming, debugging, old joke, Python code, tips

Sometimes ya gotta laugh. I just spent nearly an hour chasing one of those bugs that “can’t be happening” because “the code looks absolutely correct (as far as I can tell).” Of course, the bug, once you find it, was always hiding in plain view.

This time the fix involved adding just two characters, incidentally improving the program semantics, and very much reminded me of the old joke about the huge cargo ship that breaks down at sea…

Continue reading →

Aside

Update July 2017

20 Thursday Jul 2017

Posted by Wyrd Smythe in Blog, Python

≈ Leave a comment

Tags

computer languages, computer programmer, data, Matplotlib, NOAA, programming language, Pythonista, SQL, SQLite, xkcd

In the unlikely event anyone is reading this, and, more in the original spirit of “web logs“, as much a diary entry to record both the passing of time and the moment, after a long period of quiet, and in the long-winded run-on way that I sometimes have, a post.

Continue reading →

← Older posts
Newer posts →
Follow The Hard-Core Coder on WordPress.com

The Posts

  • Python String Translate
  • The Last Bug
  • Regular Expressions
  • Bits Bytes Chips Clocks
  • Loving the Lambda
  • Failure Tales
  • Naming Things (redux)
  • Calculating Entropy (in Python)
  • Building a Turing Machine
  • Python Tokenize

The Topics

  • Blog (4)
  • CS101 (35)
  • Fun (27)
  • Interesting (1)
  • Opinion (12)
  • Python (24)
  • Stories (15)

The Month

March 2023
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  
« Oct    

The Past

Posts

RSS Feed

Comments

RSS Feed

Enter your email address to follow The Hard-Core Coder and get email when there is a new post.

The Main Blog

Visit Logos con carne

Lots of wyrds... with meat!

The Author

Wyrd Smythe

Wyrd Smythe

The canonical fool on the hill watching the sunset and the rotation of the planet and thinking what he imagines are large thoughts.

View Full Profile →

Create a website or blog at WordPress.com

  • Follow Following
    • The Hard-Core Coder
    • Already have a WordPress.com account? Log in now.
    • The Hard-Core Coder
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar