Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Дефолтные значения в функциях #24

Open
TheZavitaev opened this issue Oct 15, 2022 · 1 comment
Open

Дефолтные значения в функциях #24

TheZavitaev opened this issue Oct 15, 2022 · 1 comment

Comments

@TheZavitaev
Copy link

https://github.com/Danstiv/cm-assistant/blob/master/tgbot/exception_handler.py#L92

А аргументах у тебя - limiters=None, а потом limiters = limiters or [], почему бы по дефолту пустой список не указать в аргументах?

@Danstiv
Copy link
Owner

Danstiv commented Oct 15, 2022

Нельзя пустой список в аргументах, в питоне это может нехорошо закончиться.

>>> def test(l=[]):
...  l.append(42)
...  print(l)
...
>>> test()
[42]
>>> test()
[42, 42]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants