+ 3

Can I use classes in Python like in Java?

Can I use classes in Python like in Java? So I place classes in different files?

12th Dec 2017, 8:50 AM
TuniSenpao
TuniSenpao - avatar
3 Answers
+ 7
Yes, you could do that. If you put stuff in a separate file, it in effect becomes a module, and you can import the module into other code . You can also put several independent but related classes into a single module file. See this tutorial: https://www.learnpython.org/en/Modules_and_Packages
12th Dec 2017, 8:56 AM
Eric Blinkidu
Eric Blinkidu - avatar
+ 1
Thanks a lot! Wasn't sure about if I can use modules as classes :D
12th Dec 2017, 9:03 AM
TuniSenpao
TuniSenpao - avatar
0
theoritically will it be slower?
30th Dec 2017, 5:01 PM
X Fu
X Fu - avatar