All Questions
9 questions
-2
votes
1
answer
295
views
Defining functions inside vs outside a class
Say I have a class with a function do_thing that is comprised of multiple steps, which themselves segregate into functions (first_process and second_process). At what point would this be considered ...
2
votes
1
answer
1k
views
In Python when is absolutely preferable to use a class instead of a module?
Python is the language I use most in this period.
My background in Java
Before start learning Python I have programmed in Java language. In Java all code is written inside the methods of a class and ...
3
votes
2
answers
464
views
Accessing properties from embedded objects as attributes of container class
In Python, I have a class C which embeds objects from classes A and B. Is it considered good practice to creates shortcuts from the properties of embedded objects of classes A and B as attributes of ...
3
votes
2
answers
1k
views
Is “A programmer-defined type.” a right definition of "class" in Python?
In Think Python 2e "class" is defined as "A programmer-defined type. A class definition creates a new class object."
But isn't a built-in type considered a class too?
Using Python 3.4.0, the ...
1
vote
3
answers
235
views
Everthing in a class/classes or just part of the program?
I wanted to move my program into a class or classes because most of the form post I read say it makes the program easier to read, understand the flow of the code, and improve maintainability.
...
0
votes
3
answers
2k
views
When NOT to use a class / member variable?
I am trying to learn WHEN NOT to use:
classes
member variables
HERE IS THE CODE
access_point_detection_classes.py
from scapy.all import *
class Handler :
def __init__(self) :
self....
4
votes
1
answer
1k
views
Avoiding tightly coupled class definitions in Python for has-a relationships
I have the following code:
class Car(object):
def __init__(self, my_id):
self.my_id = my_id
self.color = color
self.brand = brand
self.get_color()
self....
0
votes
1
answer
2k
views
Splitting single Class into multiple Classes
I am writing automated test scripts with Selenium Webdriver (Python) and I try to follow the correct programming practices, specifically the Object Oriented methodologies, where possible.
At the ...
1
vote
1
answer
3k
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 obj....