Posts

Oops, I Did It Again (But this time I vaguely remembered)

Image
  The below code-output image does not represent the continued presence of the error I want to discuss here . After a 'bit' of debugging (I'm kidding it took longer than that) a vague memory slowly crept out from some deep recess in my brain. Hey fool! You've run into this error before. You can't do that. You can't directly access the counter of a FOR LOOP in Python. So you can't use it as an index inside your FOR loop. Although the error was being flagged out by my PyCharm IDE in its usual 'cryptic' manner, I didn't initially understand. The IDE said something about trying to use a set in place of an integer as an index . Finally I realized and decided to work around it by use a separate variable as my up ticking index in the loop. It worked. I got this (below): What I was trying to do was to generate a 'Help' box by stepping through a bunch of inner lists nested inside an outer list while using the counter of my FOR loop as well as usin...

Grand Theft Coding (Crash and Burn cause of Vanity)

Image
I wanted to feel and look "cool". Meaning that until recently, I'd refused to get back to the 'basics' in my continuing study of the Python programming language. I wanted only to surge ahead to the more 'advanced' stuff. To master the functional classes and dataclasses of object oriented coding (OOP) , to know and use all the best of the libraries, to tame the AI models and take them to the singularity and beyond. This kind of vanity and ambition has its price though. I missed some valuable little tidbits hidden back at the starting line. Recovery is possible however, that is; once I get over myself and over my highly inflated ego. Really. Who is going to know or care that I recently bought some 'beginner' books and read, and re-read some of  their chapters which explain the "fundamentals"? By now I should have known all of these basics. But truth is, I didn't. Which ones? Well for starters, that a single back slash (\) dropped in...

Stop Thrashing About, Start Focused Debug Instead

Image
  Still tossing and Turning ? This will be a boring post because it's about me working through a debugging session after having emotionally 'thrashed about' instead of rationally dealing with the problem I think I'm facing. Embarassingly, I suffer from a tendency to seek quick fixes to my coding issues by means of trial and error guess work in place of  inserting proper debugging code  and seriously analyzing the situation. So below is a test run output where my initial understanding is that I forgot to unpack the lists output by one of my functions and I forgot to therafter join the nested text elements embedded inside one of my lists. Is this first blush assessment of the situation correct? Answer appears below the image...  No. That's not what's going on in the code that produced the above output. I'd forgotten where I last left off.  It was late at night. I was tired. I didn't leave behind progress notes for myself. I had changed the plan so that I...

Quickie Python coding tip #1123

Image
 Idea: Use dictionary syntax as a comment So here's a quickie tip that I came up with: Use the Python dictionary assignment in a comment to describe which option number to use In this example, one of the nested sub-lists of a main list is to be replaced See the below code for sublist_replacement The pick number is described by a comment containing a dictionary assignment [Born to be alive side music ( here )] One place where replacement will occur is in the generated generic help menus of the below form: MORE TO EXPLORE Book = The Python Tricks Digital Toolkit Medium = Python Decorators, Generators, etc.

It Don't Come Easy ... Despite Having Done It For This Long

Image
You would think that after more than a year of climbing up that Python learning curve, coding would come more naturally to me, with fewer mistakes and fewer night sweats and better understanding of how to name functions !. Sorry. Not true.  It still don't come easy ... despite my having done it for this long.   Stupid, stupid mistakes. I make so many mistakes. You can't see it here, all the hours I spent tracking down each error and fixing it. A missing comma here, a missing space there. And impatient arrogance on my part in not studying the error messages more fully but rather jumping to unwarranted conclusions when closer examination would have pinpointed the error earlier. What I discovered more recently is that I'm hampering my ability to think clearly about the functions I write because I'm naming them as actions (verbs) when the end product is actually a data structure and not a performance !!! Below is a not so recent output, ending with testing of what I initial...

Absent and Ashamed

Image
I've been ABSENT from my posts for a quite awhile.  The underlying reasons include: Shame, Embarrassment, Fear of failure, Dopamine entrapment, ... and more Blogging was supposed to be my Great Motivator (a.k.a. "Enabler" -- see Justin Sung mega lecture at ( this time point )) But instead it has back-fired. I did not move forward with my Xpander project. I watched Youtube dancing "shorts" ( Born to be Alive ) -- a great time killer. I worried about failing in tackling my next step. I pursued other topics, including bookmark hoarding and mechanical DIY projects. All this even though I had solved the RICH print out problems (see here for example) The bottom line: I'm human and flawed just like everybody else. Maybe instead of The Mythical Man Month , they should have written a book called: The Mythical Rational Programmer ? But there is a video called  The Myth of the Genius Programmer Don't let the perfect be the enemy of the good Or the good be the ene...

Mental and Physical Ergonomics

Image
When applying Xpander attributes to a word processing package, I think I (we?) should be considering both the mental (cognitive) aspects of our chosen hot key schemes as well as the physical (trained fingering sequences) aspects of those schemes. As an example, for the expanded features of the Shift key: The number of consecutive taps of the key and their consequences could be as follows: (0) = n/a (1) = conventional cap of next one alpha-numeric character (color code = green?) (2) = cap of next word (ends with detection of a space)    (color code = yellow?) (3) = cap of sentence (ends with  detection of a terminate  punctuation)  (color code = red?) (4) = revert back to (0)  (color code = temporary blank white ??) So -- a progressive stepping up a hierarchy of: char, word, sentence, ... paragraph? See link to wiki on keyboard layout and conventional functions here What alternate characters / actions should we invoke with multiple pre-fix taps of the A...