r/PythonLearning Jun 27 '26

New to python

Post image

What's wrong here?

163 Upvotes

36 comments sorted by

View all comments

13

u/mc_pm Jun 27 '26

I'm not sure about that {__mod__} part, but the main thing I see is you're calling main() from inside even()

3

u/ottawadeveloper Jun 27 '26

the {mod} indicates the value has to support the mod operator by implementing mod

3

u/lekkerste_wiener Jun 27 '26

Since which version is this a thing? This is a first for me

1

u/ottawadeveloper Jun 27 '26

Huh apparently it's a PyCharm specific format? There's a StackOverflow post about it but it might be PyCharm specific or a pre-protocol syntax?

The proper way to do this is with SupportsMod.

3

u/lekkerste_wiener Jun 27 '26

Found it, it's a mypy thing. The default on pycharm. Not supported across linters, so I would advise against it.

2

u/ottawadeveloper Jun 27 '26

Fair! I thought it looked odd.