Yes, but all objects are not iterables. If you list1.extend(object1) as the cheat sheet describes and object1 has no __iter__, it won't work. Likewise, you can iterate strings, so understanding the target of the iterable will be frustrating for list_of_strings.extend('newstring').
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
I'm not critizing this, which looks nice esp for people learning (and I'm sure somepeople "work" better with cheat sheets)
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
Thanks for sharing this, and thanks to the OP for these great resources. After taking a few Udacity courses, this will help me retain/expand on my Python skills!
rom is correct, both the math and cmath modules are implemented in C. And even if the math module was pure Python I don't think that the speed of accessing a constant would be drastically different.
I like it a lot and looks very handy. But the author seems to be missing the point of a cheat sheet. I'd prefer something I can post on my desk to take a quick look, a 6 page summary is not a cheat sheet nor it's faster than googling.
I don't have any language cheatsheets anymore and just use http://hyperpolyglot.org/ it has great examples and comparisons for most all languages I'm interested in, in a nice and easy to read format too.
As someone currently going through Learn Python The Hard Way - this is an awesome resource. A lot of it is over my head, but it is an awesome way to scan through stuff without having to dig through the official documentation. It also helped solidify some of the concepts that I am learning, so thank you.
Will some Reddit'r please go and rough him up a bit over the file format (docx). I was going to post this here, until I noticed that it was a repost from Reddit. Cheers
I understand what and why are you saying that. But I don't think it would be polite at all to rough the author up. Considering the time that (s)he took to write this down and decided to shared with the world.
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...
> 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.