Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def smethod():

def cmethod(cls, something):
"""class method-to-be"""
print('value: {}').format(123)

Choose a reason for hiding this comment

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

Syntax error in cmethod function on line 29 causing parse failure

The function cmethod defined on line 29 contains incorrect indentation and misuse of print statement and string formatting, causing a syntax error. This prevents the code from running and must be fixed for proper execution. Correct by indenting print properly and using print('value: {}'.format(123)) syntax.

Choose a reason for hiding this comment

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

The .format() method is called on the result of print(), which is None

The code print('value: {}').format(123) will fail at runtime. In Python 3, print() is a function that returns None. Calling .format() on None raises an AttributeError. The correct syntax is print('value: {}'.format(123)).


cmethod = classmethod(cmethod)

Expand Down
Loading