Python Cheat Sheet
docs.google.com
Here is the original link: http://www.reddit.com/r/Python/comments/zbwme/is_anyone_interested_in_the_python_cheat_sheet_i/
docs.google.com
Here is the original link: http://www.reddit.com/r/Python/comments/zbwme/is_anyone_interested_in_the_python_cheat_sheet_i/
> list1.extend(object1): Extends list1 with object1 creating a whole list instead of append which jams a an object inside the list.
Extend takes an iterable and not an object. Not sure I can even comprehend that sentence.
> dictionary1.update(dictionary2): updates dictionary1 with values from identical keys in dictionary2
Identical to what? Update adds all key-value pairs from dictionary2. I guess the text might refer to the fact that update overwrites existing values.
> ‘string1’.strip(): Returns one string with whitespace removed.
Only at the start and end of the string.
> ’string1’.count(object1): Returns the number of times that object1 appears in string1.
This method doesn't exist as far as I can tell and I'm not sure how an object "appears" in a string.
>>> 'test'.count('e')
1
>>> 'test'.count('')
5
>>> 'test'.count('tes')
1
>>> 'test'.count('t')
2
>>> 'test'.count('apple')
0
Seems to be the equivalent of `in` on a string but with a count.This is better described in python's native help documentation:
$ python
>>> help()
>>> list
searching for extend via '/extend': | extend(...)
| L.extend(iterable) -- extend list by appending elements from the iterable
Concise and correct.Make a better one and get it to the front page of HN.
http://rgruet.free.fr/PQR27/PQR2.7.html
Other versions available.
Go to the page and search for your thing, easy.
But, one reason I like Python is it's small and regular enough to not need a cheat sheet (this does not apply to stdlib which has large swaths of wtfness, and is changing as people keep bloating up the language, ternary)
And, any decent editor should be highlighting, tab completing and hooked into pyhelp to provide a context aware , dynamic, interactive "cheat sheet". E.g vim with following vim plugins pydoc, python_calltips, supertab and proly should throw in pep8 and pyflakes. Check it -> https://github.com/njharman/dotfiles
Here is the original link: http://www.reddit.com/r/Python/comments/zbwme/is_anyone_inte...
Please use non-proprietary document formats. It's the polite thing to do. http://www.fsf.org/campaigns/opendocument/reject
Sorry, but it sounded really weird to me to ask for politeness in this context. What I would do is suggesting the change of format, or even better do it by myself if that would be bothering me that badly. Just saying...
Be sure to tell them about Linux while you're harping on their file format choice.