Skip to content

Instantly share code, notes, and snippets.

View enomado's full-sized avatar

Stanislav enomado

View GitHub Profile
@enomado
enomado / generic.py
Last active March 12, 2019 16:10
mypy generic with extends Interface
# generic with extends Interface
class PointableProtocol(Protocol):
x: Any
y: Any
def __init__(self, x: Any, y: Any) -> None:
pass
from IPython.terminal.embed import InteractiveShellEmbed
from IPython.core.interactiveshell import DummyMod
import sys
import mako.template
from mako import util, compat
# call - ${ invoke_ipython() }
@enomado
enomado / asd.py
Created January 17, 2016 18:21 — forked from fillest/asd.py
pzdc
import qwe
qwe.dilda = ["sgushenka"]
qwe.ohuet()
struct Yoba {
value: uint
}
impl Yoba {
fn new(value: uint) -> Yoba {
Yoba { value: value }
}
extern mod extra;
use extra::arc::Arc;
use std::rand;
use std::vec;
fn pnorm(nums: &~[float], p: uint) -> float {
nums.iter().fold(0.0, |a,b| a+(*b).pow(&(p as float)) ).pow(&(1f / (p as float)))
}
fn main() {
let nums = [0u, 1, 2, 3];
let iter = nums.iter();
let fil = iter.filter(|&x| x % 2 == 0);
let m : ~[uint] = fil.collect::<~[uint]>();
}