Learn coding in Python, Go and Rust from Serdar Yegulalp, software dev specialist and senior writer at InfoWorld.
Python 3.10 makes use of the new parser introduced in Python 3.9 to deliver more detailed, informative, and accurate error messages for your code. See some examples in this video of how the new error messages make developing in Python even easier than before. Resource link: https://www.python.org/dev/peps/pep-0617
Learn about structs, user-created data types in Go that can hold multiple values, including other structs. We'll also demonstrate how structs can be copied into functions or passed by reference, depending on your needs.
Python 3.10 has a slew of powerful new features. Learn how one of the most eagerly awaited, structural pattern matching, makes it easier to control program flow. For a more detailed tutorial on structural pattern matching, see our article: https://www.infoworld.com/article/3609208/how-to-use-structural-pattern-matching-in-python.html
Learn about the use of pointers in Go to pass values by reference instead of making copies, and how Go pointers differ from pointers in other languages you might have used.
Learn how sets in Python can be used for more powerful work, by using their built-in methods to filter and merge the contents of sets quickly and easily.
Learn how to use Go's built-in testing framework to run benchmarks on your code, and find out where your programs may have performance bottlenecks.
Learn how Python's set type can be used to create collections of unique objects, with powerful ways to inspect and manipulate their contents.
Learn the basics of Go's built-in testing framework, used for writing unit tests that sit side-by-side with the code you're testing.
Learn how Python's FastAPI framework can be used to quickly stand up JSON APIs, using modern Python features like async and type hints.
Learn the basics of how Python's type hinting system, optional but powerful, helps make your code easier to read, understand, and interact with.
Why are Go program binaries so large, compared to similar programs written in other languages like C or C++? In this video we'll go into the details of why Go binaries are the sizes they are, and what you can do about it -- that is, if you need to do anything about it!
A closer look at the internals of Python's memory management system. In this video we examine the behavior of Python's cyclic garbage collector, which detects and removes orphaned objects that hold references only to each other, and uses object-count thresholds to run only when needed.
How to write text to a file in the Go language, using Go's built-in packages. Learn how to use "os" for simple file writing operations, and "bufio" for when you need more control.
Memory management in Python is handled automatically behind the scenes by the Python runtime, leaving you free to concentrate on the actual problem you're solving. Learn how Python's runtime manages memory for objects by way of reference counting.
Use the Go language's built-in file handling mechanisms to read files, either line by line for text processing, or entirely into memory.
The const keyword in Go lets you create values that are immutable across the lifetime of your program. But Go consts behave a little differently from similar features in other languages. Learn how consts work in Go, and how to use them as the language intends.
Can you take a Python script and turn it into a standalone executable? Sort of! The Python compiler Cython can be used to do something like this, but it's a little trickier than it might seem. We'll explore how to do this in this video, and use that to walk through all the reasons why making a standalone app from a Python script is a complex project. For the code used in this project, see this Github repository: https://github.com/syegulalp/cython-exe-demo For more on Cython, see our other article: https://www.infoworld.com/article/3250299/what-is-cython-python-at-the-speed-of-c.html
The channel datatype in Go lets you send messages easily between goroutines, or concurrent operations. Learn how to get started with them in this quick introduction.
The Numba library for Python makes numerical code faster by way of a just-in-time compiler, as an alternative (or complement) to NumPy and Cython. Often all you need to make existing code faster is a single line of code, with Numba's just-in-time compiler handling most of the work.
Learn about Go's goto keyword, which can simplify the logic of your code -- but when used responsibly and sparingly.
A quick look at some of the major new features in Python 3.10: The new pattern matching syntax (see https://www.infoworld.com/article/3609208/how-to-use-structural-pattern-matching-in-python.html for more details); more precise syntax errors thanks to Python's new parser; and new typing functionality for handling types propagated across function calls (such as with decorators).
Learn about Go's switch/case construction, making it easy to choose one code path among many based on the value of a variable -- or even its type.
In Part 6 of this ongoing series, we use Python's decorator pattern to make our code a little less boilerplate-y and centralized, by consolidating common behaviors across our site into single functions.
Learn about Go's for loop construction, used to iterate through container objects, continue until a condition is met, or repeat something forever.
In Part 5 of this ongoing series, we create a mechanism for deleting posts from the system, or in this case simply flagging them as deleted and hiding them from view, since simply deleting objects from the database can create unforeseen complications.
Learn about Go's map type, used to store values in a structure that can be quickly accessed with a key -- the Go equivalent of Python's dictionary or Java's HashMap type.
In Part 4 of this ongoing series, we make it possible to reply to existing messages, and clean up how messages are displayed to make replies easier to discern from original posts.
Learn about Go's short-form assignment syntax, the quick way to declare variables -- how it works, and where it's most appropriate to use it in place of Go's more conventionally verbose assignment form.
In Part 3 of this ongoing series, we create the components needed to allow users to log in and be identified by the system, and show how to save passwords in the system by one-way hashing them, not storing them as insecure plaintext. https://github.com/syegulalp/talkster-repo
Learn how the panic and recover keywords in Go are used for error handling, and why they're not a direct substitute for Go's more conventional error handling mechanisms, but for trapping unexpected or unrecoverable conditions.
Learn how to use the struct type in Go to translate JSON read from a website into a local data structure. This video also briefly covers the use of using the net/http package to read from websites, Go error handling, and using the defer keyword.
In Part 2 of this ongoing series, we show how to create a basic web interface to the data back end we created in Part 1. For this, we use Bottle, a tiny web framework with an HTML templating system.
Learn how to use Go's fmt library to control the formatting of variables, both when just printing to the console and when rendering new strings from other variables within a program.
In this series of videos, we'll build a simple social network, a Twitter clone, using various frameworks and packages in Python, from web frameworks to database management tools. This first video focuses on building the data structures we need, using an ORM.
The Go language has goroutines to enable concurrency, and channels for efficient and easy communication between channels. Learn the basics of how they work in our video.
ORMs let you work with databases by way of a programming language's native metaphors, instead of by constructing raw database commands as strings. In this video we'll look at a simple ORM for Python, Peewee, and how it uses Python objects, like classes, to represent and work with a database.
Learn about working with arrays and slices, two variable types Go uses to create collections of similar objects.
Python comes with a database built into it, SQLite, that you can use in your own Python programs to store and retrieve structured data, using the SQL syntax common to databases. In this video you'll see a quick example of how to do this.
Learn the basic variable types of the Go language: the variety of integers, the basics of strings and runes, and the way floating-point and complex numbers are expressed in Go's type system.
The Python runtime translates Python programs into a format called "bytecode" to speed both execution and the startup time of future runs of a program. This video explores how they work and how to handle them in your projects. This video also makes mention of my earlier videos on Cython and Python's disassembly module. You can see those here: Using Cython to speed up Python: https://youtu.be/8DuyATDaIdM Python's disassembler: How to inspect Python bytecode: https://youtu.be/PJ16cdc0YKM
The NumPy library accelerates Python's number-crunching powers, while keeping Python's ease of use and flexibility. Learn in this video the basics of NumPy's use, where it shines, and where it's less effective.
The Go language has a wide variety of third-party packages available for use in your programs. Learn the basics of how to import and work with them in this video.
Memoizing lets you cache the output of functions when they return predictable results. Python has a built-in system for memoizing functions, lru_cache, that can speed execution of code. Learn how to make the most of lru_cache in this video.
Pyston, created originally at Dropbox, aims to speed up execution of Python programs with various acceleration techniques like just-in-time compilation ("JITting"). In this video we demonstrate Pyston's speedups -- still modest, but noticeable -- against the regular Python interpreter and the PyPy runtime, which also uses JITting for speed.
The Go language, created by folks at Google, has been with us for a decade and been the basis for many important enterprise projects like Docker and Kubernetes. Watch a simple Go program in action to get an idea of what it's like to start working with the language.
Python comes in both 32- and 64-bit editions. Which one should you choose, and what difference will it make? And if you're stuck not being able to use the optimal version, what can you do about it? (Link to the site described in the video: https://www.lfd.uci.edu/~gohlke/pythonlibs)
The latest version of Python offers new conveniences for the developer: new ways to merge dictionaries, new string-handling functions, and more convenient type-hinting features. Learn more in our video.
Python runs programs by compiling them into bytecode, an instruction set used to drive its interpreter. With the "dis" module, you can disassemble and examine bytecode from any Python program, and learn more about how your programs are behaving under the hood.
If you have a collection of items in Python, like a list or a dictionary, Python's "for" construction lets you loop through it easily and work with each element in turn. Learn the basics, and avoid a few of the pitfalls, in this video.
Python lists can be sorted one of two ways: in-place, or by generating a new list from the old one. Learn about the mechanics of the "sorted()" function and ".sort()" method, what scenarios they're best for, and how to perform custom sort operations with each.