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
>>> f = lambda x: (max(x) - y := min(x)) / y | |
File "<stdin>", line 1 | |
SyntaxError: can't assign to operator | |
>>> f = lambda x: (max(x) - (y := min(x))) / y | |
>>> f([1, 2, 3, 4, 5]) | |
4.0 |
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
>>> total = 0 | |
>>> [total := total + v for v in [1, 2, 3]] | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "<stdin>", line 1, in <listcomp> | |
UnboundLocalError: local variable 'total' referenced before assignment | |
>>> total # ?!?! | |
0 # D= | |
>>> [(total := total + v) for v in values] # parantheses don't solve the problem | |
Traceback (most recent call last): |
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 Immortal: | |
def __del__(self): | |
global x | |
x = self | |
x = Immortal() | |
del x | |
del x | |
del x # NameError: name 'x' is not defined |
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
image_a = [ | |
[1,0,0,0,1,0,1], | |
[0,1,0,1,0,0,1], | |
[0,1,0,0,0,1,1], | |
[0,0,1,1,1,0,0], | |
[0,0,0,0,1,1,1], | |
[0,1,0,0,0,1,1], | |
[0,0,0,1,1,1,0], | |
] | |
image_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
from functools import lru_cache | |
class File: | |
def __init__(self, filename, mode): | |
self.filename = filename | |
self.mode = mode | |
@lru_cache(1) | |
def __enter__(self): |
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
y=1230, x=524..528 | |
y=977, x=460..462 | |
y=1757, x=566..584 | |
y=849, x=500..502 | |
y=1269, x=413..418 | |
y=1045, x=469..473 | |
x=574, y=475..495 | |
y=1349, x=395..404 | |
x=470, y=689..699 | |
y=484, x=444..447 |
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
...................................................................................................................................+..................................................................................... | |
...................................................................................................................................|..................................................................................... | |
...................................................................................................................................|..................................................................................... | |
...................................................................................................................................|..................................................................................... | |
...................................................................................................................................|.................... |
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
2019-05-28 10:10:02,431 - waitress - ERROR - Exception while serving /root/pypi/+simple/ | |
Traceback (most recent call last): | |
File "/usr/local/lib/python3.7/site-packages/pyramid/tweens.py", line 13, in _error_handler | |
response = request.invoke_exception_view(exc_info) | |
File "/usr/local/lib/python3.7/site-packages/pyramid/view.py", line 779, in invoke_exception_view | |
raise HTTPNotFound | |
pyramid.httpexceptions.HTTPNotFound: The resource could not be found. | |
During handling of the above exception, another exception occurred: |
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 ubuntu | |
RUN apt update | |
RUN apt install -y git make autoconf automake libtool curl make g++ unzip zlib1g-dev build-essential libncursesw5-dev libreadline-gplv2-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev libbz2-dev libffi-dev | |
RUN git clone https://github.com/python/cpython.git | |
RUN cd /cpython && git checkout 3.8 && \ | |
./configure && make && make install | |
RUN git clone https://github.com/protocolbuffers/protobuf.git | |
RUN cd /protobuf && git submodule update --init --recursive && ./autogen.sh && ./configure && make && make install | |
RUN cd /protobuf/python/ && python3 setup.py build && python3 setup.py 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
# This script contains instructions that can be used to showcase how the reloader.py script is suppsoed to be used. | |
# The module reloading itself cotnains only pure python, so the only thing you'll need to run it is a working | |
# python3 interpreter | |
# setup start: | |
$ python3 -m venv env_0_12 # version 0.12 is going to be installed in here ... | |
$ python3 -m venv env_0_13 # ... and version 0.13 in here | |
$ env_0_12/bin/python3 -m pip install pyarrow==0.12 | |
[...] | |
Successfully installed numpy-1.16.4 pyarrow-0.12.0 six-1.12.0 |
OlderNewer