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
#!/usr/bin/env python | |
source = ("A", "B", "C", "D", "E", "F") | |
pairs = [] | |
for i in source: | |
for j in source: | |
if i == j: | |
continue |
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
package bakery; | |
public class Baker { | |
public static void main(String[] args) { | |
// Cut out three cookies: | |
// one with no toppings, | |
// one with lots of chocolate chips, | |
// and one with lots of sprinkles | |
Cookie plain = new Cookie(0, 0); | |
Cookie chips = new Cookie(10, 0); |
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
# http://stackoverflow.com/a/5063783 | |
def withself(f): | |
@wraps(f) | |
def wrapper(*args, **kwds): | |
return f(f, *args, **kw) | |
return wrapper | |
@withself | |
def aa(self): | |
print(self.__name__) |
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
public class TestInvalid { | |
public static void main(String[] args) { | |
System.out.println("I am *totally* going to touch that null pointer right now..."); | |
String x = null; | |
System.out.println(x.length()); | |
} | |
} |
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
// StudentList classroom; | |
// Student[] StudentList.getStudents() | |
// Student StudentList.getStudent(int index) | |
// String Student.getName() | |
// String[] Student.getClasses() | |
// String Student.getClass(int index) | |
// 1 | |
classroom.getStudents()[2].getName() |
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
print "I am *totally* going to divide by zero..." | |
print 5/0 |
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
print("I am *totally* going to divide by zero...") | |
print(5/0) |
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
'copy' | |
'Copy a file from {source} to {destination}' | |
{'dest': 'Destination', 'source': 'Source', 'return': 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
'copy' | |
'Copy a file from {source} to {destination}' | |
{'dest': 'Destination', 'source': 'Source', 'return': 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 partial(func, *args): | |
def curry(*cargs): | |
return func(*(args + cargs)) | |
return curry | |
def f(*args): | |
print args | |
g = partial(f, 3, 4, 5, 6, 7) | |
h = partial(f, 5, 6, 7) |
OlderNewer