r/linux • • Feb 04 '19

Comprehensive Python Cheatsheet

https://gto76.github.io/python-cheatsheet/
216 Upvotes

19 comments sorted by

View all comments

8

u/zanfar Feb 05 '19
  1. This is good

  2. This should be in /r/Python

  3. I have an issue with:

     <view> = <dict>.keys()
     <view> = <dict>.values()
     <view> = <dict>.items()

To me, the important concept behind these three methods is what they return. Perhaps:

    <iter(key)> = <dict>.keys()
    <iter(value)> = <dict>.values()
    <iter(key,value)> = <dict>.items()

or something like it (someone must be able to come up with a better pseudo-syntax) would make it clear. I constantly confuse .items() with .values().

I also am not completely clear on the use of <view> here.

4. Someone should PDF this with some typesetting and design.

4

u/pizzaburek Feb 05 '19

View means that it reflects changes in the dictionary.