Andrew Breese

Infrequent thoughts of a professional geek

Tag Archives: python

Starting to learn a bit of Python

Thinking about the wonderful options developers now have in terms of cloud and virtual hosting, collaboration tools, automatic test and deployment tools, and how-to sites offering a variety of advice – it seems an interesting time to be a developer. Particularly interesting is how powerful languages have become. Which Language?

To learn more I’ve decided to pick up a development language I don’t know and tinker around with it. I wanted something which was either free or all-but-free to code in, had a variey of very separate purposes, and a syntax which wasn’t hard to read visually. I’m a management type by trade now so the code I create has to be simple to write and also be understandable 12 months later. Helps even more if the language is similar to shell and command scripting, very well supported by a plethora of libraries, and supports objects.

I also wanted something I could easily use with AWS and would have an excellent set of libraries specifically for random numbers, text transformation, and Regex. I also would like to eventually understand how to write a lambda call and create serverless apps. And who knows what else along the way.

So I picked Python.

By happenstance Python is good for all that, and is one of the languages which seems well supported by AWS Lambda. I’m confident that AWS does not need to be my only choice, for now though it is a reasonable choice.

Then second question – what dev tools do I need – what editor, which interface, and how easy is it really to get setup?

Tools Steps

  1. installed python on windows (download v3.7.0 from here). I first grabbed the 32 bit installer but updated to the 64 bit later. I also chose to change the install location so it works for all users by putting the files off a new dir on the root instead of burried in a user path; and also added it to the OS path.
  2. Opened a command line and started Python. It ran.
  3. Went looking for an IDE for python and found Atom editor which isn’t an IDE out of the box (url), installed it, it ran.
  4. Then installed the IDE plug-in for Atom, which is done inside the Atom app (which is a great feature).

Tools setup, still to do…

  1. Figure out how to automatically link the Atom editor so it grabs the source code from a central spot. That will mean figuring out a management space – perhaps just a shared cloud volume that I manually sync to the local pc, perhaps a propper SC system (??). For now I think I’ll just copy the files up and down from my cloud drive each day, and the days I forget will be days I watch TV instead.

Programming tasks

I’ve already dug into the RNG functions that come as part of a basic core in Python v3 and they work exceedingly well. Simple and direct. So I wrote a few VERY simple random functions;

  • a Hello world, because its just the first thing to write.
  • roll a d10 dice – shocking called d10.py, it was so darn easy it hurt.
  • a d10 where 1s multiply up – called d1Quality, because the rpg I have in mind calls that a Quality dice, and …
  • a d10 where 1s multiply, and a 10 might be a zero result – called dStress because the rpg calls that a stress dice.

Next I want to (in no order or set timeframe):

  1. Keep playing with really simple operations and functions to slowly learn how to do a variety of things with strings and numbers.
  2. Then start to learn about file system access to open/read/save (CRUD) a file.
  3. Then dig into calling URLS,
  4. Then dig into passing parameters to via a command console to a python application, and perhaps also how to do that to a compiles object (many years ago I wrote some unix commands in VB so I could use them on a windows box, it was a great learning task).
  5. Then to dig out the old Visual Basic code I wrote over a decade ago to see if its worth using the basis of that logic for much harder rolls, functionalisation of rolls between applications, and a compiled program for rolling dice.
  6. … how to publish to a basic web page
  7. … how to publish as a binary for Win, then Linux, then Mac??

This is such a great thing to do while the radio garbles away in the background. Happy coding people!

Image

Design a site like this with WordPress.com
Get started