Python Forum
writing a class or a function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
writing a class or a function
#5
a function retaining data looks clear to me. if there are 2 function that need to share or exchange data, they can be made in the same module and that would do it. OTOH, when i try to think of a use case for data sharing/exchanging, i end up with an idea that would be done better in a class, such as a queued buffer. potential users might need more than one. while that can still be done with just some functions exchanging retained data in a module, layered with a container like a dictionary, a class makes it simpler because the design expression is just for one instance of the many instead of having all that indexing in the code (BTDT in C and assembler).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
writing a class or a function - by Skaperen - Dec-28-2018, 06:59 AM
RE: writing a class or a function - by Gribouillis - Dec-28-2018, 07:40 AM
RE: writing a class or a function - by Larz60+ - Dec-28-2018, 10:21 AM
RE: writing a class or a function - by ichabod801 - Dec-28-2018, 03:04 PM
RE: writing a class or a function - by Skaperen - Dec-28-2018, 07:18 PM
RE: writing a class or a function - by nilamo - Dec-28-2018, 08:00 PM
RE: writing a class or a function - by Skaperen - Dec-30-2018, 04:30 AM
RE: writing a class or a function - by ichabod801 - Dec-28-2018, 08:56 PM
RE: writing a class or a function - by Gribouillis - Dec-28-2018, 09:01 PM
RE: writing a class or a function - by Larz60+ - Dec-29-2018, 12:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  extracting a function/class/method from code Skaperen 5 2,362 Mar-30-2022, 12:13 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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