This is from my discord bot in python, this section was remade since and even the bot was rewritten in rust. This line is responsible for formatting a large section of embed that shows bot's config.
you want your coworkers marvel at your clever single line solution, instead of thinking you're some kind of programming pleb that needed 4 lines to implement this unknown functionality.
# A VERY long line
config_commands_embed = '\n'.join([('**`'+command.name+'`**:\n'+((('Whitelisted in:\n'+'\n'.join(['<#'+str(whitelist_id)+'>' for whitelist_id in guild_config.raw
_config['commands'][command.name]['whitelist']])) if guild_config.raw_config['commands'][command.name]['whitelist'] else (('Blacklisted in:\n'+'\n'.join(['<#'+str(blackl
ist_id)+'>' for blacklist_id in guild_config.raw_config['commands'][command.name]['blacklist']])) if guild_config.raw_config['commands'][command.name]['blacklist'] else
'Enabled')) if guild_config.raw_config['commands'][command.name]['enabled'] else 'Disabled')+'\n') for command in self.bot.commands])
If I had to work with someone that wrote code like this I’d quit my job. Zero effort to write something readable, absolute hell to maintain. More interested in being “””clever””” than using a realistic solution. Rant over.
4
u/JohnTheCoolingFan Jan 18 '23
This is from my discord bot in python, this section was remade since and even the bot was rewritten in rust. This line is responsible for formatting a large section of embed that shows bot's config.
Edit: you can explore the codebase at the moment here: https://github.com/JohnTheCoolingFan/Motorchik/blob/82fda1d3e15adda9b4961aa059c4f4b4cb74a219/configuration.py#L110
37
u/PonchoVire Jan 18 '23
The best detail about this is the comment.
30
u/trutheality Jan 18 '23
PSA: it's ok to have line breaks in a list comprehension.
21
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Jan 18 '23
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
7
u/RoLoLoLoLo Jan 18 '23
Throwing this line into black playground:
3
u/Dankinater Jan 19 '23
If I had to work with someone that wrote code like this I’d quit my job. Zero effort to write something readable, absolute hell to maintain. More interested in being “””clever””” than using a realistic solution. Rant over.
2
u/GaeemzGuy Jan 18 '23
wat duh heeeeeeaaaaallllll
2
u/ASHMAN4001 Jan 19 '23
Version 1 be like
2
u/sintos-compa Jan 20 '23
When bossman starts paying less for kloc
2
u/benchmarks666 Jan 21 '23
💋