Python - Inner Class Not Found

后端 未结 1 1169
南方客
南方客 2021-01-26 08:47

(Sorry I\'m new to Python)

I\'m running a python django script as follows:

python3 manage.py test


class Command(NoArgsCommand)         


        
相关标签:
1条回答
  • 2021-01-26 09:27

    Inner classes are very rarely useful in Python. Certainly here there is nothing to be gained by making GoalScorerX an inner class. Move it outside; also note that there is no restriction in Python in the number of classes in a file, so it's fine to have them both as top-level classes.

    (Note, you could fix this by referring to the inner class as Command.GoalScorerX - but don't do that.)

    0 讨论(0)
提交回复
热议问题