A function may be shadowed by a static inline
function or macro with
the same behavior. Typically, this allows better performance for C/C++.
To provide a static inline
equivalent to an exported function,
write something like:
// vraci staticky retezec, nevolat free() | |
char *nazev_jednoducheho_cisla(int n) { | |
switch (n) { | |
case 0: return "nula"; | |
case 1: return "jedna"; | |
case 2: return "dva"; | |
case 3: return "tri"; | |
case 4: return "ctyri"; | |
case 5: return "pet"; |
import unicodedata | |
def get_components(char): | |
name = unicodedata.name(char).removeprefix('BOX DRAWINGS ') | |
result = [] | |
for part in name.split(' AND '): | |
part = part.replace(' DASH', '-DASH') | |
directions = [] | |
for word in part.split(): | |
match word: |
import inspect | |
import sys | |
import functools | |
def trace(f): | |
signature = inspect.signature(f) | |
indent = '' | |
@functools.wraps(f) | |
def decorated(*a, **ka): |
Currently, several Python distributors modify the Python install layout. Making such modifications requires them to patch multiple standard library modules. The install layout is currently not meant to be a configurable option in a Python installation, but Python developers, distro packagers and module authors all have conflicting certain assumptions in this area. This has presented itself as problematic because Python distributors, understandably, fail to correctly modify all places required to satisfy all these assumptions, resulting in incoherent or straight-out broken Python distributions
# Generator for: https://youtu.be/xeL_Ifngcbo | |
# Save student code as obrazky/*.py and run this | |
import sys | |
import importlib | |
from pathlib import Path | |
import turtle | |
import time | |
import itertools | |
import dataclasses |
https://github.com/encukou/piskvorky |
# pip install pyglet | |
import pyglet | |
window = pyglet.window.Window( | |
style=pyglet.window.Window.WINDOW_STYLE_BORDERLESS, | |
resizable=True, | |
) | |
label = pyglet.text.Label('Zavřít ', font_name=['Fira Mono', 'Courier New']) |
# Shaped clock, adapted from: | |
# https://doc.qt.io/qt-6/qtwidgets-widgets-shapedclock-example.html | |
# pip install pyside6 | |
from PySide6 import QtWidgets, QtCore, QtGui | |
app = QtWidgets.QApplication([]) | |
class ShapedClock(QtWidgets.QWidget): | |
def __init__(self): |