Skip to content

Instantly share code, notes, and snippets.

@shoul
shoul / decorators.py
Created March 30, 2012 08:19 — forked from keimlink/decorators.py
Example of different Python decorators
NAMES = set()
def replace(old, new):
"""Replace the first function argument.
If the first function argument matches old it will be Replaced with new.
"""
# decorate the original function
def decorate(func):
@shoul
shoul / standout
Created February 23, 2012 10:27
Ausgabe in der Schell bei
$ python main.py main.py standin.py
-- Dokumentenanalyse --
Analysiere main.py
Zeile: 0 Zeichen: 10 erste Zahl an Stelle 18
Zeile: 1 LEERZEILE
Zeile: 2 LEERZEILE
Zeile: 3 Zeichen: 61 Keine Zahl
Zeile: 4 Zeichen: 9 Keine Zahl
@shoul
shoul / standin.py
Created February 21, 2012 23:07
Eingabeaufforderung mit anschließender Ausgabe
# standin.py
# python3.2
# -*- coding: utf-8 -*-
def session():
"""Speichert die Session in einer Liste"""
session_input = input(">>> ")
result = []
while session_input: