This file contains hidden or 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
/* The following function breaks the notion that bytes are immutable: | |
it changes the size of a bytes object. We get away with this only if there | |
is only one module referencing the object. You can also think of it | |
as creating a new bytes object and destroying the old one, only | |
more efficiently. In any case, don't use this if the bytes object may | |
already be known to some other part of the code... | |
Note that if there's not enough memory to resize the bytes object, the | |
original bytes object at *pv is deallocated, *pv is set to NULL, an "out of | |
memory" exception is set, and -1 is returned. Else (on success) 0 is | |
returned, and the value in *pv may or may not be the same as on input. |
This file contains hidden or 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
from time import time | |
import os | |
devnull = open(os.devnull, 'w') | |
name = "oded" | |
t = time() | |
for _ in range(50000): | |
print("my name is {} & 2*3={}".format(name, 2*3), | |
file=devnull) |
This file contains hidden or 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
import os | |
import six | |
from time import time | |
from inspect import currentframe | |
from string import Formatter | |
string_formatter = Formatter() | |
devnull = open(os.devnull, 'w') |
This file contains hidden or 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
from __future__ import print_function | |
import os | |
import sys | |
import six | |
from time import time | |
from random import choice | |
from string import Formatter | |
from string import ascii_letters | |
from inspect import currentframe |
This file contains hidden or 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
from __future__ import print_function | |
import os | |
import sys | |
import six | |
from time import time | |
from random import choice | |
from string import Formatter | |
from string import ascii_letters | |
from inspect import currentframe |
This file contains hidden or 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
import os | |
import six | |
from time import time | |
from random import choice | |
from string import Formatter | |
from string import ascii_letters | |
from inspect import currentframe | |
string_formatter = Formatter() |
This file contains hidden or 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
__keywords = {} | |
__keywords[GENERATED_NAME] = STATEMENT | |
__keywords[ANOTHER_GENERATED_NAME] = ANOTHER_STATEMENT |
This file contains hidden or 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 awesome_print(text, **kwargs): | |
text = "a format with {GENERATED_NAME} and {ANOTHER_GENERATED_NAME}" | |
std_print(text.format(GENERATED_NAME=(STATEMENT), ANOTHER_GENERATED_NAME=(ANOTHER_STATEMENT), **kwargs)) |
This file contains hidden or 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
name = "oded" | |
age = 26 | |
print("My name is: {name}, my age is: {age} and 2*3={2*3}!") | |
# My name is oded, my age is: 26 and 2*3=6! |
This file contains hidden or 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
from __future__ import print_function | |
import os | |
import sys | |
import six | |
from time import time | |
from random import choice | |
from types import CodeType, FunctionType | |
from functools import wraps | |
from string import Formatter |