Skip to content

Instantly share code, notes, and snippets.

@nyaray
Created October 23, 2012 17:30
Show Gist options
  • Save nyaray/3940220 to your computer and use it in GitHub Desktop.
Save nyaray/3940220 to your computer and use it in GitHub Desktop.
Martin-notes
dir(objekt) -> [alla metoder o fält i objekt]
help(objekt|typ) -> man-sida
tex help(str)
(eller dir(str))
dir är lite mer kompakt om man vet vad man letar efter
help är när man inte vet :P
also, in-operatorn
1 in [1,2,3] ==> true
'lolboll' in {'lolboll':'ohai'} ==> true
enklare pattern matching, tex a,b,c = (1,2,3)
a,b,_ = 1,2,3
[a,b]=[1,2]
ah, juste, en sak till: listsyntaxen
typ
'hello'[1:]
'hello'[2:3]
'hello'[::-1]
inbyggt whatever you need (tm) ;D
def f(x,y,z): print x,y,z
args = {'x':1,'y':2,'z':3}
f(**args)
args2 = [1,2,3] # positional
f(*args)
sen har python list comprehensions som erlangs
[do_shit_with(x) for x in collection (if x...)]
där (...) är frivillig
@aerosol
Copy link

aerosol commented Oct 24, 2012

unicode!!!11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment