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

TunaHobby picture TunaHobby  路  3Comments

Be4Vision picture Be4Vision  路  3Comments

superloach picture superloach  路  3Comments

ghost picture ghost  路  3Comments

reuscam picture reuscam  路  3Comments