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
''' | |
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: |
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
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 |
NewerOlder