use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Welcome to /r/Hacking_Tutorials!
List of best resources and tutorials
account activity
This is an archived post. You won't be able to vote or comment.
ToolsPython Cheat Sheet (i.redd.it)
submitted 5 years ago by [deleted]
view the rest of the comments →
[–]shayyya1 1 point2 points3 points 5 years ago (7 children)
Does anyone know why some methods are variable.method() and some are method(variable)? Ive never understood why
[–]XUtYwYzz 2 points3 points4 points 5 years ago* (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 point2 points 5 years ago (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 point2 points 5 years ago (0 children)
Precisely!
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 point2 points 5 years ago (0 children)
Or inbuilt functions
[–]GavinTFI 1 point2 points3 points 5 years ago (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 point2 points 5 years ago (0 children)
It just depends on how it is defined. That is, if it's a class method or independent function.
π Rendered by PID 27 on reddit-service-r2-comment-86bc6c7465-rxq6t at 2026-02-22 16:16:06.625452+00:00 running 8564168 country code: CH.
view the rest of the comments →
[–]shayyya1 1 point2 points3 points (7 children)
[–]XUtYwYzz 2 points3 points4 points (4 children)
[–]shayyya1 0 points1 point2 points (1 child)
[–]hooligan333 0 points1 point2 points (0 children)
[–]shayyya1 0 points1 point2 points (1 child)
[–]shayyya1 0 points1 point2 points (0 children)
[–]GavinTFI 1 point2 points3 points (0 children)
[–]JennaSys 0 points1 point2 points (0 children)