evlogday 2
devlog 2 in piglatin
I haven’t posted a devlog in over 8 hours of work because I’ve been working on pretty much the same function for ages!! I think I’d better just bite the bullet and write about it even when it’s still not finished
What I’m working on:
- I’m writing a function called combine that will combine the translated English 3D list input (which I talked about in the previous devlog) into a list of all the possible full translations of the pigpy program
- I will then create a new python file, then write and test each full translation on that document by writing one of the elements of the combine output and then executing it as a python file.
- Most of the opening, writing, and executing (with try:, except:) is complete, I just need to finish writing combine.
One of my many issues:
- One issue I encountered was that when you multiply a list in python - e.g.: lst = lst * 2 - the added section on the end of the new lst, which is a repeat of the original lst, will actually point to the same memory as the original lst. This is an issue because after multiplying the list, I need the elements to be able to branch off into having different content to make different translation combinations, but that wasn’t working.
To solve this I had to import copy and use copy.deepcopy() alongside for loops to make sure they would point to different memory locations
Improvements:
- I have started using a tests.py file (see screenie) to test functions using assert. I’m very new to this, but it does seem quite useful
- I am in the process of making organisation changes: I am planning on having multiple .py files so that I can write a lot of functions in one of them, then import them into the other to reduce clutter.
I think it’s so cool that you can import your own files just like regular libraries, though I suppose that’s just what libraries are!
^- This will be especially useful for the combine function, because it is (imo) so long and complex, and I’d like to break it up into smaller functions to make it easier to read, understand, and debug!!
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.