Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Importing Program Wide
#5
(Sep-07-2020, 03:40 AM)ndc85430 Wrote: If you've got one module that's used everywhere, that sounds like bad design - seems like you don't have separation of concerns.

It would be good to see a concrete example, though.

I intend to start error logging on the project I’m working on. Now granted this is my first time having to do that manually (in php, the sever was always set up to do that for me). So I wanted to set up a class, or function that I can send errors to. It would automatically add the date, time and source of the error. It would also email me if anything major happened.

Since errors can happen anywhere, it’d be nice if I could autoload that, so I could just call it when it’s needed.

The program I am working on also happens to rely on input from an external API. Different parts of the program need results from it. I’d like to be able to call the API directly from the files that need it.

Also, smaller things. I always find myself formatting stings, or arrays in a specific way. In php and JavaScript, I simply make a function that does that for me, and call it when I need it. Once again, it would be nice if those things were omnipresent in all of the code.
Reply


Messages In This Thread
Importing Program Wide - by JarredAwesome - Sep-06-2020, 05:41 PM
RE: Importing Program Wide - by ndc85430 - Sep-06-2020, 06:38 PM
RE: Importing Program Wide - by JarredAwesome - Sep-06-2020, 11:53 PM
RE: Importing Program Wide - by ndc85430 - Sep-07-2020, 03:40 AM
RE: Importing Program Wide - by JarredAwesome - Sep-07-2020, 04:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Some help with my first python class and importing ....im making a lidar program jttolleson 7 1,220 Jul-28-2023, 08:34 AM
Last Post: jttolleson
  How to transform from wide to long format in python shantanu97 1 1,661 Nov-21-2021, 11:53 AM
Last Post: buran
  What is the best way to set application-wide config values? ajorona 1 1,920 May-07-2020, 05:03 PM
Last Post: buran
  output a list of random numbers 'x' columns wide adityavpratap 4 3,010 Jan-13-2020, 05:32 PM
Last Post: perfringo
  problem with importing my program meems 1 3,816 Nov-27-2016, 01:19 AM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020