Jonathan Hsu <[email protected]> added the comment:
While the current behavior may be initially unexpected, it does match the way
that python normally behaves when defining class variables. For example, the
following class will throw an exception because the function number_two() is
called before it is defined:
class Numbers:
one = 1
two = number_two()
def number_two():
return 2
# NameError: name 'number_two' is not defined
However, this version is fine:
class Numbers:
one = 1
def number_two():
return 2
two = number_two()
----------
nosy: +Jonathan Hsu
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40025>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com