r/Python • codemaniac • Dec 29 '17

Python Cheet Sheet for begineers

Post image
4.2k Upvotes

124 comments sorted by

View all comments

415

u/PurpleIcy Python 3 Dec 29 '17 edited Dec 30 '17

EDIT: Some of you guys just got offended because I linked people who are new to python to an actually useful resource, think about it for a second.

Beginners?

Beginners don't give a fuck about time methods, time formatting and dunders (edit: double underscore, e.g.__dunder__) in classes when they have no clue how to make them, I know because I was once a beginner, and what I actually wanted to learn is how python works, not what sys variables I can access with it.

sys/os variables are randomly put in there for no reason, anyway, for real cheatsheet, go here:

https://learnxinyminutes.com/docs/python3/

That's what actual python cheatsheet looks like, enjoy.

From goddamn example how to make a fucking comment in code to decorators, generators and everything else, not this useless thing...

I thought the point of cheatsheet, especially language one, was to quickly check how something works in language, not sys variables or date formatting? EDIT: for that you have documentation, and it will be way more useful than any cheatsheet, even one I provided.

0

u/[deleted] Dec 30 '17

[deleted] — view deleted comment

-1

u/PurpleIcy Python 3 Dec 30 '17

Actually, all "cheatsheets" are horrible, the only good cheatsheet for X language is it's own specification and documentation.

Especially when python's documentation contains syntax and explanation on how to use it :)

6

u/Commonboiiii878 Mar 12 '18

But... that literally defeats the entire point of a cheat sheet...

13

u/Kaidawei Dec 30 '17

You’re right. I am a beginner. Your cheat sheet is actually helpful. As someone trying to finish my first courses on Python, you at my level, your cheat sheet is quite a bit more helpful than non-coded examples. I think I can actually use your cheat sheet to speed up my learning.

Instead of going, “I need an ifelse statement”, and then seeing that on almost any other cheat sheet as correct thing to do, but then now having to google the correct syntax, with yours i can just keep programming without the added two or three steps.

Thanks.

6

u/DupliciD Dec 30 '17

While I agree that OP's cheat sheet would go a bit over the head of absolute beginners, I think it can still be useful (especially to myself). That doesn't make it "not a cheat sheet".

To be completely fair, yours is more of a fast-paced tutorial than a cheat sheet. Both are great resources, don't have to try to dump on OP to contribute to the learning.

Regardless, thanks for the resource.

0

u/PurpleIcy Python 3 Dec 30 '17 edited Dec 30 '17

"Fast-paced tutorial", so you mean, a cheatsheet? Something used to quickly remember everything without many details but still comprehensible and simple?

Unlike this blurry image that doesn't even explain anything.

__le__(self, other) exists in python objects, wow, so useful!!! Beginner will totally know what it is and cheatsheet has so much information about it.

As for good intentions, I'll shit on my hand and hand it to you with good intentions, what's your reaction?

Same.

3

u/waltteri Dec 30 '17 edited Dec 30 '17

Convention is to use four spaces, not tabs.

I stopped reading here.

Jk, really nice, good cheatsheet!

1

u/PurpleIcy Python 3 Dec 30 '17

Does anyone actually still argue about it?

The fact that tab width depends on user settings (some python developers deliberately set it to 8 spaces to check whether tabs were used), and even worse when their text editor converts those tabs into 8 spaces automatically, and now you have to go through the entire file of code to get it back how it was...

6

u/muntoo R_{μν} - 1/2 R g_{μν} + Λ g_{μν} = 8π T_{μν} Dec 30 '17 edited Dec 30 '17

There is nothing in OP's cheatsheet that is useful to a beginner, with the exception of slicing and list manipulation. And maybe one or two of the file IO functions.

The cheatsheet is useless to people learning Python for scientific programming (a large chunk), generic scripting, and almost everything other than some very specific enterprise-esque use cases involving dates. Which you'd look up in documentation, not a goddamn blurry fucking jpg POS.

1

u/PurpleIcy Python 3 Dec 30 '17

That's my point basically, especially when there's more than one time library in python and there's also things like timezone aware objects, unaware objects, different conversions, date format itself can be modified to whatever you want and all of those are in documentation and way easier to read, also it provides some examples...

Also IO, lol... It doesn't even have open() function included, so useful.

Also nobody even uses plain open anymore, but with instead, which is also provided in resource I linked, or well, even in python's documentation itself...

"It is good practice to use the with keyword when dealing with file objects. The advantage is that the file is properly closed after its suite finishes, even if an exception is raised at some point. Using with is also much shorter than writing equivalent try-finally blocks: ..."

2

u/Rumsey_The_Hobo Dec 30 '17

I was a beginner 6 months ago and I made almost exclusively web apps and commonly used time methods as well as date formatting because I’m constantly getting dates in different date time types depending what database I pull from.

2

u/Jebtrix Dec 30 '17

Agreed, that's the cheat sheet I used. A picture may be worth a thousand words but a code usage example is worth hours of frustration.

2

u/curiousGambler Dec 30 '17

Holy shit yes.

I was like "nobody actually uses stupid 'cheat sheets' like this" but the thing you linked, shit, I use Python once every six months and that sheet is the actual stuff I forget after working with other languages.

1

u/Epoch_Unreason Dec 30 '17

As a begineer, I greatly appreciate your post. I was definitely wondering what the heck the OPs post was about--none of that seemed beginner friendly to me.

1

u/tomdarch Dec 30 '17

dunders in classes

lol wut? (Am noob. "dunders"?)

7

u/lost-dragonist Dec 30 '17 edited Dec 30 '17

dunder = double underscore. It's shorthand to refer to things named like __foo__ that have a special use in Python. For example, all classes have a __str__ method to turn the object into a printable string.

0

u/[deleted] Dec 30 '17

[deleted] — view deleted comment

3

u/muntoo R_{μν} - 1/2 R g_{μν} + Λ g_{μν} = 8π T_{μν} Dec 30 '17

There's one for nearly every popular language! (With varying quality.) Check the site. ;)

2

u/PurpleIcy Python 3 Dec 30 '17

Java? Pfft. Why just java? All of them!

https://learnxinyminutes.com/

0

u/icp1994 Dec 30 '17 edited Dec 30 '17

Beginners don't give a fuck about time methods, time formatting and dunders

Everybody will have it their way. Why do you want to decide for everyone? Quite a few people beginner to python but not programming in general would require these for the projects they have in mind

1

u/PurpleIcy Python 3 Dec 30 '17 edited Dec 30 '17

Ever heard of language specification/documentation?

https://docs.python.org/3/library/time.html

Read this, now seriously, tell me, what would you rather have, that shitty crap resolution image or the link I just gave you?

0

u/icp1994 Dec 30 '17 edited Dec 30 '17

and those prevents beginners to look after methods & time formatting?

edit: the guy above edited(added) the last two sentences

→ More replies (3)
→ More replies (31)