28 December 2025
mew mewtext not yet in the index
Write a full sentence and remember this group is not for asking for ready made code but help in your code
Hydro ツgood morning, i have a question about a variable value.
this is the code:
client = Client()
client = await client.close()
can i directly assign client.close() to the client to set it to None, or do I have to close it first and then set it to None?
Depends on what close returns, normally a close function shouldn't return anything
George 392.85 °CIs there any case that it returns anything else?
nope, close returns always None, but i'm not sure i can do it. I tried ask to gemini and him/it didn't recommend to use the method directly as the new value
Hydro ツnope, close returns always None, but i'm not sure i can do it. I tried ask to gemini and him/it didn't recommend to use the method directly as the new value
It depends on why do you need that value 🤷♀️
George 392.85 °CIt depends on why do you need that value 🤷♀️
because in future, the variable will be again a client
Hydro ツbecause in future, the variable will be again a client
Normally you reuse that for other operations but i don't know what your code is expected to do in the future.
George 392.85 °CCan it fail closing?
never, it can fail with other operations but if these operations fails, the program automatically close the client
Hydro ツif u want i can show you more of the code, so u can understand better what i'm asking
sorry again for my english
no, i think i said everything i could
George 392.85 °CIf the value is None, then None would just None
ok, so i can just use the method as a value, thx!