Tagged Questions
1
vote
1answer
69 views
Using class like an object in Python
I am learning from Learn Python the hard way where I have come across a study drill where they want to know that whether a class can be used like an object.
As I have experimented:
class A(object):
...
1
vote
1answer
120 views
Dynamic method creation in python
I have a class that will have a number of external methods that will all call the same smaller set of internal methods. So something like:
obj.method_one(a, c) and
obj.method_two(a, c)
where ...
3
votes
1answer
3k views
Why use classes when programming a tkinter gui in python
I program primarily in python and have programmed a couple of GUI's with Tkinter, every tutorial I have ever seen has recommended defining and using a class for the GUI, but my GUI runs flawlessly ...
2
votes
2answers
1k views
When to use private methods in Python
I have a class, but every method in it should be private (apart form __init__ and __str__). Should I denote every method with a double underscore, or is that deemed bad practice?
2
votes
2answers
220 views
Start by Teaching Classes [closed]
In every class, and every book I have seen regarding programming, classes are held off. They are thought to be confusing and strange. I certainly had issues with them.
But in object orient ...
2
votes
2answers
407 views
Should I split a Python class with many methods into multiple classes?
I have a class that will end up having more than ~30 methods. They all make sense to be part of the same class because they require access to the same data.
However, does it make any sense to split ...
8
votes
5answers
644 views
Python: What is the point of using “import”?
I am not very clear on this aspect. Let's say you have a bunch of .py files that are their own separate modules.
Why does each .py file need to import the others when they use that class? Or do they? ...