N
N
NothingMakesSense2021-11-26 15:46:46
Python
NothingMakesSense, 2021-11-26 15:46:46

What is "@" used for in front of variables in Python?

Hello, I recently started studying the topic of creating telegram bots, and in all the guides, the "dp" variable, which is an instance of the Dispatcher class, is preceded by the "@" symbol. I do not like to just copy someone else's code, so I would like to know what it is used for in this and other cases.

Code snippet where this symbol is used:

# tg bot init
api = Bot(token = config.TG_API_TOKEN)
dp = Dispatcher(api)

@dp.message_handler()
async def echo(message : types.Message) :
    await message.answer(message.text)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alan Gibizov, 2021-11-26
@NothingMakesSense

For you to ask yourself this question and discover the benefits of textbooks . 61a0da3259ddf867054068.jpegAn entire chapter is devoted to the question!

spoiler
These crooks in videos about bots themselves studied this issue, but they don’t teach you, but force you to repeat stupid actions like monkeys. So you need it, ignoramuses.

I
inworkl, 2021-11-26
@inworkl

These are the decorators

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question