Created
October 23, 2012 17:30
-
-
Save nyaray/3940220 to your computer and use it in GitHub Desktop.
Martin-notes
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
unicode!!!11