I hereby claim:
- I am nocturn9x on github.
- I am nocturn9x (https://keybase.io/nocturn9x) on keybase.
- I have a public key ASC8LRMIpeVf9O8RG9kDpgPCCYpNC7DqyCZAf9cU_o8DRAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
from threading import RLock, get_native_id | |
class ThreadSpace: | |
""" | |
A naive implementation of thread-local | |
space in pure Python. All operations on | |
this object are thread-safe as they internally | |
acquire and release a thread lock when needed |
#!/usr/bin/env python3 | |
## This looks like a fun problem | |
import argparse | |
from typing import Optional, Union | |
def gen(n: Union[int, float]) -> Union[int, float]: | |
""" | |
Handy generator for the 3n+1 | |
sequence |
#!/usr/bin/env python | |
# Copyright 2021 Mattia Giambirtone & All Contributors | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
from typing import List, TypeVar, Optional | |
from operator import gt, lt | |
T = TypeVar("T") # type: ignore | |
def is_sorted(l: List[T], *, reversed: Optional[bool] = False) -> bool: | |
if reversed: | |
op = gt |