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 | |
import os | |
import statistics | |
import subprocess | |
from time import time as _time | |
class time: | |
def __init__(self): | |
self._start = 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
"""Tested with: | |
- cython==0.27.3 | |
- cython==0.25.2 | |
""" | |
cdef class PairWithConstructor: | |
cdef int a; | |
cdef int b; |
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
""" | |
In [1]: from the_worst_way import why_though | |
In [2]: import ast | |
In [3]: code = ''' | |
...: if a == 1 and a == 2 and a == 3: | |
...: print('ayy') | |
...: else: | |
...: print('lmao') |
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
In [1]: def f(): | |
...: def g(): | |
...: yield | |
...: return g | |
...: | |
In [2]: g = f() | |
In [3]: g().__qualname__ | |
Out[3]: 'f.<locals>.g' |
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
""" | |
In [1]: class C: | |
...: __slots__ = 'a', 'b' | |
...: | |
In [2]: C.__slots__ | |
Out[2]: ('a', 'b') | |
In [3]: from deslot import deslot |
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 itertools import chain, repeat | |
import sys | |
import types | |
# byte offsets for structures | |
if hasattr(sys, 'gettotalrefcount'): | |
# under PyDEBUG builds | |
_f_localsplus_offset = 392 | |
_ob_item_offset = 40 | |
else: |
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 <array> | |
#include <tuple> | |
#include <type_traits> | |
#include <utility> | |
namespace cdict { | |
template<char... cs> | |
using string = std::integer_sequence<char, cs...>; |
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
>>>> platform.python_implementation() | |
'PyPy' | |
>>>> sys.version_info | |
(major=2, minor=7, micro=13, releaselevel='final', serial=42) | |
>>>> def f(): | |
.... a = 'ayy' | |
.... def g(): | |
.... cell_set((lambda: a).__closure__[0], 'lmao') | |
.... g() | |
.... return a |
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
#![feature(use_extern_macros)] | |
use std::io::Read; | |
struct State { | |
program: Vec<u8>, | |
ipt: usize, | |
tape: [u8; 30000], | |
ptr: usize, | |
control_stack: Vec<usize>, |
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
/** C++ implementation of a memory arena with no knowledge of the CPython API. | |
*/ | |
#pragma once | |
#include <algorithm> | |
#include <array> | |
#include <exception> | |
#include <forward_list> | |
#include <iterator> | |
#include <new> |