What order does Python execute decorators in? It seems like this changed sometime between when they were first introduced (2.4) and now (2.7).
Given the code:
@foo
@bar
@baz
def myfunc():
pass
#!/usr/bin/perl | |
# Simple password cracker. Tries every combination of plain lowercased | |
# passwords, from "a", "b", ..., "z", "aa", "ab", ... "az", "ba", "bb" ... | |
use 5.18.0; | |
use Time::HiRes qw(time); | |
use Digest::MD5 qw(md5_hex); | |
my $victim = $ARGV[0]; |
#!/usr/bin/env python | |
"""Script to stress test rapid JSON DB writes. | |
1. When reading from disk, flock(LOCK_SH) is used on the file handle. | |
2. When writing to disk: | |
a. A lock is acquired in a Redis instance as added protection | |
b. File is locked with LOCK_EX during the write | |
c. After the file is written (while still Redis-locked), it attempts to read | |
the file again immediately (LOCK_SH) to verify that it wrote successfully |
#!/usr/bin/env python | |
"""Experiments to upgrade RiveScript's tag processing algorithm.""" | |
from collections import deque | |
import re | |
import random | |
tests = [ | |
"<set oldname=<get name>>I thought your name was <get oldname>?", |
What order does Python execute decorators in? It seems like this changed sometime between when they were first introduced (2.4) and now (2.7).
Given the code:
@foo
@bar
@baz
def myfunc():
pass
#!/usr/bin/env python | |
"""A dict-like object that supports JS object syntax. | |
AttrDict is a dict that can be called using either square brackets, like a | |
normal dict, or by using attributes--just like in JavaScript. | |
Accessing the value for an undefined key will return None (Python's equivalent | |
to undefined). |
import benchmark | |
class DictBenchmark(benchmark.Benchmark): | |
each = 5000 | |
def setUp(self): | |
self.data = dict() | |
for i in range(0, 10000): | |
self.data["key_{}".format(i)] = "value {}".format(i) |
#!/usr/bin/perl | |
# requires: libX11-devel, libXt-devel, libXtst-devel, /usr/bin/xinput | |
# sudo cpanm X11::GUITest | |
use threads; | |
use IO::Pty::Easy; | |
use IO::Handle; | |
use X11::GUITest qw(ClickMouseButton :CONST); |