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
class Rectangle: | |
""" | |
A simple rectangle "literal" thingy. It uses operator overloading and the variable o to visually denote any rectangle of integer dimensions. | |
The "literals" are %100 valid Python syntax. | |
A line literal of width ten. | |
a = o- - - - - - - - - -o | |
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
# Some people have said that this import function violates the nature of functions by modifying it's caller's globals | |
# I would say that with such an essential as import an exception can be made. In any case, practicality over purity, and | |
# import('x') is a lot more practical and clean than x = import('x') | |
import django | |
# becomes | |
import('django') |
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
nommbp:~ fletcher$ python -m timeit "1" | |
100000000 loops, best of 3: 0.0176 usec per loop | |
nommbp:~ fletcher$ python -m timeit "''" | |
100000000 loops, best of 3: 0.0175 usec per loop | |
nommbp:~ fletcher$ python -m timeit "pass" | |
100000000 loops, best of 3: 0.0175 usec per loop | |
nommbp:~ fletcher$ python -m timeit "" | |
100000000 loops, best of 3: 0.0175 usec per loop | |
nommbp:~ fletcher$ |
NewerOlder