Python Forum
Stuck in functional proggaming haze
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stuck in functional proggaming haze
#1
New to actually programing in OOP. Looking for experienced guidance on making a decision on best practice on taking info from SQLite3, using info (text,size,color) on a row to create a Button, add the Button to a Kivy BoxLayout. The Button click will bring up add/edit screen for data to be updated to the db.

I am struggling seeing the benefit of creating each db row into a object IF THERE ARE NO METHODS and then turn around and use info in the object to create the buttons that represent the objects VERSUS just use the db info to create the buttons.

I can see how if i had methods it would be different- am i thinking correctly about that point?
Thanks
Reply
#2
Every Python value is an object. When you call func(text, size, color), an instance of tuple containing text, size and color is created for this call alone, not to mention that 3 objects were previously created for text, size and color. Tuples are often used as containers without calling their methods, so the question looks irrelevant.

There is an implicit performance issue in the question. You could try various solutions and compare them by using a profiler. Have a look at the timeit module and the profile module in the standard library.
Reply
#3
Thanks-sounds like i need to improve my knowledge with classes.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  functional LEDs in an array or list? // RPi user Doczu 5 1,523 Aug-23-2022, 05:37 PM
Last Post: Yoriz
  OOP vs functional - - elaborate turn based RPG game (Derek Banas Udemy course again) Drone4four 6 3,870 Mar-14-2021, 08:38 AM
Last Post: ndc85430
  Calculating surface area - - OOP or functional? Derek Banas Udemy course Drone4four 5 3,529 Mar-13-2021, 06:22 AM
Last Post: buran
  Learning functional programming vndywarhol 2 2,449 Aug-15-2018, 02:17 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