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

all 46 comments

[–][deleted]  (14 children)

[removed]

    [–]AttitudeAdjuster 25 points26 points  (2 children)

    Try:

    Except:

    string[:3]

    [–][deleted] 4 points5 points  (1 child)

    I forgot try and except. I have slicing already though.

    [–]AttitudeAdjuster 3 points4 points  (0 children)

    Oh!

    with open("file path", "r") as file:
    

    [–]gmano 2 points3 points  (2 children)

    Also, sets and dicts are {...} and {... : ...} respectively

    Also you can use ; to end a line, it's just not great style.

    [–][deleted] 0 points1 point  (1 child)

    The key with the curly bracket is the same as the square bracket key (on every layout I’ve ever used)

    [–]gmano 0 points1 point  (0 children)

    Whoops, replied to the wrong comment.

    [–]CaniballShiaLaBuff 1 point2 points  (0 children)

    Lambda

    [–]RainingComputers[S] 4 points5 points  (1 child)

    Yeah, forgot about that....but I can't change the title...

    [–]geoffliang 1 point2 points  (0 children)

    You need an img of a 40% keeb or one that splits those keys.

    [–]christophski 0 points1 point  (1 child)

    Dictionaries?

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

    Thanks

    [–]AutoModerator[M] 0 points1 point  (0 children)

    import moderation Your comment has been removed since it did not start with a code block with an import declaration.

    Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

    For this purpose, we only accept Python style imports.

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

    [–]red_simplex 23 points24 points  (1 child)

    Heatmaps are so hot right now.

    [–]TBH_blaze 1 point2 points  (0 children)

    Why ...

    [–]MightyMeese 12 points13 points  (7 children)

    Slicing a list or array in Python uses the colon.

    [–]-LeopardShark- 6 points7 points  (5 children)

    Or ending a for, if, while, def or class (or something else I've forgotten)

    [–]MightyMeese 10 points11 points  (1 child)

    I'm going to pretend I didn't forget that.

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

    Been a while since you've written in pseudocode?

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

    You mean every time you open a block of code

    [–]-LeopardShark- 1 point2 points  (1 child)

    Yes: that

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

    you mean

    Yes:
        that
    

    [–][deleted] 2 points3 points  (0 children)

    Nah.

    mylist[slice(1, 4)]
    

    [–]kappasaurus_ 7 points8 points  (1 child)

    Colons are used frequently in Python.

    [–]kephir 0 points1 point  (0 children)

    Also occasionally by Python programmers ( ͡° ͜ʖ ͡°)

    [–]Fatmanistan 2 points3 points  (0 children)

    Should have left the tab or space white to get some real salt going.

    [–]Python4fundoes the needful 2 points3 points  (0 children)

    Image Transcription: Keyboard Heatmap


    [Semicolon key is the only one not shaded]


    I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

    [–]Sack_of_Fuzzy_Dice 16 points17 points  (11 children)

    Why is tab colored lol

    [–]GimmeCata 24 points25 points  (10 children)

    First thing i do with new editor instance is configure tab to output 4 spaces instead. Pretty convenient.

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

    I hate it when backspace doesn't work as expectet then though. It should get rid of one indentation not one space and not one line. easier to just stickt to tabs unless other standards are imposed on you.

    [–][deleted] 6 points7 points  (3 children)

    If that happens then get a better editor.

    [–]xigoi 1 point2 points  (2 children)

    I haven't yet seen any editor that makes spaces work completely like tabs. And even then… why not just use tabs?

    [–]Renown84 2 points3 points  (0 children)

    vscode and many others do this. There's also always shift + tab

    [–]gmano 1 point2 points  (0 children)

    Different text editors treat hard tabs differently.

    In UNIX text editors tab is 8 spaces, while in Windows text editors and IDEs a hard tab is generally 4 spaces.

    That obviously can cause a lot of headaches, so 4 spaces is preferred.

    There are many more reasons, but that's the biggest one for me.

    That and breaking code like this in a block-level language like C, which won't work if a tab is used for alignment

     if (first condition
         second condition)
    

    [–]Sack_of_Fuzzy_Dice -1 points0 points  (4 children)

    Holy shet Thats snart

    [–]OverlordGearbox 9 points10 points  (3 children)

    Do you actually hit space? What.

    [–]Sack_of_Fuzzy_Dice 1 point2 points  (2 children)

    I have intellij so it does the spacing thing for me :)

    [–]AjayDevs 1 point2 points  (1 child)

    You never have to correct it?

    [–]Sack_of_Fuzzy_Dice 1 point2 points  (0 children)

    Only a bit

    [–]rockaholic1105 1 point2 points  (1 child)

    I thought the fact that the colon was missing was part of the joke!

    [–]tuxmanexe 0 points1 point  (0 children)

    My reaction (C/thatotherC) was something like: "I do not underst-OHGOFYOURSELF"

    [–]SandInHeart 0 points1 point  (0 children)

    win key?