This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's rearrange the hierarchy of these objects | |
foo = SomeClass() | |
foo.bar = SomeClass() | |
foo.bar.baz = None | |
assert foo.bar is not None # Fine so far... | |
new_foo, foo.bar, foo.bar.baz = foo.bar, foo.bar.baz, foo | |
# Traceback (most recent call last): | |
# File "<stdin>", line 1, in <module> | |
# AttributeError: 'NoneType' object has no attribute 'baz' | |
# Wait a sec, didn't we just assert that foo.bar is not None? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def finditer(S, sub, start=0, end=None, overlap=False): | |
"""Iterate over the indices of substring sub in S. | |
Returns an iterable, in ascending order, of the indices in S where | |
substring sub is found such that sub is contained within S[start:end]. | |
Optional arguments start and end are interpreted as in slice notation. A | |
True value for the optional argument overlap will allow overlapping | |
matches. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>++++[<++++++++>-]<.......>++++[<++++++++>-]<+.>++++[<-------->-]<-.......... | |
...>+++++[<+++++++>-]<-.>+++++[<------->-]<+.............>+++++[<+++++++>-]<. | |
[-]++++++++++.>+++++[<++++>-]<++.......>++++++++++[<+++++++++>-]<++.[-]>++++[ | |
<++++++++>-]<.............>++++++++++[<+++++++++>-]<++.[-]>++++[<++++++++>-]< | |
.............>++++++++++[<+++++++++>-]<++.[-]++++++++++.>+++++[<++++>-]<++... | |
....>++++++++++[<+++++++++>-]<++.[-]>++++[<++++++++>-]<.............>++++++++ | |
++[<+++++++++>-]<++.[-]>++++[<++++++++>-]<.............>++++++++++[<+++++++++ | |
>-]<++.[-]++++++++++.>+++++[<++++>-]<++....>++++++++[<++++++++++>-]<-.>++++++ | |
+[<------->-]<-.....>+++++++[<+++++++>-]<+.[-]>++++[<++++++++>-]<....>+++++[< | |
++++>-]<.>+++++[ A B C <---->-]<.....>+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define q(a,...) a | |
#define substr q | |
#define eval(a) main(){char c[]=a,n=10;c[419]=0;printf(c+4,n,n,n,n,34,34,n,34,39,c+4,39,34,n);}/* Copyright (C) Thomas Schumm <[email protected]> | |
exec("from sys import*;substr=q=lambda y:exit(stdout.write(y[4:-46]%((10,)*4+(34,34,10,34,39,y[4:-46],39,34,10))))",None);#*/ | |
eval(substr(q("$p='#include <stdio.h>%c#define q(a,...) a%c#define substr q%c#define eval(a) main(){char c[]=a,n=10;c[419]=0;printf(c+4,n,n,n,n,34,34,n,34,39,c+4,39,34,n);}/* Copyright (C) Thomas Schumm <[email protected]>%cexec(%cfrom sys import*;substr=q=lambda y:exit(stdout.write(y[4:-46]%%((10,)*4+(34,34,10,34,39,y[4:-46],39,34,10))))%c,None);#*/%ceval(substr(q(%c$p=%c%s%c;printf($p,(10)x4,34,34,10,34,39,$p,39,34,10)%c),1,-1))%c';printf($p,(10)x4,34,34,10,34,39,$p,39,34,10)"),1,-1)) |