3 ms·
Python can be used to write procedural, functional or OOP. It's a multi-paradigm language which means it's up to you to give the code the structure you think is
by po 16y ago
Python can be used to write procedural, functional or OOP. It's a multi-paradigm language which means it's up to you to give the code the structure you think is best for the problem.
For instance wikipedia has an example of the same problem written in python as functional or imperative style:
http://en.wikipedia.org/wiki/Functional_programming#Coding_styles http://en.wikipedia.org/wiki/Functional_programming#Coding_s...
If you're an absolute beginner to programming you should study a bit:
http://learnpythonthehardway.org/ http://learnpythonthehardway.org/
If you've done some programming in the past, you should still study the fundamentals of the language you're using. Buy or borrow a python reference book and read through it. It looks to me like you're getting frustrated with not knowing what return types you're getting out of methods and functions. A reference book will help with that. You should also understand python's way of using duck typing:
http://en.wikipedia.org/wiki/Duck_typing#In_Python http://en.wikipedia.org/wiki/Duck_typing#In_Python