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
import contextlib | |
import io | |
captured_output = io.StringIO() | |
with contextlib.redirect_stdout(captured_output): | |
help(pow) | |
captured_string = captured_output.getvalue() | |
print(captured_string.upper()) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Pretty Nice Login Page</title> | |
<link rel="stylesheet" href="style.css" type="text/css"> | |
</head> | |
<body> | |
<form class="box" action="index.html" method="post"> | |
<h1>Login</h1> |
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 test(): | |
"""Stupid test function""" | |
L = [i for i in range(100)] | |
if __name__ == '__main__': | |
import timeit | |
print(timeit.timeit("test()", setup="from __main__ import test")) |
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
from contextlib import contextmanager | |
from time import time | |
@contextmanager | |
def timing(description: str) -> None: | |
start = time() | |
yield | |
ellapsed_time = time() - start |
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
from time import time | |
class Timer(object): | |
def __init__(self, description): | |
self.description = description | |
def __enter__(self): | |
self.start = time() | |
def __exit__(self, type, value, traceback): | |
self.end = time() |
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
import random | |
from boxx import timeit | |
def list_sort(arr): | |
return arr.sort() | |
def sorted_builtin(arr): |
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
import random | |
import resource | |
import sys | |
import time | |
from sniffing import FunctionSniffingClass | |
def list_sort(arr): | |
return arr.sort() |
NewerOlder