I hereby claim:
- I am motivic on github.
- I am motivic (https://keybase.io/motivic) on keybase.
- I have a public key whose fingerprint is C8F7 82FA 8A76 6F7F 10C0 8A3B 224E 043B EB01 F627
To claim this, I am signing this object:
| # http://stackoverflow.com/questions/222877/how-to-use-super-in-python | |
| class SomeBaseClass(object): | |
| def __init__(self): | |
| print('SomeBaseClass.__init__(self) called') | |
| class ChildClass(SomeBaseClass): | |
| def __init__(self): | |
| print('ChildClass.__init__(self) called') | |
| SomeBaseClass.__init__(self) |
| # Property and inheritance | |
| # http://stackoverflow.com/questions/1021464/how-to-call-a-property-of-the-base-class-if-this-property-is-being-overwritten-i | |
| class Foo(object): | |
| def __init__(self): | |
| self._x = 'Foo' | |
| @property | |
| def x(self): | |
| return self._x | |
| # Compiled source # | |
| ################### | |
| *.com | |
| *.class | |
| *.dll | |
| *.exe | |
| *.o | |
| *.so | |
| # Packages # |
I hereby claim:
To claim this, I am signing this object:
| #include <stdio.h> | |
| int main() { | |
| double a = 100.0; | |
| printf("double 100.0 into float: %lf \n", *(float*)(&a)); | |
| float b = 0.99; | |
| printf("float 0.99 into double: %lf \n", *(double*)(&b)); | |
| float c = 100.0; |
| module Enumerable | |
| def each_permuted | |
| n = self.length | |
| arr = *(0..n-1) | |
| (n-1).downto(0) do |i| | |
| j = rand(i) | |
| arr[i], arr[j] = arr[j], arr[i] | |
| end | |
| arr.each do |x| |
| module Enumerable | |
| def each_with_flattening(&block) | |
| self.flatten.each do |x| | |
| yield(x) | |
| end | |
| end | |
| end |
| class FibSequence | |
| include Enumerable | |
| def initialize(n) | |
| @n = n | |
| @a1 = 0 | |
| @a2 = 1 | |
| end | |
| def each |
| module Enumerable | |
| def each_with_custom_index(start, step) | |
| index = start | |
| self.each do |x| | |
| yield(x, index) | |
| index += step | |
| end | |
| end | |
| end |
| class Class | |
| def attr_accessor_with_history(attr_name) | |
| attr_name = attr_name.to_s | |
| raise ArgumentError, "'history' is a keyword" if attr_name == 'history' | |
| #getter | |
| self.class_eval("def #{attr_name};@#{attr_name};end") | |
| #setter | |
| self.class_eval %Q{ |