Skip to content

Instantly share code, notes, and snippets.

View khaotik's full-sized avatar
💫
gradient descending

khaotik

💫
gradient descending
View GitHub Profile
@khaotik
khaotik / pyutil.py
Created September 3, 2016 03:29
Random small and useful utilities for python
'''
A collection of small python snippets that help code looking better
'''
class given(object):
'''
make a closure with local variables using with statement
usage example:
@khaotik
khaotik / codingstyle_py
Last active July 31, 2017 03:04
Collections of my python coding style
Collections of my python coding style
[General]
- Rules are recommended but not strict, and not recommnaded for code golfing.
- Name global constant like C macros, FOR_EXAMPLE
- Name global variable (non-constant) with prefix "g_"
- function arguments names always with suffix "_", to avoid clashes like fn( .., dtype=dtype ), it's weird and sometime cause misunderstanding of code
def example_function(arg1_, arg2_):
local1 = arg1_+arg2_
return local1