-
Notifications
You must be signed in to change notification settings - Fork 28
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
Andrei Trukhan #37
base: master
Are you sure you want to change the base?
Andrei Trukhan #37
Conversation
test_main.py полностью отрабатывает на локальной машине. Не понимаю, почему не запускается тут. |
@@ -0,0 +1,105 @@ | |||
from pycalc.main import Stack | |||
from pycalc.consts import * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Импорт через звездочку -- это зло
from pycalc.consts import * | ||
|
||
|
||
def check_mistakes(expression, functions={}, mode=0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Крайне не рекомендуется использование изменяемых типов данных в качестве аргумента по умолчанию в функциях. Такие объекты создаются лишь единожды при создании объека функции, а не каждый раз при ее выполнении.
|
||
if len(expression) == 0: | ||
if mode == 0: | ||
return "ERROR: empty expression" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Для этих целей нужно использовать исключения, а не возвращаемые значения
return result | ||
|
||
|
||
def separate(expression): # separates expression to logical parts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Для этих целей лучше спользовать класс или отдельный модуль, чем функция
|
Release version.