Discord.py: [Suggestion] Concatenate username and discriminator with strings

Created on 25 May 2018  路  4Comments  路  Source: Rapptz/discord.py

When including a given user's username and discriminator inside a string, like such:

arg = "User: '%s'" % user

the snippet works. However, the same does not happen when it is done implicitly, like this:

arg = "User: " + user

Could the second snippet be a valid way of achieving the same result as well?

invalid

Most helpful comment

This isn't how Python works.

All 4 comments

arg = "User: " + str(user)

Also, better to ask questions like this on discord.py server

Implicit casting to string with concatenation is impossible, by the way.

This isn't how Python works.

@LyricLy sure it is, just define __add__ and __radd__.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

imayhaveborkedit picture imayhaveborkedit  路  58Comments

ams2990 picture ams2990  路  14Comments

TomOrth picture TomOrth  路  15Comments

johndoe434 picture johndoe434  路  21Comments

wolfclaws picture wolfclaws  路  17Comments