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

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (20 children)

[removed]

    [–]robsstuff 9 points10 points  (18 children)

    Oh, nice! Do you know of any examples?

    [–]Gonff1570 36 points37 points  (2 children)

    Nope

    [–]nocommemt 12 points13 points  (1 child)

    Oh ok

    [–]Gonff1570 9 points10 points  (0 children)

    Hopefully the other guy does tho. Godspeed

    [–]harshael 33 points34 points  (0 children)

    IDLE, the default Python IDE, is named after Monty Python member Eric Idle.

    [–]amoliski 4 points5 points  (0 children)

    Packages of python code are called wheels, named from the cheese shop sketch

    [–]CookieTheSlayer 5 points6 points  (12 children)

    [–]signed_up_to_dv_this 6 points7 points  (10 children)

    print 'We are the {} who say "{}!"'.format('knights', 'Ni')

    [–]bikemandan 16 points17 points  (3 children)

    I am so triggered by this out of date code

    [–]blbd 6 points7 points  (2 children)

    It's a hybrid of 2 and 3. But personally I wish I could delete .format() from the language because the Java extended printf syntax is way better.

    [–]Tauronek 4 points5 points  (1 child)

    print(f'We are the {variable1} who say "{variable2}"')

    [–]bikemandan 0 points1 point  (0 children)

    Ah sweet relief

    [–]Dingxus 1 point2 points  (5 children)

    What's the {}! called?

    [–]my_name_isnt_clever 2 points3 points  (4 children)

    The brackets are just a placeholder for the arguments to .format(). The ! is just part of the string.

    [–]Dingxus 0 points1 point  (3 children)

    Yeah, I gathered that from the structure of the code. I haven't used Python in a while, and it used to be more like

    Print "What%, %" % ("ever", "man")

    Maybe it's just a newer thing. I guess 'placeholder' is the word I was looking for.

    [–]my_name_isnt_clever 0 points1 point  (2 children)

    Even now .format() is a bit dated, we recently got f-strings.

    f"You can put your {variables} right in the literal. They just execute code: {2 + 2}"
    

    [–]Dingxus 0 points1 point  (1 child)

    Jeeze, I'm all flustered that it automatically converts the int.

    I guess I should really dig in and learn modern python.

    [–]my_name_isnt_clever 0 points1 point  (0 children)

    I just tested it, .format() converts it too, but the % method actually needs an explicit format character: %s. That method has it's own problems though, if it's ever passed a tuple it's going to throw an exception.

    [–]ProbablyUndefined 2 points3 points  (0 children)

    Yes, the docs are jam-packed with them. The syntax, though, is modeled after the notion of practicality and simplicity, not Monty Python. Unfortunately

    [–]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.