Skip to main content

All Questions

Tagged with
2 votes
1 answer
54 views

Matlab object arrays' method call equivalent in Python

Matlab has object arrays, Python has lists or tuples. Calling a method of a class on an object array of objects of that class, is easy in Matlab: A = [Class1(1), Class1(2)]; B = A.toClass2(); see &...
Miels's user avatar
  • 21
0 votes
1 answer
47 views

How to model two abstractions that have polymorphic relation in OOP

So I have a problem how to model data in my project. I have it in python and doing it in OOP fashion. But I cannot figure out a right way to model this case: Let's say there is an abstract class ...
pkobielak's user avatar
-1 votes
1 answer
159 views

How could I create a system for my trading bots [closed]

I want to create a system where I can manage a privet trading bots ,I don't Know how to architects it with OOP or create a file for each bot I will store the strategies in one file so I can import it ...
ms_safy's user avatar
0 votes
1 answer
624 views

Python: how to set the global log level properly?

I'm setting the log level based on a configuration. Currently I call Settings() from the inside of Logger, but I'd like to pass it instead or set it globally - for all loggers. I do not want to call ...
Mr. B.'s user avatar
  • 8,725
1 vote
1 answer
256 views

Dependency Inversion Principle - Why Not Use A Base Class?

Let's say I have an application which uses a special network socket, which transmits data over a socket in XML format called XMLSocket. XMLSocket inherits BaseSocket, and satisfies the Liskov ...
Abraham's user avatar
  • 93
-1 votes
1 answer
25 views

An OOP pattern that selectively help returns a mathematically-accurate value or its formatted representation

There is an object trade_pair whose methods are able to return float values about stored in quotes and values (the number of both currencies, the current price, etc.). Only mathematical float values ...
Vyacheslav's user avatar
0 votes
2 answers
488 views

How to decouple a class from it's attributes when the methods of the attributes need to modify state of the owning class?

How do I decouple a class from its attributes when methods of the attributes need to modify the state of the owning class? Alternatively, how can I redesign the architecture so that this isn't a ...
Blue7's user avatar
  • 2,044
19 votes
3 answers
1k views

Should Domain Model Classes always depend on primitives?

Halfway through Architecture Patterns with Python, I have two questions about how should the Domain Model Classes be structured and instantiated. Assume on my Domain Model I have the class DepthMap: ...
Ramon's user avatar
  • 501
0 votes
0 answers
98 views

Passing Objects and Proper Program Architecture - Python

I am creating a python script that executes a series of tests that writes and reads information to and from a CAN bus network. I'm using python-can and cantools packages. I've managed to transmit and ...
Tim51's user avatar
  • 141
2 votes
0 answers
89 views

Which paradigm or pattern to use for creating a wrapper over an API with python?

I want to create a library with python that uses different services from aws to access my data. The data can come from s3-bucket(AWS) with boto3 library, or via services from aws (like AWS Athena, or ...
Khan's user avatar
  • 1,518
0 votes
0 answers
52 views

Inherit and add methods or compose new object and take data as argument?

I am self-learning object-oriented Python and have a classical "inherit or compose" question in my project. I read through many of the general guidelines/answers to this question, but it's hard for me ...
J_Scholz's user avatar
  • 506
1 vote
1 answer
492 views

How to group or cluster many methods of a Python object

I have an object with a lot of methods. These methods can be grouped or clustered. Groups are e.g. 'model1', 'model2',..., which have methods like calc_density,calc_temperature, get_temperature,... ...
baudri's user avatar
  • 13
-1 votes
1 answer
138 views

How Python actually store and call functions on a lower-level?

Everything in Python is an object, even a function is an object and in turn, they are first-class functions. Moreover, it allows techniques like Monkey Patching. But, internally at the lower-level ...
DEEPAK SURANA's user avatar
0 votes
1 answer
115 views

Inheritance with large class hierarchy

Suppose you are creating a project that involves a large class hierarchy, which involves fairly complicated __init__ methods that call parents all the way from leaf classes to the root, like a ...
kmantel's user avatar
  • 125
2 votes
2 answers
138 views

Python application architecture

I'm trying to create task management system. (an app where somebody can create a task and set up a deadline date and get notifications). At first i will create console app and then web using django. ...
TorSen's user avatar
  • 149

15 30 50 per page