Skip to content

Conversation

@BSroad
Copy link

@BSroad BSroad commented May 30, 2019

the final version of the code

@BSroad BSroad changed the title [WIP] Mariya Polyakova Mariya Polyakova May 30, 2019


def is_operand(token):
if token.isdigit() or is_float(token):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно просто сделать return token.isdigit() or is_float(token)

func_name, func_attr_count = decode_func_attr_count(token)
while func_attr_count > 0:
if not stack:
raise Exception("missing argument")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно создавать кастомные исключения. Такой подход делает код более читаемым


def is_token_basic_operator(token):
exceptions = [')']
if token in exceptions:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Функция выглядит довольно странно. Какой смысл создавать список из одного значения и проверять входит ли аргумент в этот список? Не проще ли просто сравнить?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants