Python For SAP Developers (2023-03-13 - 2023-03-15)¶
Day 1 (Basics)¶
Goal: gain a basic understanding of Python: variables, datatypes, some language internals (good to know if one wants to do more).
An overview of the language, how variables are used, and which primary datatypes there are.
Day 2 (Basics, Continued)¶
Control Flow, Sequences, Iteration¶
Basic branching and looping. Iteration (via the
for loop) is an
important topic in Python, which is why we dedicate some time to it.
Exercise: Sort out Duplicates (solution: uniq.py)
Exercise: Primeness (while) (solution: prime-while.py)
Exercise: Primeness (for) (solution: prime-for.py)
There is more to say about datatypes than what has already been said (there is always more to everything in Python). What’s mutable, va. immutable, and what are the consequences? How can we save another three lines of code? What’s Pythonic?
Exercise: Determine Maximum of Two Numbers (Function) (solution: maximum-func.py)
Exercise: Function: uniq() (solution: uniq-func.py)
Exercise: Primeness (Function) (solution: prime-func.py)
More about datatypes …
Exercises, File I/O, Strings
From Pandas …
Hacking About On A SAP Test Dataset¶
Untold (From Original Agenda)¶
Goal: there’s always more. OO isn’t necessary, for example, nonetheless Python is strongly object oriented internally 1. Exception handling isn’t necessary either (one can always let exceptions pass by and terminate the program). Knowing what decorators are isn’t necessary either, much like the iterator protocol, or context managers.
Python is strongly object oriented internally - even an
int is an
object of class int, for example. It does not impose OO knowledge on
its users though; nevertheless knowing a bit of it cannot hurt.
Error handling is commonly done using exceptions - a construct that lets you focus your code on the sunny case, and do clumsy error handling in a separate section of the code.
Context Managers (Automatic Cleanup)¶
Much like error handling, resource cleanup tends to become clumsy. Context managers are a way to bring more structure to that part of a program.
Iteration, Generators, Comprehensions¶
Iterating over large sets of data - while at the same time saving
resources - is one of the absolute strengths of Python. Lets dive a
bit deeper into what a
for loop actually is.
Machine Learning: Pandas, NumPy, And Algorithms¶
From Machine Learning, Artificial Intelligence
OO is often associated with overengineering. Let’s not go in that direction.