Showing posts from October, 2018

inktober is crack

So a part of the reason I was so distracted from coding this month,
Other then getting signed up for college, playing Dragon Age: Inquisition, getting our trailor fixed, and just being bummed out in general:
The goal is to draw a picture with some inking technique every day by a prompt.

Here's the picture of all my inktobers laid out on the floor:

Anyways, back to breaking some Python.
Someone in class is working with a new python game making library... Might have to tinker with that a bit.
And well, Why not?

working on manual tests for the Python Ternary Search Tree

Hello peoples!
This one will be about how I prepare to write a unittest/pytest.
I know there's the whole 'test first' approach, but this works best for me so far.
If it's not your thing, groovy.

1) make unittest  (started: see below)
2) compare pytest (started: see below)
So far it looks like there is no advantage, other than some extra typing practice, to doing Unittest over pytest

Update: adding the started unittest and pytest

The Ternary search tree for this exercise in the LMPTHW book may be protected by Zed's copyright, so I shall instead share some testing techniques I am working on.

I want to do a unittest for this exercise, because well....  Most testing libraries are built on top of the already built in unittest that python has.

Instead of fumbling to write out the tests for pytest / unittest;
I first write out the different print calls I'd like to see;
Then I'll write the unittest or pytest around what I would like to see tested from those r…

what is this? python for loop locals into a seemingly endless tuple of lists

I ran accross this experimenting with getting the locals() to print from a for loop.

a stack overflow reference I used for help:

I don't know if I'll get through it tonight to explain, or figure it out, maybe tomorrow.
But, check it out.
Lets break it!
UPDATE 10/9/18 below

I asked about this in the LearnCodeTheHardWay forum to see if I could get suggestions how to decipher this.
On suggestion, I ran some profile tests on two separate codes.
What I really want to know is WTH is that [...] called, and what is python doing there?

Picture & Code for test on the size 1 million for loop locals() list:
** 1.993 seconds ***


import cProfile

# how it should be done:
# all_locals = locals()

# def find_locals():
    # alist = []
    # for item in all_locals:
    # return alist
When I ran this in my shell, the list looked infinite, b…