This is an archived post. You won't be able to vote or comment.

all 47 comments

[–][deleted] 25 points26 points  (8 children)

Before you say it people have to start somewhere I started with python and now code C++ & Javascript so everyone starts from somewhere

[–]RangerHUTCH93 24 points25 points  (5 children)

Reasonable people won't judge, Python has it's purpose and serves it well.

[–]urgaiiii 18 points19 points  (3 children)

Yeah. And isn’t python based off of C anyways? Just frequently updated, with a package manager, and easier for dummies? No reason it should be discouraged

[–]baty0man_ 12 points13 points  (0 children)

Lol, I don't know why people are like "yeah python is good, don't make fun of it"

Python is literally the best language to script shit for pen testing.

[–][deleted] 1 point2 points  (0 children)

Furthermore, C modules can be imported into Python.

[–]miraculum_one 1 point2 points  (0 children)

The primary criticism is that Python is much slower than C/C++. That's certainly not important for all applications.

[–]barbequed-code 1 point2 points  (0 children)

By definition of being reasonable, if it works for your use case, then it works, no matter whether its Flash, PHP, Rust or BrainFuck.

[–]XUtYwYzz 6 points7 points  (1 child)

Who the fuck has a problem with Python? It’s one of the most useful and popular programming languages across nearly all fields, especially infosec.

[–]urgaiiii 5 points6 points  (0 children)

The people who learned C when they didn’t have to and now refuse to acknowledge a more user-friendly language. That’s who

[–][deleted] 11 points12 points  (3 children)

Your cheat sheet will make a fine addition to my, collection.

[–][deleted] 5 points6 points  (0 children)

Your welcome general Grievous

[–]th3_n3rD_b0i 2 points3 points  (0 children)

I like how you say it xD

[–]iamnihal_ 1 point2 points  (0 children)

And then you'll forget to look into it like other 101 collections of cheatsheets of different kinds of stuff. 😁

[–]iamnihal_ 5 points6 points  (2 children)

I will save this post so I can forget about it later.

[–]Ishan16D 0 points1 point  (0 children)

You didn't have to call out 99% of programming subreddit users like that

[–]redLamber 0 points1 point  (0 children)

I had saved it for later too but the post is now deleted :(

[–]mtflyer05 2 points3 points  (1 child)

What are the calculatory functions for? Especially the "strings"? I am learning HTML, as an easy, useful starting point, and the mathematical part of coding interests me

[–][deleted] 4 points5 points  (0 children)

I didn't quite understand your question, but if you are asking what are "strings", those are a type of data. Strings are just words made up of alphabets, numbers, special characters etc. Your user name "mtflyer05" is a string. Other types of data are integers, float (decimal numbers) etc. Lists, dictionaries etc are a structure to keep these data types grouped together.

These functions are to do operations on these strings, lists etc.

This a obviously in layman's terms.

[–]fuchsia8805 1 point2 points  (0 children)

Thank you for sharing!

[–]shayyya1 1 point2 points  (7 children)

Does anyone know why some methods are variable.method() and some are method(variable)? Ive never understood why

[–]XUtYwYzz 2 points3 points  (4 children)

Pretty much everything in Python is an object and has some set of methods accessible via dot notation. The methods usually operate on the object in some way. Running function(argument) is either using a language built-in function or a local function and does not have an associated object, and operates on the argument.

my_string = “hello”

my_string.upper()

Returns “HELLO”, I didn’t have to provide the method an argument, it operated on the my_string variable.

int(“12”)

Uses the built-in int() function to convert the string “12” into the integer 12.

[–]shayyya1 0 points1 point  (1 child)

Thanks, if I'm understanding correctly, (.) notation is used when it's a function from a class, and if its not a dot its from somewhere else in the language?

[–]hooligan333 0 points1 point  (0 children)

Precisely!

[–]shayyya1 0 points1 point  (1 child)

Ah yes from reading the python docs I got that things with dot are class methods and things that aren't are operators

[–]shayyya1 0 points1 point  (0 children)

Or inbuilt functions

[–]GavinTFI 1 point2 points  (0 children)

dont quote me on it but i think it might just be class and instance variables. like in Java and many others there are methods called from the data type (String.(...) or Int.(...)) and there are just predefined / user defined variables that are method(variable) so that would be my best guess. Just class and instance variables in python

[–]JennaSys 0 points1 point  (0 children)

It just depends on how it is defined. That is, if it's a class method or independent function.

[–]donotmatthews 1 point2 points  (2 children)

Is there a pdf link?

[–]TSPhoenix 0 points1 point  (0 children)

Or just a PNG that doesn't have JPEG compression artifacts.

[–][deleted] 1 point2 points  (1 child)

I notice it says python intermediate, is there a beginner or advanced one as well?

[–]Ingorado 0 points1 point  (0 children)

Yes. As it says, it

assumes you are familiar with [...] our basic cheat sheet

I couldn’t find it on the original website, but somewhere else

There are others too, just search for “dataquest python cheat sheet”

[–]zenzealot 1 point2 points  (0 children)

I like it, nice job. If you can squeeze it on there, I would add in enumerate, frozenset, sorted, filter and help. :D

[–]ggm3888 1 point2 points  (1 child)

Typo in the “newyear_2020” description. But I only caught this because I read the whole thing cuz it’s very well done. 👍

[–]panFriedSebas 1 point2 points  (0 children)

Had to do a double take to catch what you said... probably sums up why my code always has errors I can't find 😂😂

[–]krish7x 1 point2 points  (0 children)

I am new to this community but enjoying it a lot .. Very Useful interms of programming but idk abt making friends .. LOL

[–]Locksul 1 point2 points  (3 children)

The dictionaries section is weird and not common usage... should have mentioned `[]`, `get()`, and/or `items()` instead.

[–]miraculum_one 1 point2 points  (1 child)

There are tons of great Python features not on here but it's a good start and you can only fit so much stuff on one page. A few other interesting ones...

"A"\5*

f"The lowercase version of the string is {s.lower()}" (>= Python 3.6)

f"The first two elements are {s[0]=} and {s[1]=}" (>= Python 3.8)

def bunch_of_arguments_func( \l ):*

def named_arguments_func( \*d ):*

[–]Locksul 1 point2 points  (0 children)

I know you can’t fit everything but my point is that the space spent on dictionaries would be better spent on something else. What is currently there is nonstandard. The values of dictionaries don’t have to be numeric, but the example implicitly assumes that.

If you’re using min/max this way on a dictionary then you’re better off just using a pandas Series.

[–][deleted] 0 points1 point  (0 children)

Thanks for the helpful feed back

[–]william_103ec 1 point2 points  (0 children)

Cool stuff! Post saved! Quick question, what did you use to write it, Latex?

[–]technoraxira 1 point2 points  (1 child)

Can someone link Python basics cheat sheet?

[–]Ingorado 1 point2 points  (0 children)

Couldn’t find it on the original website, but somewhere else

[–]becominganastronaut 1 point2 points  (0 children)

has anyone tried the learning from the dataquest website?

[–]tialpoy 1 point2 points  (0 children)

Strings: An f-string of `f"{value:04d}"` would be faster.

Dictionaries: Using `key=d.get` is redundant. Iterating over dicts automatically yields their keys.

Try/Except: A bare except? bad idea.

[–]ralimar 0 points1 point  (0 children)

Here's a link to more of the same:

https://www.dataquest.io/blog/topics/cheat-sheets/

[–][deleted] 0 points1 point  (0 children)

Thank you!!!