23
March
69d

Python 3 Cheatsheets

Comments
  • 4
    Why is this tagged as a joke? What am I missing here?
  • 1
    What's the joke here...?
  • 3
    I don't get it 🤷‍♂️
  • 0
    Perhaps OP meant it like Python3 is a joke ¯\_(ツ)_/¯
  • 4
    The "concatenate strings" with + wouldn't pass my code review. I know Python does the right thing efficiently in some cases now, but it's just unnecessary. f"some text with {variables}" is more readable and works with any variable type.

    Edit: also the `for item in list` example is horrible
  • 1
    The all lowercase function names bother me about python. "islower".
    It is all about readability for me
  • 0
    @zvyn Is there a performance issue when you use + for Concat in python?
  • 0
    @grumpyoldaf yes used to be the answer, now it is: it depends. But in general `string 1 + string 2` means you copy the content of sting 1 followed by the string 2 into a third variable. That costs twice the memory and len(string1 + string2) steps. cPython 3 (the most used Python 3 implementation) sometimes detects silly usages of + and treats them as `{}{}`.format(str1, str2).
  • 0
    @jespersh yeah, the real problem is that the standard library predates PEP 8, if written today, the function would be called "is_lower".
Your Job Suck?
Get a Better Job
Add Comment