Date post: | 05-Dec-2014 |
Category: |
Technology |
Upload: | shuen-huei-guan |
View: | 3,024 times |
Download: | 5 times |
Shuen-Huei Guan Digimax Inc. 2009/06
Python Programming 101: Coding Style
Code Like a Pythonista: Idomatic Python
/* -- C -- */
if (some condition)
if (some condition)
do_something(fancy);
else
this_sucks(badluck);
/* -- another C -- */
if (condition)
somethingsExecuted();
alwaysExecuted(shouldNot);
alwaysExecuted();
# -- Python --
def myfunction(foo, bar):
foo.boing()
for i in bar.fizzle(foo):
baz = i**2
foo.wibble(baz)
return foo, baz
tab size:2 tab size:3 tab size:4 tab size:8
“ general syntax on set modeline set ruler set autoindent “set smartindent “ search set hlsearch set incsearch set showmatch set ignorecase set smartcase “ mouse set mouse=a
autocmd BufRead *.py set sw=4 sts=4 et autocmd BufRead *.py set smartindent
cinwords=if,elif,else,for,while,try,except,finally,def,class
# vim: set sw=4 sts=4 et hls is si nu:
autocmd BufRead *.py set list listchars=tab:»_ # ref: http://vim.wikia.com/wiki/Highlight_unwanted_spaces
hello, world by oskay @ flickr.com
Jump to Conclusions mat by Katkreig @ flickr