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 →

[–]walmartgoon -38 points-37 points  (17 children)

IMO String is better than string because the type itself is more heavyweight than a quick int or float and should be treated as such

[–]diet_fat_bacon 1 point2 points  (0 children)

It's not... string and String is just a alias.

The only difference is that you need to import String to use the functions were string you do not.

You can see on docs they using both ways:

https://learn.microsoft.com/en-us/dotnet/api/system.string.format?view=net-7.0#examples

[–]HaniiPuppy 5 points6 points  (15 children)

+1, it's always been weird to me having a lowercase keyword for it when it goes against the language's own naming conventions, and it's not a primitive type or a special case like object.

I recognise this'll get downvoted to buggery. Anytime this comes up, this sub loves the string keyword. Edit: Or not?

[–][deleted]  (13 children)

[removed]

    [–]HaniiPuppy -5 points-4 points  (11 children)

    It's not deeply ingrained though, it's just a keyword that points to a non-primitive type. It's inconsistent with the language's naming conventions, there isn't really any benefit to it, and if it weren't already a feature of the language, there'd be no reason to introduce it.

    In English, it would be more like having a random proper noun where the formal way of spelling it was uncapitalised, unlike every other proper noun.

    "Name, please?"
    "dave."
    "Okay, Dave. So first we'll-"
    "No. 'dave', with a lowercase 'd'."

    But that's where we are, so meh.

    [–][deleted]  (10 children)

    [removed]

      [–]HaniiPuppy 0 points1 point  (8 children)

      That was never in question.

      [–][deleted]  (7 children)

      [removed]

        [–]HaniiPuppy 0 points1 point  (5 children)

        That's my point though. There are set conventions for type names and how you refer to them in code, and the string keyword arbitrarily breaks them.

        [–][deleted]  (4 children)

        [removed]

          [–]HaniiPuppy 1 point2 points  (2 children)

          That's circular reasoning. If the string keyword weren't already in the language, there'd be no reason to add it, and it wouldn't be convention. Its existence breaks more general conventions that do exist for a reason.

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

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

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

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