PyCon Sweden 2021

Python++? Here's how, and why not
2021-10-22 , Software

Live stream: https://youtu.be/Sp0tEGqFfN8

Different programming languages have different functionality, different paradigms, and different styles. We have certainly seen other low-level languages like C++ adopting more “pythonic” themes in recent years, like foreach loops. But what about the opposite? Did you ever wonder how we could implement a smart pointer in Python? Whether we can we add Java’s final keyword for real constants? What exactly the inspect module is useful for? How we get private methods in classes?

We will take a deep dive into Python's fundamentals to discover how you can make things like C++-style input/output, like cout << "Hello world" << endl; or cin >> my_var;, a reality in Python, using the exact same syntax. And, of course, why you really, really shouldn't.

What exactly does pythonic mean? What makes python what it is today? Hint: It’s about more than just the walrus operator.


Brief outline of the talk:
- Short comparison of Python with other common languages like C++ or Java, and pythonic features they've received in recent years
- Recent updates to Python, and why we don't need to manually do those anymore - like match-case and walrus operator.
- Implementing std::cout and std::cin in python using special classes. This is actually quite simple to do.
- Implementing final decorator and type hint to achieve "constants". This can already be found in libraries on pip. How to break them.
- Marking methods as private - this can be done through decorators.
- Why you really shouldn't be doing this – What is considered pythonic? What does it mean? Why are other languages like they are?

Will include code examples, using the inspect module, some python hacks, and other ideas on the same topic. Obviously with a comedic touch, but the main idea is to educate on python fundamentals and differences in programming paradigms.

Passionate about programming, technology, education, and mathematics.
Working as a software engineer, previously at Klarna in Stockholm, currently a teacher of IT.
Believes everything in life is an optimization problem.